feat: 新增5部经典下拉选经、TTS重试、PWA可安装

- 新增阿弥陀经/普门品/道德经/清静经/太上感应篇(维基文库底本,OpenCC转简体)
- 经典切换改为下拉框(佛/道分组),移动端复用底部面板并显示分组标题
- TTS 请求失败自动重试3次;普门品偈颂拆分修复600字上限问题
- 服务端缓存原子写(.tmp+rename),上限放宽至800字
- PWA:manifest + Service Worker,安装后无地址栏独立窗口
- 偏好记忆/逐字光标/回到诵读处/夜间模式等此前改动一并入库

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
selfrelease
2026-10-04 15:47:18 +08:00
co-authored by Devin
parent ad56a147a6
commit bc0bfd9263
9 changed files with 928 additions and 74 deletions
+6 -3
View File
@@ -88,8 +88,8 @@ class Handler(SimpleHTTPRequestHandler):
if not text or not voice:
self._send_json({"error": "缺少 text 或 voice 参数"}, status=400)
return
if len(text) > 600:
self._send_json({"error": "文本超过 600 字上限"}, status=400)
if len(text) > 800:
self._send_json({"error": "文本超过 800 字上限"}, status=400)
return
if not API_KEY:
self._send_json({"error": "服务端未配置 DASHSCOPE_API_KEY"}, status=500)
@@ -103,7 +103,10 @@ class Handler(SimpleHTTPRequestHandler):
else:
audio = synthesize(text, voice)
CACHE_DIR.mkdir(exist_ok=True)
cache_file.write_bytes(audio)
# 先写临时文件再原子重命名,避免中途崩溃留下半截 WAV 毒化缓存
tmp_file = cache_file.with_suffix(".tmp")
tmp_file.write_bytes(audio)
tmp_file.replace(cache_file)
except urllib.error.HTTPError as exc:
detail = exc.read().decode("utf-8", errors="replace")[:300]
self._send_json({"error": f"TTS 服务返回 {exc.code}:{detail}"}, status=502)