CertZipDL

This commit is contained in:
2026-09-16 10:05:57 +10:00
parent b1a793302d
commit 922ce99d25
13 changed files with 577 additions and 63 deletions
+20
View File
@@ -133,6 +133,26 @@ function startRedirectServer() {
http
.createServer((req, res) => {
// A zip, because browsers block bare certificate downloads.
if (req.url === '/ca.zip') {
try {
const zip = tls.caBundleZip();
if (!zip) {
res.writeHead(404, { 'Content-Type': 'text/plain' });
return res.end('No certificate authority has been generated yet.');
}
res.writeHead(200, {
'Content-Type': 'application/zip',
'Content-Disposition': 'attachment; filename="visitor-signin-certificates.zip"',
'Content-Length': zip.length,
});
return res.end(zip);
} catch (err) {
res.writeHead(500, { 'Content-Type': 'text/plain' });
return res.end(`Could not build the bundle: ${err.message}`);
}
}
// DER for Apple tooling, PEM for everything else.
if (req.url === '/ca.cer' || req.url === '/ca.der') {
try {