Add PWA support and miner race

This commit is contained in:
Dorian
2026-05-06 19:21:06 +01:00
parent 360b1ebe66
commit 0c8e26f597
21 changed files with 573 additions and 16 deletions

View File

@@ -28,6 +28,8 @@ export function buildApp() {
"img-src": ["'self'", "data:"],
"connect-src": ["'self'", "wss://relay.primal.net"],
"font-src": ["'self'", "data:"],
"manifest-src": ["'self'"],
"worker-src": ["'self'"],
"frame-ancestors": ["'none'"],
"upgrade-insecure-requests": null,
},
@@ -67,10 +69,21 @@ export function buildApp() {
if (staticDir && fs.existsSync(staticDir)) {
logger.info({ staticDir }, "serving web assets");
app.use(express.static(staticDir, { index: false, maxAge: "1h" }));
app.use(
express.static(staticDir, {
index: false,
maxAge: "1h",
setHeaders: (res, filePath) => {
if (filePath.endsWith("sw.js") || filePath.endsWith("manifest.webmanifest")) {
res.setHeader("Cache-Control", "no-cache");
}
},
}),
);
app.get(/.*/, (_req, res, next) => {
const indexFile = path.join(staticDir, "index.html");
if (!fs.existsSync(indexFile)) return next();
res.setHeader("Cache-Control", "no-cache");
res.sendFile(indexFile);
});
} else {