incognitolm commited on
Commit ·
93ac4a9
1
Parent(s): de8743f
Update index.js
Browse files- server/index.js +17 -1
server/index.js
CHANGED
|
@@ -93,7 +93,23 @@ fetchLatestSHA();
|
|
| 93 |
setInterval(fetchLatestSHA,AUTO_REFRESH_INTERVAL);
|
| 94 |
|
| 95 |
// --- Admin endpoints ---
|
| 96 |
-
app.get('/admin.html',(req,res)=>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
app.get('/admin/verify',verifyLimiter,(req,res)=>{
|
| 99 |
const token = req.query.token;
|
|
|
|
| 93 |
setInterval(fetchLatestSHA,AUTO_REFRESH_INTERVAL);
|
| 94 |
|
| 95 |
// --- Admin endpoints ---
|
| 96 |
+
app.get('/admin.html', async (req, res) => {
|
| 97 |
+
if (!latestSHA) return res.status(500).send('Server not ready');
|
| 98 |
+
|
| 99 |
+
const url = `${CDN_BASE}@${latestSHA}/admin.html`;
|
| 100 |
+
|
| 101 |
+
try {
|
| 102 |
+
const response = await fetch(url);
|
| 103 |
+
if (!response.ok) return res.status(404).send('File not found');
|
| 104 |
+
|
| 105 |
+
const text = await response.text();
|
| 106 |
+
res.setHeader('Content-Type', 'text/html');
|
| 107 |
+
res.send(text);
|
| 108 |
+
} catch (e) {
|
| 109 |
+
console.error('Error fetching admin.html from CDN:', e);
|
| 110 |
+
res.status(500).send('Server error');
|
| 111 |
+
}
|
| 112 |
+
});
|
| 113 |
|
| 114 |
app.get('/admin/verify',verifyLimiter,(req,res)=>{
|
| 115 |
const token = req.query.token;
|