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));
|
||||
214
nav-home-encrypted.html
Normal file
214
nav-home-encrypted.html
Normal file
File diff suppressed because one or more lines are too long
@@ -897,7 +897,7 @@
|
||||
id: 'fnos',
|
||||
name: '飞牛NAS',
|
||||
description: 'NAS存储 · 文件管理',
|
||||
url: 'http://100.118.62.18:5000',
|
||||
url: 'http://100.118.62.18:5667',
|
||||
icon: '💾',
|
||||
isCustom: false
|
||||
},
|
||||
|
||||
18
package-lock.json
generated
Normal file
18
package-lock.json
generated
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "ai-community",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"crypto-js": "^4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/crypto-js": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz",
|
||||
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
}
|
||||
5
package.json
Normal file
5
package.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"crypto-js": "^4.2.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user