feat: added PWA support

This commit is contained in:
2026-03-07 15:48:27 +01:00
parent acfbe71baa
commit fc83bab9f7
8 changed files with 150 additions and 1 deletions

12
app.py
View File

@@ -30,7 +30,7 @@ APP_PASSWORD = os.environ.get("PASSWORD", "")
def require_login():
if not APP_PASSWORD:
return
if request.endpoint in ("login", "static"):
if request.endpoint in ("login", "static", "service_worker", "offline"):
return
if not session.get("authenticated"):
if request.path.startswith("/api/"):
@@ -170,6 +170,16 @@ def run_download(job_id: str, urls: list[str], options: dict):
jobs[job_id]["output"] = jobs[job_id].get("output", []) + [str(e)]
@app.route("/sw.js")
def service_worker():
return send_from_directory("static", "sw.js", mimetype="application/javascript")
@app.route("/offline")
def offline():
return send_from_directory("static", "offline.html")
@app.route("/login", methods=["GET", "POST"])
def login():
if request.method == "POST":