Compare commits
No commits in common. "6e905308ea7cf4a152325266f924e8f56ff1fb95" and "668dccdb719bc03e5ab5576cecd0372e86e340dc" have entirely different histories.
6e905308ea
...
668dccdb71
|
@ -6,7 +6,7 @@ const base = require('js-base64');
|
|||
const cookie_parse = require('cookie-parser');
|
||||
const cookie_encrypt = require('cookie-encrypter');
|
||||
|
||||
const APP_KEY = Buffer.from(process.env.APP_KEY, 'base64').toString('ascii');
|
||||
const APP_KEY = Buffer.from(process.env.APP_KEY, 'base64');
|
||||
|
||||
router.use(cookie_parse(APP_KEY));
|
||||
router.use(cookie_encrypt(APP_KEY));
|
||||
|
|
|
@ -2,7 +2,6 @@ const express = require('express');
|
|||
const router = express.Router();
|
||||
|
||||
const minify = require('express-minify');
|
||||
const browser = require('express-browser-detect');
|
||||
|
||||
// custom
|
||||
router.use(require('./template'));
|
||||
|
@ -18,6 +17,14 @@ router.use(minify({
|
|||
css_match: /.css^/,
|
||||
js_match: /.js^/
|
||||
}));
|
||||
router.use(browser);
|
||||
|
||||
// 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])|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();
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -23,7 +23,6 @@
|
|||
"easy-crc": "^1.1.0",
|
||||
"express": "^4.18.2",
|
||||
"express-async-handler": "^1.2.0",
|
||||
"express-browser-detect": "^1.0.0",
|
||||
"express-minify": "^1.0.0",
|
||||
"express-session": "^1.17.3",
|
||||
"glob": "^8.1.0",
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import random
|
||||
import secrets
|
||||
import base64
|
||||
|
||||
if (not os.path.exists('.env')):
|
||||
print('No .env file found. Please create a dotenv to proceed.');
|
||||
exit(-1);
|
||||
|
||||
secrets = random.SystemRandom()
|
||||
|
||||
key_bytes = ''.join(secrets.choices(list('abcdef1234567890'), k=32)).encode('ascii');
|
||||
key_bytes = secrets.token_bytes(32);
|
||||
dotenv_text = '';
|
||||
|
||||
with open('.env', 'tr', encoding='utf-8') as f:
|
||||
|
|
Loading…
Reference in New Issue