Files
kxkm 049547c822 feat: rebrand openDAW → openDIAW.be
Rename all user-visible strings: HTML title, meta tags, about dialogs,
sample origin enum, README, serve-studio log prefix.

Internal package imports (@opendaw/*) preserved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 21:40:21 +01:00

37 lines
1.6 KiB
JavaScript

const https = require("https");
const fs = require("fs");
const path = require("path");
const PORT = 8300;
const DIST = path.join(__dirname, "packages/app/studio/dist");
const options = {
key: fs.readFileSync(path.join(__dirname, "key.pem")),
cert: fs.readFileSync(path.join(__dirname, "cert.pem")),
};
const MIME = {
".html": "text/html", ".js": "application/javascript", ".css": "text/css",
".svg": "image/svg+xml", ".png": "image/png", ".ico": "image/x-icon",
".woff2": "font/woff2", ".woff": "font/woff", ".ttf": "font/ttf",
".wasm": "application/wasm", ".json": "application/json",
".map": "application/json",
".mp3": "audio/mpeg", ".wav": "audio/wav", ".ogg": "audio/ogg",
};
https.createServer(options, (req, res) => {
res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
res.setHeader("Cross-Origin-Resource-Policy", "cross-origin");
res.setHeader("Access-Control-Allow-Origin", "*");
let urlPath = decodeURIComponent(new URL(req.url, "https://localhost").pathname);
let filePath = path.join(DIST, urlPath === "/" ? "index.html" : urlPath);
if (!fs.existsSync(filePath) && !path.extname(filePath)) filePath = path.join(DIST, "index.html");
if (!fs.existsSync(filePath)) { res.writeHead(404); res.end("Not found"); return; }
const ext = path.extname(filePath);
res.setHeader("Content-Type", MIME[ext] || "application/octet-stream");
res.writeHead(200);
fs.createReadStream(filePath).pipe(res);
}).listen(PORT, "0.0.0.0", () => console.log("[openDIAW.be] HTTPS :" + PORT));