fix(config): 修复配置密钥验证逻辑

- 更新 checkKey 函数以安全访问嵌套的 manifest.key 属性
- 移除重复的密钥匹配检查逻辑
- 添加对 config.info.manifest.key 的空值检查
- 统一使用 checkKey 函数进行密钥验证
- 简化 initConfig 函数中的密钥处理流程
This commit is contained in:
yan
2026-02-10 02:38:08 +08:00
parent 32b60ee9f2
commit 9a56fbab73

View File

@@ -151,7 +151,7 @@ async function getValueByMultiCheckboxName(name) {
* 检查密钥是否正确
*/
async function checkKey(key = "") {
if (config.info.key !== key.trim()) {
if (config?.info?.manifest?.key !== key?.trim()) {
throw new Error("密钥错误");
}
}
@@ -162,11 +162,7 @@ async function checkKey(key = "") {
*/
async function initConfig() {
config.info.key = settings.key || config.info.key
if (config.info?.key) {
if (config.info.key !== config.info.manifest?.key) {
throw new Error("密钥不匹配!")
}
}
await checkKey(config.info.key)
//流程->返回主页 打开地图 返回主页
const physical = await ocrPhysical(true, true)
config.user.physical.current = physical.current