fix: 修复 material_service 规范问题 + 背景图 fetch 超时 + CSS 死代码

1. material_service.py:
   - 删除未使用的 get_settings 导入
   - 将 import logging 从函数内移到模块顶部

2. CoverDesign.tsx:
   - 远程 bg-config.json fetch 增加 5 秒 AbortController 超时
   - 超时后自动 fallback 到本地配置

3. CoverDesign.css:
   - 删除 .cover-title-overlay/.cover-title-line(旧版 assjs 遗留)
   - 删除 .template-selector/.template-btn 系列(旧版模板选择器)
   - 删除 .cover-bg-options/.cover-bg-option(旧版背景卡片)
   - 删除 .title-input-section/.cover-hint(已废弃样式)
This commit is contained in:
小鱼开发
2026-04-30 16:04:52 +08:00
parent bdd582bd76
commit 35a9eb89ce
3 changed files with 12 additions and 142 deletions
+4 -4
View File
@@ -8,16 +8,18 @@ duration 从文件名 `_{N}s_` 中自动解析。
"""
import json
import logging
import random
import re
from pathlib import Path
import httpx
from app.config import get_settings
# 正则:从文件名中提取时长,如 plumbing_10s_a23f8fcb.mp4 → 10
_DURATION_RE = re.compile(r"_(\d+)s_")
logger = logging.getLogger(__name__)
# 远程配置 URL(七牛云 CDN
REMOTE_CONFIG_URL = "https://media.liche.cn/meijiaka-zy/materials.json"
@@ -71,9 +73,7 @@ def load_config() -> None:
return
except Exception as e:
# 远程加载失败,记录日志后继续尝试本地
import logging
logging.getLogger(__name__).warning(f"远程素材配置加载失败: {e},尝试本地 fallback")
logger.warning(f"远程素材配置加载失败: {e},尝试本地 fallback")
# 2. Fallback 到本地文件
config_path = _get_config_path()