const fs = require("fs"); // Changelog page: renders CHANGELOG.md as HTML function handleChangelog(req, res) { try { const md = fs.readFileSync('/opt/peercortex-app/CHANGELOG.md', 'utf8'); const lines = md.split('\n'); let html = ''; for (const line of lines) { if (line.startsWith('## ')) { html += `
· ${m}
`; } else if (line.startsWith('- ')) { html += `· ${line.slice(2)}
`; } else if (line.startsWith('# ')) { html += `PeerCortex · v0.5.0 · Open Source · MIT
`; res.setHeader('Content-Type', 'text/html; charset=utf-8'); res.setHeader('Cache-Control', 'no-store'); res.writeHead(200); return res.end(page); } catch(e) { res.writeHead(500); return res.end('Changelog not available'); } } module.exports = { handleChangelog };