stremio-web/server.js
2025-11-01 17:24:31 +02:00

28 lines
681 B
JavaScript

const express = require('express');
const helmet = require('helmet');
const path = require('path');
const app = express();
const PORT = process.env.PORT || 3000;
const DIST = path.join(__dirname, 'dist-obf');
// Security middleware
app.use(helmet());
app.use(helmet.contentSecurityPolicy({
directives: {
defaultSrc: ["'self'"],
scriptSrc: ["'self'"],
styleSrc: ["'self'", "'unsafe-inline'"],
imgSrc: ["'self'", 'data:'],
connectSrc: ["'self'"],
}
}));
app.use(express.static(DIST));
app.get('*', (req, res) => {
res.sendFile(path.join(DIST, 'index.html'));
});
app.listen(PORT, () => {
console.log(`Server running on http://localhost:${PORT}`);
});