update Tue 07/14/2026 11:38:16.92

This commit is contained in:
2026-07-14 11:38:17 +10:00
commit b2b555ef16
38 changed files with 7348 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
/* Simple token auth for final mode. */
const crypto = require('crypto');
const tokens = new Map(); // token -> expiry
const TTL = 12 * 60 * 60 * 1000;
module.exports = {
login(password) {
const expected = process.env.ADMIN_PASSWORD;
if (!expected || password !== expected) return null;
const t = crypto.randomBytes(24).toString('hex');
tokens.set(t, Date.now() + TTL);
return t;
},
check(t) {
if (!t) return false;
const exp = tokens.get(t);
if (!exp) return false;
if (Date.now() > exp) { tokens.delete(t); return false; }
return true;
},
};