stativ hash

This commit is contained in:
Mateusz Gruszczyński
2026-05-31 23:17:14 +02:00
parent 68d8ddc8d7
commit 62572ec273
6 changed files with 73 additions and 31 deletions
+3 -2
View File
@@ -16,7 +16,7 @@ from .config import (
SOCKETIO_CORS_ALLOWED_ORIGINS,
)
from .db import init_db
from .services.frontend_assets import asset_path, bootstrap_css_path, static_hash, validate_offline_assets
from .services.frontend_assets import asset_path, bootstrap_css_path, initialize_static_hash, static_hash, validate_offline_assets
socketio = SocketIO(cors_allowed_origins=SOCKETIO_CORS_ALLOWED_ORIGINS, ping_timeout=30, async_mode="threading")
@@ -56,6 +56,7 @@ def register_error_pages(app: Flask) -> None:
def create_app() -> Flask:
validate_offline_assets()
app = Flask(__name__)
initialize_static_hash(Path(app.static_folder or ""))
from .logging_config import configure_logging
configure_logging(app)
if PROXY_FIX_ENABLE:
@@ -83,7 +84,7 @@ def create_app() -> Flask:
path = Path(app.static_folder or "") / filename
try:
path.stat()
# Note: A single static hash keeps module imports, CSS and local libraries on the same cache version.
# Note: A single JS/CSS hash keeps module imports, stylesheets and local libraries on the same cache version.
return url_for("static", filename=filename, v=current_static_hash())
except OSError:
return url_for("static", filename=filename)