Skript Integration + UI Anpassungen

This commit is contained in:
2026-03-04 21:09:04 +00:00
parent 3b293bb743
commit 3957773854
16 changed files with 2569 additions and 143 deletions

View File

@@ -94,15 +94,20 @@ router.post(
const jobId = Number(req.params.jobId);
const selectedEncodeTitleId = req.body?.selectedEncodeTitleId ?? null;
const selectedTrackSelection = req.body?.selectedTrackSelection ?? null;
const selectedPostEncodeScriptIds = req.body?.selectedPostEncodeScriptIds;
logger.info('post:confirm-encode', {
reqId: req.reqId,
jobId,
selectedEncodeTitleId,
selectedTrackSelectionProvided: Boolean(selectedTrackSelection)
selectedTrackSelectionProvided: Boolean(selectedTrackSelection),
selectedPostEncodeScriptIdsCount: Array.isArray(selectedPostEncodeScriptIds)
? selectedPostEncodeScriptIds.length
: 0
});
const job = await pipelineService.confirmEncodeReview(jobId, {
selectedEncodeTitleId,
selectedTrackSelection
selectedTrackSelection,
selectedPostEncodeScriptIds
});
res.json({ job });
})

View File

@@ -1,6 +1,7 @@
const express = require('express');
const asyncHandler = require('../middleware/asyncHandler');
const settingsService = require('../services/settingsService');
const scriptService = require('../services/scriptService');
const notificationService = require('../services/notificationService');
const pipelineService = require('../services/pipelineService');
const wsService = require('../services/websocketService');
@@ -25,6 +26,83 @@ router.get(
})
);
router.get(
'/handbrake-presets',
asyncHandler(async (req, res) => {
logger.debug('get:settings:handbrake-presets', { reqId: req.reqId });
const presets = await settingsService.getHandBrakePresetOptions();
res.json(presets);
})
);
router.get(
'/scripts',
asyncHandler(async (req, res) => {
logger.debug('get:settings:scripts', { reqId: req.reqId });
const scripts = await scriptService.listScripts();
res.json({ scripts });
})
);
router.post(
'/scripts',
asyncHandler(async (req, res) => {
const payload = req.body || {};
logger.info('post:settings:scripts:create', {
reqId: req.reqId,
name: String(payload?.name || '').trim() || null,
scriptBodyLength: String(payload?.scriptBody || '').length
});
const script = await scriptService.createScript(payload);
wsService.broadcast('SETTINGS_SCRIPTS_UPDATED', { action: 'created', id: script.id });
res.status(201).json({ script });
})
);
router.put(
'/scripts/:id',
asyncHandler(async (req, res) => {
const scriptId = Number(req.params.id);
const payload = req.body || {};
logger.info('put:settings:scripts:update', {
reqId: req.reqId,
scriptId,
name: String(payload?.name || '').trim() || null,
scriptBodyLength: String(payload?.scriptBody || '').length
});
const script = await scriptService.updateScript(scriptId, payload);
wsService.broadcast('SETTINGS_SCRIPTS_UPDATED', { action: 'updated', id: script.id });
res.json({ script });
})
);
router.delete(
'/scripts/:id',
asyncHandler(async (req, res) => {
const scriptId = Number(req.params.id);
logger.info('delete:settings:scripts', {
reqId: req.reqId,
scriptId
});
const removed = await scriptService.deleteScript(scriptId);
wsService.broadcast('SETTINGS_SCRIPTS_UPDATED', { action: 'deleted', id: removed.id });
res.json({ removed });
})
);
router.post(
'/scripts/:id/test',
asyncHandler(async (req, res) => {
const scriptId = Number(req.params.id);
logger.info('post:settings:scripts:test', {
reqId: req.reqId,
scriptId
});
const result = await scriptService.testScript(scriptId);
res.json({ result });
})
);
router.put(
'/:key',
asyncHandler(async (req, res) => {