chore: 文档库全量重新入库(2026-10-20)
build / build-and-scan (push) Canceled after 0s

This commit is contained in:
admin committed 2026-10-20 15:05:55 +08:00
commit 5ec99ce227
668 files changed
+164448

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
const crypto = require('crypto');
const Database = require('/opt/dshs/node_modules/better-sqlite3');
const db = new Database('/var/lib/dshs/dshs.db');
const admin = db.prepare('SELECT id FROM users WHERE role=? LIMIT 1').get('admin');
const token = crypto.randomBytes(32).toString('hex');
const hash = crypto.createHash('sha256').update(token).digest('hex');
db.prepare('INSERT INTO sessions (token_hash,user_id,created_at,expires_at,ip,user_agent) VALUES (?,?,?,?,?,?)').run(hash, admin.id, Date.now(), Date.now() + 600 * 1000, '127.0.0.1', 'poc-curl2');
console.log(token);
db.close();