feat(build): bundle frontend with vite and matrix-js-sdk, fix HOST in server.js
Build and Publish / Metadata (push) Successful in 1s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 22s

This commit is contained in:
mats committed 2026-09-22 10:29:03 +02:00
1 parent 5ce3b46bab
commit b6cc9f3465
8 files changed
+3421 -9

No files matched your search

+5 -3
View File
@@ -10,7 +10,9 @@ const { WebSocketServer } = require('ws');
const PORT = Number(process.env.PORT || 8080);
const HOST = process.env.HOST || '0.0.0.0';
const PUBLIC_DIR = path.join(__dirname, 'public');
const STATIC_DIR = fs.existsSync(path.join(__dirname, 'dist'))
? path.join(__dirname, 'dist')
: path.join(__dirname, 'public');
// ---------------------------------------------------------------------------
// ICE configuration: env-driven, full JSON override wins.
@@ -74,8 +76,8 @@ const MIME = {
function serveStatic(req, res) {
const urlPath = decodeURIComponent(new URL(req.url, 'http://x').pathname);
let rel = urlPath === '/' ? '/index.html' : urlPath;
const file = path.normalize(path.join(PUBLIC_DIR, rel));
if (!file.startsWith(PUBLIC_DIR)) {
const file = path.normalize(path.join(STATIC_DIR, rel));
if (!file.startsWith(STATIC_DIR)) {
res.writeHead(403).end('forbidden');
return;
}