feat: add v2.peercortex.org editorial design + Host-based routing

This commit is contained in:
Rene Fichtmueller 2026-03-29 15:22:25 +02:00
parent fae091801c
commit 6391823579
2 changed files with 2975 additions and 2 deletions

2956
public/index-editorial.html Normal file

File diff suppressed because it is too large Load Diff

View File

@ -890,14 +890,31 @@ const server = http.createServer(async (req, res) => {
} }
// Serve static files // Serve static files
// v2.peercortex.org → editorial design
const host = (req.headers.host || '').split(':')[0];
const isV2 = host === 'v2.peercortex.org';
if (reqPath === "/" || reqPath === "/index.html") { if (reqPath === "/" || reqPath === "/index.html") {
const htmlFile = isV2 ? "index-editorial.html" : "index.html";
try { try {
const html = fs.readFileSync("/opt/peercortex-app/public/index.html", "utf8"); const html = fs.readFileSync("/opt/peercortex-app/public/" + htmlFile, "utf8");
res.setHeader("Content-Type", "text/html; charset=utf-8"); res.setHeader("Content-Type", "text/html; charset=utf-8");
return res.end(html); return res.end(html);
} catch (_e) { } catch (_e) {
res.writeHead(500); res.writeHead(500);
return res.end("index.html not found"); return res.end(htmlFile + " not found");
}
}
// Direct access to editorial version
if (reqPath === "/index-editorial.html") {
try {
const html = fs.readFileSync("/opt/peercortex-app/public/index-editorial.html", "utf8");
res.setHeader("Content-Type", "text/html; charset=utf-8");
return res.end(html);
} catch (_e) {
res.writeHead(500);
return res.end("index-editorial.html not found");
} }
} }