feat: add v2.peercortex.org editorial design + Host-based routing
This commit is contained in:
parent
fae091801c
commit
6391823579
2956
public/index-editorial.html
Normal file
2956
public/index-editorial.html
Normal file
File diff suppressed because it is too large
Load Diff
21
server.js
21
server.js
@ -890,14 +890,31 @@ const server = http.createServer(async (req, res) => {
|
||||
}
|
||||
|
||||
// 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") {
|
||||
const htmlFile = isV2 ? "index-editorial.html" : "index.html";
|
||||
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");
|
||||
return res.end(html);
|
||||
} catch (_e) {
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user