SysOps: voice-agy-webbuilder-backup — 2026-06-23 10:04 UTC
This commit is contained in:
+21
-1
@@ -5,6 +5,7 @@ from pathlib import Path
|
||||
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.templating import Jinja2Templates
|
||||
from starlette.responses import Response
|
||||
|
||||
from app.db import close_pool, fetch_all, init_pool
|
||||
from app.routes import (
|
||||
@@ -31,7 +32,10 @@ from app.routes import (
|
||||
packaging,
|
||||
ops,
|
||||
ops_api,
|
||||
revenue_cockpit,
|
||||
export_intel,
|
||||
)
|
||||
from app.routes.revenue_cockpit import api as revenue_cockpit_api
|
||||
from app.routes.admin_api import admin_router, ai_router, herman_api, voice_api
|
||||
from app.routes.settings_api import settings_router
|
||||
from app.routes.agents_api import router as agents_api_router
|
||||
@@ -41,8 +45,21 @@ from app.routes.projects_api import router as projects_api_router
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
templates = Jinja2Templates(directory=str(BASE_DIR / "templates"))
|
||||
|
||||
|
||||
class NoCacheStaticFiles(StaticFiles):
|
||||
"""Serve static assets without browser/SW long-lived caching."""
|
||||
|
||||
async def get_response(self, path: str, scope) -> Response:
|
||||
response = await super().get_response(path, scope)
|
||||
if path.endswith((".css", ".js", ".html")) or "/css/" in path or "/js/" in path:
|
||||
response.headers["Cache-Control"] = "no-store, no-cache, must-revalidate, max-age=0"
|
||||
response.headers["Pragma"] = "no-cache"
|
||||
response.headers["Expires"] = "0"
|
||||
return response
|
||||
|
||||
|
||||
app = FastAPI(title="Foodlinkk Command Center", version="2.5.0")
|
||||
app.mount("/static", StaticFiles(directory=str(BASE_DIR / "static")), name="static")
|
||||
app.mount("/static", NoCacheStaticFiles(directory=str(BASE_DIR / "static")), name="static")
|
||||
|
||||
for r in (
|
||||
dashboard.router,
|
||||
@@ -66,6 +83,9 @@ for r in (
|
||||
hermes.router,
|
||||
packaging.router,
|
||||
ops.router,
|
||||
revenue_cockpit.router,
|
||||
export_intel.router,
|
||||
revenue_cockpit_api,
|
||||
api.router,
|
||||
ops_api.router,
|
||||
admin_router,
|
||||
|
||||
Reference in New Issue
Block a user