feat: 添加导航页密码保护功能
- 使用 CryptoJS AES-256 加密页面内容 - 添加密码输入界面,正确密码解锁显示 - 修复 fnos NAS 端口 5000 → 5667 - 添加加密生成脚本 generate-encrypted.js 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
23
generate-encrypted.js
Normal file
23
generate-encrypted.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const CryptoJS = require('crypto-js');
|
||||
const fs = require('fs');
|
||||
|
||||
// 读取原始 HTML
|
||||
const originalHtml = fs.readFileSync('nav-home.html', 'utf8');
|
||||
|
||||
// 使用密码加密
|
||||
const password = 'joylodging';
|
||||
const encrypted = CryptoJS.AES.encrypt(originalHtml, password).toString();
|
||||
|
||||
// 读取模板
|
||||
let template = fs.readFileSync('nav-home-encrypted.html', 'utf8');
|
||||
|
||||
// 替换占位符
|
||||
template = template.replace('const ENCRYPTED_CONTENT = "ENCRYPTED_PLACEHOLDER";',
|
||||
`const ENCRYPTED_CONTENT = "${encrypted}";`);
|
||||
|
||||
// 写入最终文件
|
||||
fs.writeFileSync('nav-home-encrypted.html', template);
|
||||
|
||||
console.log('Encryption complete!');
|
||||
console.log('Encrypted content length:', encrypted.length);
|
||||
console.log('First 100 chars:', encrypted.substring(0, 100));
|
||||
Reference in New Issue
Block a user