diff --git a/app.py b/app.py index 46ae36b..62f7f82 100644 --- a/app.py +++ b/app.py @@ -33,6 +33,15 @@ def _upstream(fn, *a, **kw): raise HTTPException(502, f"upstream error: {e}") +@app.middleware("http") +async def no_cache(request, call_next): + # ponytail: no-store on everything except /stream (segments should cache) + r = await call_next(request) + if not request.url.path.startswith("/stream"): + r.headers["Cache-Control"] = "no-store" + return r + + @app.get("/api/search") def api_search(q: str = Query(min_length=1)): return _upstream(upstream.search, q) diff --git a/static/app.js b/static/app.js index 814900e..e1cd2e5 100644 --- a/static/app.js +++ b/static/app.js @@ -79,7 +79,7 @@ async function showAnime(slug_id, opts = {}) { main.innerHTML = ""; const head = el("section", "detail-head"); - head.append(el("h2", null, detail.name), el("p", "synopsis", detail.synopsis || "")); + head.append(el("h2", null, detail.name)); main.append(head); const player = el("div", "player"); @@ -127,6 +127,8 @@ async function showAnime(slug_id, opts = {}) { const cur = [...eps.children].find(b => +b.dataset.ep === opts.ep); if (cur) { markActive(cur); play(opts.ep, cur.dataset.no); } } + + if (detail.synopsis) main.append(el("p", "synopsis bottom", detail.synopsis)); } function langLabel() { return lang === "eng" ? "▶ dub" : "▶ sub"; }