This commit is contained in:
salvacybersec
2025-11-11 14:12:25 +03:00
parent 7582813f20
commit 1ca2575612

View File

@@ -90,6 +90,27 @@ app.use(express.static(path.join(__dirname, 'public'), {
}
}));
// Serve compiled frontend assets at /assets (Vite output)
app.use('/assets', express.static(path.join(__dirname, 'public', 'dist', 'assets'), {
setHeaders: (res, filePath) => {
res.set('Access-Control-Allow-Origin', '*');
res.set('Access-Control-Allow-Methods', 'GET, OPTIONS');
res.set('Access-Control-Allow-Headers', 'Content-Type, Accept, Origin');
res.set('Access-Control-Allow-Credentials', 'true');
res.set('Content-Security-Policy',
"default-src 'self' data: blob:; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' http: https: ws: wss:; frame-ancestors 'self'; base-uri 'self';"
);
if (filePath.endsWith('.js') || filePath.endsWith('.mjs')) {
res.set('Content-Type', 'application/javascript; charset=utf-8');
} else if (filePath.endsWith('.css')) {
res.set('Content-Type', 'text/css; charset=utf-8');
} else if (filePath.endsWith('.svg')) {
res.set('Content-Type', 'image/svg+xml');
}
}
}));
// Serve landing page at /landing route
app.get('/landing', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'landing.html'));