docs read fix

This commit is contained in:
JiriUhlir
2026-08-03 12:04:13 +02:00
parent eb7ee612c3
commit d50093e893
3 changed files with 69 additions and 15 deletions
+22 -2
View File
@@ -1,10 +1,30 @@
import html
import unicodedata
from pathlib import Path
from ..config import PORTAL_PREFIX
APP_NAME = "CSBot Services Portal"
STATIC_DIR = Path(__file__).resolve().parent.parent / "static"
def _asset_version(filename: str) -> str:
"""Otisk statického souboru do URL (?v=...).
Starlette u statiky neposílá Cache-Control, takže prohlížeč umí po nasazení držet starý
styles.css/portal.js a nová stránka pak vypadá rozbitě. Otisk se počítá při startu
aplikace - po redeployi kontejneru se změní a prohlížeč si soubor stáhne znovu.
"""
try:
return str(int((STATIC_DIR / filename).stat().st_mtime))
except OSError:
return "0"
STYLES_VERSION = _asset_version("styles.css")
SCRIPT_VERSION = _asset_version("portal.js")
# Sekce viditelné pouze pro tento e-mail (Migration Readiness, Runtime Management, Environment).
SUPER_ADMIN_EMAIL = "jiri.uhlir59@gmail.com"
@@ -104,8 +124,8 @@ def page(title: str, body: str, user=None) -> str:
<title>{APP_NAME} - {html.escape(title)}</title>
<link rel="stylesheet" href="{PORTAL_PREFIX}/static/vendor/fontawesome/css/fontawesome.min.css">
<link rel="stylesheet" href="{PORTAL_PREFIX}/static/vendor/fontawesome/css/solid.min.css">
<link rel="stylesheet" href="{PORTAL_PREFIX}/static/styles.css">
<script src="{PORTAL_PREFIX}/static/portal.js"></script>
<link rel="stylesheet" href="{PORTAL_PREFIX}/static/styles.css?v={STYLES_VERSION}">
<script src="{PORTAL_PREFIX}/static/portal.js?v={SCRIPT_VERSION}"></script>
</head>
<body>
<header>