Files
ferdi2goandClaude Opus 5.5 6e497ffc45 Export im Hintergrund mit Fortschritt, Abbruch und Download
Exporte laufen nacheinander. Der Fortschritt steht im Speicher; ein nach
einem Neustart verwaister Export wird als unterbrochen gemeldet. Nach
Änderungen an Einstellungen oder Dateien gilt ein fertiges Video als
veraltet. Der Download trägt den Zeitraum im Dateinamen.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 10:54:31 +00:00

54 lines
1.7 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import http from 'node:http';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import express from 'express';
import { createApp } from './app.js';
import { loadSessionSecret } from './auth.js';
import { loadConfig } from './config.js';
import { probe } from './media.js';
import { createProjectStore } from './projects.js';
import { createRenderQueue } from './renderQueue.js';
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
// Lokal liest der Entwicklungsserver eine .env; in Produktion setzt VCH die Umgebung.
if (process.env.NODE_ENV !== 'production') {
try {
process.loadEnvFile(path.join(rootDir, '.env'));
} catch {
// keine .env vorhanden
}
}
const config = loadConfig();
if (!config.pin) {
console.warn('APP_PIN ist nicht gesetzt – Anmeldung ist nicht möglich.');
}
const store = createProjectStore({ dataDir: config.dataDir, probe });
const queue = createRenderQueue({ store });
const app = createApp({ config, secret: loadSessionSecret(config), store, queue });
const server = http.createServer(app);
if (config.isProduction) {
const distDir = path.join(rootDir, 'dist');
app.use(express.static(distDir));
app.use((req, res, next) => {
if (req.method !== 'GET') return next();
res.sendFile(path.join(distDir, 'index.html'));
});
} else {
// Im Entwicklungsbetrieb liefert Vite das Frontend über denselben Port aus.
const { createServer } = await import('vite');
const vite = await createServer({
root: rootDir,
appType: 'spa',
server: { middlewareMode: true, hmr: { server } },
});
app.use(vite.middlewares);
}
server.listen(config.port, '0.0.0.0', () => {
console.log(`FuerDieCuts läuft auf Port ${config.port}`);
});