mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-03-27 05:19:51 +08:00
fix(config): 修复配置密钥验证逻辑
- 更新 checkKey 函数以安全访问嵌套的 manifest.key 属性 - 移除重复的密钥匹配检查逻辑 - 添加对 config.info.manifest.key 的空值检查 - 统一使用 checkKey 函数进行密钥验证 - 简化 initConfig 函数中的密钥处理流程
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user