mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-22 14:38:11 +02:00
refactor(tts): replace Minimax+Freesound with Piper TTS
Remove Minimax Speech API and Freesound integrations entirely. Add Piper TTS as the sole TTS provider via configurable HTTP URL. - Add piper_config DB table (url field, per-user) - Add GET/POST /api/piper/config routes - Python: replace generate_tts_minimax with generate_tts_piper (GET ?text=, WAV→MP3) - Simplify generate_tts_with_subs: piper_url param replaces tts_provider+minimax fields - Drop ttsVoice/ttsProvider from all UI, API, and background job params - Settings page: replace Minimax+Freesound cards with single Piper URL input - Remove freeSoundService init from server startup and CSP headers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
0209c3eacf
commit
797e12dde5
14 files changed
+152
-725
No files matched your search
+2
-30
@@ -15,7 +15,6 @@ import { ensureAdminUserExists } from "./init-admin";
|
||||
import { startTokenCron } from "./cron";
|
||||
import { migrate } from "./migrate";
|
||||
import { jamendoService } from "./services/jamendo";
|
||||
import { freeSoundService } from "./services/freesound";
|
||||
import { ffmpegService } from "./services/ffmpeg";
|
||||
|
||||
const app = express();
|
||||
@@ -34,8 +33,8 @@ app.use(helmet({
|
||||
styleSrc: ["'self'", "'unsafe-inline'", "https://fonts.googleapis.com"],
|
||||
imgSrc: ["'self'", "data:", "https:", "blob:"],
|
||||
fontSrc: ["'self'", "https://fonts.gstatic.com"],
|
||||
connectSrc: ["'self'", "https://graph.facebook.com", "https://openrouter.ai", "https://res.cloudinary.com", "https://freesound.org", "wss:", "ws:"],
|
||||
mediaSrc: ["'self'", "https://cdn.freesound.org", "https:", "data:"],
|
||||
connectSrc: ["'self'", "https://graph.facebook.com", "https://openrouter.ai", "https://res.cloudinary.com", "wss:", "ws:"],
|
||||
mediaSrc: ["'self'", "https:", "data:"],
|
||||
}
|
||||
},
|
||||
crossOriginEmbedderPolicy: false,
|
||||
@@ -209,33 +208,6 @@ app.use((req, res, next) => {
|
||||
const jamendoClientId = process.env.JAMENDO_CLIENT_ID || '5b6bba49';
|
||||
jamendoService.configure(jamendoClientId);
|
||||
|
||||
// Configurer le service FreeSound pour les Reels
|
||||
// 1. Essayer de charger depuis la DB (suppose un utilisateur admin ou premier utilisateur)
|
||||
// Note: Dans un contexte multi-utilisateur, cela devrait être fait par requête.
|
||||
// Pour l'instant, on charge la config du premier user trouvé ou via variable d'env.
|
||||
|
||||
let freesoundConfigured = false;
|
||||
try {
|
||||
const { storage } = await import("./storage");
|
||||
const allUsers = await storage.getAllUsers();
|
||||
if (allUsers.length > 0) {
|
||||
const dbConfig = await storage.getFreesoundConfig(allUsers[0].id);
|
||||
if (dbConfig && dbConfig.clientId && dbConfig.clientSecret) {
|
||||
freeSoundService.configure(dbConfig.clientId, dbConfig.clientSecret);
|
||||
freesoundConfigured = true;
|
||||
log('🎵 FreeSound configured from Database');
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('Failed to load Freesound config from DB:', err);
|
||||
}
|
||||
|
||||
if (!freesoundConfigured && process.env.FREESOUND_CLIENT_ID && process.env.FREESOUND_CLIENT_SECRET) {
|
||||
freeSoundService.configure(process.env.FREESOUND_CLIENT_ID, process.env.FREESOUND_CLIENT_SECRET);
|
||||
log('🎵 FreeSound configured from Environment Variables');
|
||||
} else if (!freesoundConfigured) {
|
||||
log('⚠️ FreeSound credentials not found - music search will be disabled');
|
||||
}
|
||||
|
||||
// Configurer le service FFmpeg pour le traitement vidéo (si configuré)
|
||||
if (process.env.FFMPEG_API_URL && process.env.FFMPEG_API_KEY) {
|
||||
|
||||
Reference in new issue
Block a user