mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-12-04 02:23:59 +00:00
fix: isolate server-side donation credentials and rotate auth defaults (#320)
This commit is contained in:
19 files changed
+190
-125
No files matched your search
@@ -214,7 +214,7 @@
|
||||
|
||||
<div class="info-box">
|
||||
<p><strong>加密算法:</strong> AES/ECB/PKCS5Padding</p>
|
||||
<p><strong>默认密钥:</strong> nfd_auth_key2026 (16位)</p>
|
||||
<p><strong>密钥:</strong> 自建服务配置的认证密钥(仅在可信本地环境使用)</p>
|
||||
<p><strong>编码流程:</strong> JSON对象 → AES加密 → Base64编码 → URL编码</p>
|
||||
</div>
|
||||
|
||||
@@ -268,8 +268,8 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="encryptKey">加密密钥 (可选,默认: nfd_auth_key2026)</label>
|
||||
<input type="text" id="encryptKey" placeholder="留空使用默认密钥" value="nfd_auth_key2026">
|
||||
<label for="encryptKey">加密密钥(必填)</label>
|
||||
<input type="password" id="encryptKey" autocomplete="off" placeholder="本地服务配置的密钥">
|
||||
</div>
|
||||
|
||||
<div class="button-group">
|
||||
@@ -368,7 +368,10 @@
|
||||
|
||||
// AES 加密
|
||||
try {
|
||||
const encryptKey = document.getElementById('encryptKey').value.trim() || 'nfd_auth_key2026';
|
||||
const encryptKey = document.getElementById('encryptKey').value;
|
||||
if (![16, 24, 32].includes(new TextEncoder().encode(encryptKey).length)) {
|
||||
throw new Error('密钥必须为 16、24 或 32 个 UTF-8 字节');
|
||||
}
|
||||
const encrypted = encryptAuthParam(JSON.stringify(authParam), encryptKey);
|
||||
|
||||
document.getElementById('encryptedResult').textContent = encrypted;
|
||||
@@ -389,11 +392,6 @@
|
||||
|
||||
// AES 加密函数
|
||||
function encryptAuthParam(jsonString, key) {
|
||||
// 确保密钥是16位
|
||||
if (key.length !== 16) {
|
||||
throw new Error('密钥必须是16位字符');
|
||||
}
|
||||
|
||||
// AES 加密 (ECB 模式, PKCS5Padding)
|
||||
const encrypted = CryptoJS.AES.encrypt(
|
||||
jsonString,
|
||||
|
||||
Reference in new issue
Block a user