mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Add a warning about missing Application Cache support to the server home page
This commit is contained in:
parent
d703d0ec56
commit
db6d0dd2cb
@ -6,3 +6,8 @@ from __python__ import hash_literals, bound_methods
|
||||
book_list_container_id = 'book-list-container'
|
||||
read_book_container_id = 'read-book-container'
|
||||
INIT_ENDPOINT = 'interface-data/init'
|
||||
|
||||
def has_offline_support(val):
|
||||
if val is not undefined:
|
||||
has_offline_support.ans = val
|
||||
return has_offline_support.ans
|
||||
|
@ -6,13 +6,14 @@ from elementmaker import E
|
||||
from gettext import gettext as _
|
||||
|
||||
from ajax import ajax_send
|
||||
from book_list.constants import has_offline_support
|
||||
from book_list.cover_grid import BORDER_RADIUS
|
||||
from book_list.globals import get_db
|
||||
from book_list.library_data import last_virtual_library_for, sync_library_books
|
||||
from book_list.router import open_book, update_window_title
|
||||
from book_list.top_bar import add_button, create_top_bar
|
||||
from book_list.ui import set_default_panel_handler, show_panel
|
||||
from dom import add_extra_css, build_rule, clear, ensure_id, unique_id, set_css
|
||||
from dom import add_extra_css, build_rule, clear, ensure_id, set_css, unique_id
|
||||
from modals import create_custom_dialog
|
||||
from session import get_device_uuid, get_interface_data
|
||||
from utils import conditional_timeout, safe_set_inner_html, username_key
|
||||
@ -256,5 +257,12 @@ def init(container_id):
|
||||
cl.lastChild.style.margin = '1ex 1rem'
|
||||
cl.lastChild.dataset.lid = library_id
|
||||
|
||||
if not has_offline_support():
|
||||
container.appendChild(E.div(
|
||||
style='margin-top: 1rem; padding: 1rem; border-top: solid 1px currentColor',
|
||||
_('WARNING: This browser does not support Application Cache so offline access'
|
||||
' to calibre will not work. Some browsers only enable Application Cache over HTTPS'
|
||||
' connections, so you may have to setup HTTPS for your calibre server.')))
|
||||
|
||||
|
||||
set_default_panel_handler(init)
|
||||
|
@ -10,6 +10,7 @@ from ajax import ajax, console_print, set_default_timeout
|
||||
from autoreload import create_auto_reload_watcher
|
||||
from book_list.globals import main_js
|
||||
from book_list.main import main
|
||||
from book_list.constants import has_offline_support
|
||||
|
||||
is_running_in_iframe = False # Changed before script is loaded in the iframe
|
||||
autoreload_enabled = False
|
||||
@ -50,7 +51,9 @@ else:
|
||||
window.applicationCache.addEventListener('updateready', on_appcache_ready)
|
||||
if window.applicationCache.status is window.applicationCache.UPDATEREADY:
|
||||
on_appcache_ready()
|
||||
has_offline_support(True)
|
||||
else:
|
||||
has_offline_support(False)
|
||||
console.warn("Your browser does not have a working Application Cache, offline access will not work")
|
||||
script = document.currentScript or document.scripts[0]
|
||||
main_js(script.textContent)
|
||||
|
Loading…
x
Reference in New Issue
Block a user