feat: add configurable video AI links

This commit is contained in:
2026-06-04 11:11:36 +02:00
parent 9dddaffdd4
commit ab5a967fe4
6 changed files with 183 additions and 0 deletions
+20
View File
@@ -349,6 +349,23 @@ async function handleHealth(req, res) {
});
}
function handleConfig(req, res) {
let videoAiLinks = [];
const envLinks = process.env.VIDEO_AI_LINKS || '';
if (envLinks.trim()) {
// Expected format: "Kling AI=https://klingai.com,Luma=https://lumalabs.ai"
videoAiLinks = envLinks.split(',').map(part => {
const idx = part.indexOf('=');
if (idx > 0) {
return { name: part.slice(0, idx).trim(), url: part.slice(idx + 1).trim() };
}
return null;
}).filter(link => link !== null);
}
json(res, { videoAiLinks });
}
async function handleStyleRandom(req, res) {
let body;
try { body = await readJsonBody(req); }
@@ -512,6 +529,9 @@ const server = createServer(async (req, res) => {
if (req.method === 'GET' && req.url.split('?')[0] === '/api/health') {
return handleHealth(req, res);
}
if (req.method === 'GET' && req.url.split('?')[0] === '/api/config') {
return handleConfig(req, res);
}
if (req.method === 'POST' && req.url.split('?')[0] === '/api/generate') {
return handleGenerate(req, res);
}