Roasted Bean Deploy commited on
Commit Β·
bedd434
1
Parent(s): babe837
π« Block /admin on mobile devices via user-agent check
Browse files
server.js
CHANGED
|
@@ -313,6 +313,10 @@ app.get('/health', (req, res) => res.json({ status: 'ok' }));
|
|
| 313 |
|
| 314 |
// ββ Serve HTML ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 315 |
app.get('/admin', (req, res) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 316 |
res.sendFile(path.join(__dirname, 'public', 'admin.html'));
|
| 317 |
});
|
| 318 |
|
|
|
|
| 313 |
|
| 314 |
// ββ Serve HTML ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 315 |
app.get('/admin', (req, res) => {
|
| 316 |
+
const ua = (req.get('user-agent') || '').toLowerCase();
|
| 317 |
+
if (/mobile|android|iphone|ipod|blackberry|webos/i.test(ua)) {
|
| 318 |
+
return res.status(403).send('Admin is not available on mobile devices.');
|
| 319 |
+
}
|
| 320 |
res.sendFile(path.join(__dirname, 'public', 'admin.html'));
|
| 321 |
});
|
| 322 |
|