legacy mode list

This commit is contained in:
b1ek 2023-03-18 17:16:00 +10:00
parent 937828dd91
commit 91227c128a
Signed by: blek
GPG Key ID: 14546221E3595D0C
2 changed files with 20 additions and 9 deletions

View File

@ -19,10 +19,11 @@ router.use(minify({
}));
// TODO: Maybe move all regexes into one file? Idk
const legacy_re = /(Firefox\/[0-5]\d{0,1}|Mozilla\/[0-4]|MSIE \d{1,2}\.\d{1,2}|Windows (NT|9\d)|Linux i686|(198\d|199\d|200\d|201[0-6])|Opera|Dillo|Naenara|Navscape|Lynx[1-5]|QtWeb|Prism|Tencent|i(Phone|Pad|Pod)( OS [1-6]|))/g;
const legacy_re = /(Firefox\/[0-5]\d{0,1}|Mozilla\/[0-4]|MSIE \d{1,2}\.\d{1,2}|Windows (NT|9\d)|Linux i686|(198\d|199\d|200\d|201[0-6])|Dillo|Naenara|Navscape|Netscape|QtWeb|Prism|Tencent|i(Phone|Pad|Pod)( OS [1-5]|))/g;
router.use((req, res, next) => {
req.legacymode = req.headers['user-agent'].match(legacy_re);
// res.send(req.headers['user-agent']);return;
next();
});

View File

@ -65,6 +65,7 @@ html(style='overflow-y:auto' lang='en_US')
h1
a(href='/') blek! Site
hr(class='flag_hr')
if (!req.legacymode)
ul
each route, name in routes
if (route == 'hr')
@ -75,6 +76,15 @@ html(style='overflow-y:auto' lang='en_US')
| > #{name}
else
a(href=route) #{name}
else
p(style='font-size:7pt')
each route, name in routes
if (route != 'hr')
if (current_route == router)
| > #{name}
else
a(href=router)= name
br
hr
p(class='nojs_hide') This site is also available in: