Offline downloads, service worker, iOS audio unlock fix
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7f59c6d27b
commit
5f88ab891b
5 files changed
+186
-29
No files matched your search
@@ -41,7 +41,7 @@ SESSION_DAYS = 90
|
||||
|
||||
# Files the browser fetches without a session (home-screen icon and manifest).
|
||||
PUBLIC = {"/manifest.webmanifest": "application/manifest+json", "/icon-180.png": "image/png",
|
||||
"/icon-192.png": "image/png", "/icon-512.png": "image/png"}
|
||||
"/icon-192.png": "image/png", "/icon-512.png": "image/png", "/sw.js": "text/javascript"}
|
||||
|
||||
# Only read-only endpoints needed for listening are reachable; admin commands/import are not.
|
||||
ALLOWED = [re.compile(p) for p in (
|
||||
@@ -223,7 +223,7 @@ class Handler(BaseHTTPRequestHandler):
|
||||
return self.logout()
|
||||
if path in PUBLIC:
|
||||
with open(os.path.join(HERE, path[1:]), "rb") as f:
|
||||
return self.send_body(200, f.read(), PUBLIC[path], [("Cache-Control", "public, max-age=86400")])
|
||||
return self.send_body(200, f.read(), PUBLIC[path], [("Cache-Control", "no-cache" if path in ("/sw.js", "/manifest.webmanifest") else "public, max-age=86400")])
|
||||
user = self.user()
|
||||
if not user:
|
||||
return self.deny(path)
|
||||
|
||||
Reference in new issue
Block a user