update
This commit is contained in:
@@ -16,7 +16,7 @@ from routes import router
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
(STORAGE_DIR / "themen").mkdir(parents=True, exist_ok=True)
|
||||
(STORAGE_DIR / "topics").mkdir(parents=True, exist_ok=True)
|
||||
await init_db()
|
||||
await reconcile_guides()
|
||||
yield
|
||||
@@ -24,8 +24,8 @@ async def lifespan(app: FastAPI):
|
||||
|
||||
|
||||
class CachedStatic(StaticFiles):
|
||||
"""StaticFiles mit Cache-Control: gehashte Assets dauerhaft (immutable),
|
||||
index.html nie cachen (verweist immer auf die aktuellen Asset-Hashes)."""
|
||||
"""StaticFiles with Cache-Control: hashed assets forever (immutable),
|
||||
index.html never cached (it always points at the current asset hashes)."""
|
||||
async def get_response(self, path, scope):
|
||||
resp = await super().get_response(path, scope)
|
||||
if path.startswith("assets/"):
|
||||
@@ -37,7 +37,7 @@ class CachedStatic(StaticFiles):
|
||||
|
||||
app = FastAPI(title="Creator", lifespan=lifespan)
|
||||
|
||||
# gzip für JS/CSS-Bundle + große JSON-Antworten (~1,39 MB JS → ~400 KB).
|
||||
# gzip for the JS/CSS bundle + large JSON responses (~1.39 MB JS → ~400 KB).
|
||||
app.add_middleware(GZipMiddleware, minimum_size=500)
|
||||
|
||||
app.include_router(router)
|
||||
|
||||
Reference in New Issue
Block a user