Security fixes: - Block /proc /sys /dev /run /boot in /api/browse-dirs (path traversal) - Verify yt-dlp output stays inside TEMP_DIR before registration - Remove Access-Control-Allow-Origin: * from /api/proxy-audio - TTL-based temp file registry (default 2h) to prevent disk fill Performance: - Cache settings + routing rules in memory (mtime-checked); eliminates per-request disk reads on every TTS call UI: - Add container name (optional) field to Docker stack TTS/STT engine cards (Qwen3 Voice Clone, Voice Design, Custom Voice, Streaming, NVIDIA Magpie, Parakeet) — enables Stop/Start/Restart buttons on all engine cards, matching the existing Other Local TTS/STT cards Refactor — backend: - server.py: 5560 lines → 43-line entry point - core/ package: constants, registry, validation, docker_client, config, routing, audio, voice, presets, tts_helpers - routes/ package: admin, settings, library, stt, sources, docker, tts, conversation (FastAPI APIRouter modules) - Dockerfile + docker-compose.yml updated to include core/ and routes/ Refactor — frontend: - static/app.js: 8744 lines → 16 modules in static/js/ utils, voice-inspector, voice-sources, integrations, routing, settings, voice-clone, voice-library, tts-preview, benchmark, stt, init, engines, ai-backends, generation, conversation - static/loader.js updated to load modules sequentially Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44 lines
2.0 KiB
Python
44 lines
2.0 KiB
Python
"""TTS Voice Creator - Clone and Design — FastAPI entry point (thin wrapper)."""
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.staticfiles import StaticFiles
|
|
|
|
from core.constants import STATIC_DIR, _BufferHandler
|
|
from routes import admin, settings, library, stt, sources, docker, tts, conversation
|
|
|
|
logger = logging.getLogger("uvicorn.error")
|
|
|
|
# ── App ───────────────────────────────────────────────────────────────────────
|
|
|
|
app = FastAPI(title="TTS Voice Creator - Clone and Design")
|
|
|
|
# ── In-memory log buffer handler ──────────────────────────────────────────────
|
|
|
|
_buf_handler = _BufferHandler()
|
|
_buf_handler.setLevel(logging.DEBUG)
|
|
logging.getLogger().addHandler(_buf_handler)
|
|
|
|
# ── Routers ───────────────────────────────────────────────────────────────────
|
|
|
|
app.include_router(admin.router)
|
|
app.include_router(settings.router)
|
|
app.include_router(library.router)
|
|
app.include_router(stt.router)
|
|
app.include_router(sources.router)
|
|
app.include_router(docker.router)
|
|
app.include_router(tts.router)
|
|
app.include_router(conversation.router)
|
|
|
|
# ── Static files ──────────────────────────────────────────────────────────────
|
|
|
|
app.mount("/static", StaticFiles(directory=str(STATIC_DIR)), name="static")
|
|
|
|
# ── Dev runner ────────────────────────────────────────────────────────────────
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
uvicorn.run(app, host="0.0.0.0", port=7890, log_level="info")
|