From 4d834403e4572e53422d489538b4048980838846 Mon Sep 17 00:00:00 2001 From: yan Date: Sun, 8 Feb 2026 14:13:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(config):=20=E6=B7=BB=E5=8A=A0=E5=AF=86?= =?UTF-8?q?=E9=92=A5=E9=AA=8C=E8=AF=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在配置中新增 key 字段用于存储密钥 - 实现 checkKey 函数用于验证密钥正确性 - 添加密钥错误时的异常处理机制 - 将 checkKey 函数导出供外部使用 - 添加初始化秘境配置的相关注释文档 --- repo/js/AutoPlanDomain/config/config.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/repo/js/AutoPlanDomain/config/config.js b/repo/js/AutoPlanDomain/config/config.js index acc7a1783..417982391 100644 --- a/repo/js/AutoPlanDomain/config/config.js +++ b/repo/js/AutoPlanDomain/config/config.js @@ -4,6 +4,7 @@ const config = { config: '' }, info: { + key: undefined,//密钥 manifest: {}, settings: undefined }, @@ -115,7 +116,19 @@ async function getValueByMultiCheckboxName(name) { log.debug("values={key}", JSON.stringify(values)) return values } +/** + * 检查密钥是否正确 + */ +async function checkKey(key="") { + if (config.info.key !== key.trim()) { + throw new Error("密钥错误"); + } +} +/** + * 初始化秘境配置 + * @returns {Promise} + */ async function initConfig() { /* const domainList = [ { @@ -401,6 +414,7 @@ async function initConfig() { export { config, + checkKey, initSettings, getMultiCheckboxMap, getValueByMultiCheckboxName,