From d1ba2c4ae9501cdd6c46955799fc89b6705d67ec Mon Sep 17 00:00:00 2001 From: snaily Date: Tue, 15 Apr 2025 23:56:35 +0800 Subject: [PATCH] =?UTF-8?q?feat(config):=20=E8=AE=A4=E8=AF=81=E4=BB=A4?= =?UTF-8?q?=E7=89=8C=E8=BE=93=E5=85=A5=E6=A1=86=E6=94=AF=E6=8C=81=E4=B8=80?= =?UTF-8?q?=E9=94=AE=E7=94=9F=E6=88=90=E9=9A=8F=E6=9C=BA=E4=BB=A4=E7=89=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增“生成随机令牌”按钮,优化认证令牌输入体验 - 支持自动生成并填充认证令牌,提升交互便捷性 --- app/static/js/config_editor.js | 10 ++++++++++ app/templates/config_editor.html | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/static/js/config_editor.js b/app/static/js/config_editor.js index fca913c..223a6b6 100644 --- a/app/static/js/config_editor.js +++ b/app/static/js/config_editor.js @@ -187,6 +187,16 @@ document.addEventListener('DOMContentLoaded', function() { // 移除了静态生成令牌按钮的事件监听器,现在按钮是动态生成的 + // 认证令牌生成按钮事件绑定 + const generateAuthTokenBtn = document.getElementById('generateAuthTokenBtn'); + const authTokenInput = document.getElementById('AUTH_TOKEN'); + if (generateAuthTokenBtn && authTokenInput) { + generateAuthTokenBtn.addEventListener('click', function() { + const newToken = generateRandomToken(); + authTokenInput.value = newToken; + showNotification('已生成新认证令牌', 'success'); + }); + } }); // <-- DOMContentLoaded 结束括号 // 初始化配置 diff --git a/app/templates/config_editor.html b/app/templates/config_editor.html index 70c2e92..fbd447c 100644 --- a/app/templates/config_editor.html +++ b/app/templates/config_editor.html @@ -136,7 +136,14 @@
- +
+
+ + +
+
用于API认证的令牌