sync snapshot from LAN repo (source master-zg @ 40658c74)
This commit is contained in:
1 parent
ea9dcff9c0
commit
754b61572c
179 files changed
+26085
-8788
No files matched your search
@@ -10,6 +10,7 @@ from pathlib import Path
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from fastapi.responses import FileResponse, Response
|
||||
|
||||
from deerflow.config.system_settings import generated_page_logo_path, load_system_settings
|
||||
from deerflow.html_runtime.addresses import html_map_tile_url, html_runtime_base_url
|
||||
|
||||
router = APIRouter(prefix="/api/public/html-runtime", tags=["html-runtime"])
|
||||
@@ -28,6 +29,12 @@ _STATIC_ASSETS = {
|
||||
"g6.min.js": "application/javascript",
|
||||
"leaflet.js": "application/javascript",
|
||||
"leaflet.css": "text/css",
|
||||
# 生成页品牌页头背景设计图(浅色红调 / 深色深蓝),随明暗 tone 由页头样式切换。
|
||||
"topbar-light.svg": "image/svg+xml",
|
||||
"topbar-dark.svg": "image/svg+xml",
|
||||
# Packaged fallback used when an administrator-uploaded generated-page
|
||||
# logo cannot be fetched through a deployment's reverse-proxy path.
|
||||
"brand-logo-dark.png": "image/png",
|
||||
}
|
||||
_GEO_MAP_ASSETS = {
|
||||
"china-provinces.geojson": "application/geo+json",
|
||||
@@ -94,6 +101,26 @@ async def get_html_runtime_geo_map(filename: str) -> FileResponse:
|
||||
)
|
||||
|
||||
|
||||
@router.get("/generated-page-logo")
|
||||
async def get_generated_page_logo() -> FileResponse:
|
||||
"""Serve the configured logo, falling back to the packaged default."""
|
||||
|
||||
branding = load_system_settings().generated_page_branding
|
||||
path = generated_page_logo_path(branding)
|
||||
if path is None:
|
||||
path = _RUNTIME_DIR / "brand-logo-dark.png"
|
||||
media_type = "image/png"
|
||||
else:
|
||||
media_type = branding.logo_media_type or "application/octet-stream"
|
||||
if not path.is_file():
|
||||
raise HTTPException(status_code=503, detail="Generated-page fallback logo is not installed")
|
||||
return FileResponse(
|
||||
path,
|
||||
media_type=media_type,
|
||||
headers={**_PUBLIC_HEADERS, "Cache-Control": "public, max-age=3600"},
|
||||
)
|
||||
|
||||
|
||||
@router.get("/{filename}")
|
||||
async def get_html_runtime_asset(filename: str) -> FileResponse:
|
||||
"""Serve a whitelisted, vendored browser distribution file."""
|
||||
|
||||
Reference in new issue
Block a user