feat: serve httpTts-mimo.json via /httpTts.json for direct app import
This commit is contained in:
@@ -12,6 +12,7 @@ COPY requirements.txt .
|
|||||||
RUN pip install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
|
RUN pip install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
|
||||||
|
|
||||||
COPY app/ .
|
COPY app/ .
|
||||||
|
COPY httpTts-mimo.json .
|
||||||
|
|
||||||
RUN mkdir -p /app/data /app/audio
|
RUN mkdir -p /app/data /app/audio
|
||||||
|
|
||||||
|
|||||||
11
app/main.py
11
app/main.py
@@ -492,6 +492,17 @@ async def get_config():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# ── 配置文件下载 ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
@app.get("/httpTts.json")
|
||||||
|
async def serve_http_tts_config():
|
||||||
|
"""提供 App 导入用的音频源配置文件"""
|
||||||
|
config_path = os.path.join(config.BASE_DIR, "httpTts-mimo.json")
|
||||||
|
if os.path.exists(config_path):
|
||||||
|
return FileResponse(config_path, media_type="application/json")
|
||||||
|
raise HTTPException(404, "配置文件不存在")
|
||||||
|
|
||||||
|
|
||||||
# ── 静态文件 & 前端 ──────────────────────────────────────────────────────
|
# ── 静态文件 & 前端 ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
app.mount("/audio", StaticFiles(directory=config.AUDIO_DIR), name="audio")
|
app.mount("/audio", StaticFiles(directory=config.AUDIO_DIR), name="audio")
|
||||||
|
|||||||
Reference in New Issue
Block a user