Identite Fuel Advisor, assets locaux et audit economique corrige
Renommage Fuel Advisor (titre, header, favicon SVG/PNG, apple-touch-icon, logo SVG servis localement). Oracle: contrainte de penalty corrigee (portee inversee), quantites non entieres ecartees avant rejeu, double comptage de penalite supprime. Audit economique regenerer: plafonds omniscients coherents et positifs; deux lignes non resolues conservees telles quelles.
This commit is contained in:
25
app.py
25
app.py
@@ -489,6 +489,20 @@ class Handler(BaseHTTPRequestHandler):
|
||||
status,
|
||||
)
|
||||
|
||||
# Assets servis localement : aucun appel distant au moment du rendu. Les images sont
|
||||
# mises en cache côté client, les pages restent revalidées pour ne pas figer l'interface.
|
||||
STATIC_FILES = {
|
||||
"/": "text/html; charset=utf-8",
|
||||
"/index.html": "text/html; charset=utf-8",
|
||||
"/ui.js": "text/javascript; charset=utf-8",
|
||||
"/style.css": "text/css; charset=utf-8",
|
||||
"/logo.svg": "image/svg+xml",
|
||||
"/favicon.svg": "image/svg+xml",
|
||||
"/favicon-32.png": "image/png",
|
||||
"/favicon-16.png": "image/png",
|
||||
"/apple-touch-icon.png": "image/png",
|
||||
}
|
||||
|
||||
def do_GET(self):
|
||||
try:
|
||||
parsed = urllib.parse.urlparse(self.path)
|
||||
@@ -496,14 +510,9 @@ class Handler(BaseHTTPRequestHandler):
|
||||
q = {k: v[0] for k, v in urllib.parse.parse_qs(parsed.query).items()}
|
||||
if path == "/healthz":
|
||||
return self.send_json(dict(ok=True, version=2, time=now_iso()))
|
||||
if path in ("/", "/index.html", "/ui.js", "/style.css"):
|
||||
name = "index.html" if path in ("/", "/index.html") else path[1:]
|
||||
content_type = {
|
||||
"index.html": "text/html; charset=utf-8",
|
||||
"ui.js": "text/javascript; charset=utf-8",
|
||||
"style.css": "text/css; charset=utf-8",
|
||||
}[name]
|
||||
return self.send_body((APP_DIR / name).read_bytes(), content_type)
|
||||
if path in self.STATIC_FILES:
|
||||
name = "index.html" if path == "/" else path.lstrip("/")
|
||||
return self.send_body((APP_DIR / name).read_bytes(), self.STATIC_FILES[path])
|
||||
if path == "/api/config":
|
||||
return self.send_json(dict(fuels=FUEL_TYPES, default_fuel=DEFAULT_FUEL))
|
||||
if path == "/api/status":
|
||||
|
||||
Reference in New Issue
Block a user