chore: serve bundled assets from app directory

This commit is contained in:
koko
2026-05-02 02:12:14 +08:00
parent e47c87f3a3
commit 147b324658
31 changed files with 2 additions and 91 deletions

View File

@@ -27,9 +27,9 @@ def _resolve_asset_filename(filename):
"""Resolve hashed Vite assets without maintaining hardcoded alias tables."""
safe_name = os.path.basename(filename)
asset_dirs = [
ASSETS_DIR,
os.path.abspath(os.path.join(BASE_DIR, 'new_web_source', 'assets')),
os.path.abspath(os.path.join(BASE_DIR, '..', 'new_web_source', 'assets')),
ASSETS_DIR,
]
for asset_dir in asset_dirs:
exact_path = os.path.join(asset_dir, safe_name)
@@ -153,9 +153,9 @@ def serve_assets(filename):
"""提供 static 目录及子目录下的静态文件访问。"""
filename = _resolve_asset_filename(filename)
candidate_dirs = [
os.path.abspath(ASSETS_DIR),
os.path.abspath(os.path.join(BASE_DIR, 'new_web_source', 'assets')),
os.path.abspath(os.path.join(BASE_DIR, '..', 'new_web_source', 'assets')),
os.path.abspath(ASSETS_DIR),
]
for static_abs in candidate_dirs:
filepath = os.path.normpath(os.path.join(static_abs, filename))