mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-03-29 05:39:51 +08:00
feat(bgi_tools): 添加配置推送开关和API配置功能
- 在配置文件中添加open对象用于控制推送功能 - 实现bgi_tools相关API配置的动态设置 - 将uid配置移动到合适位置避免重复执行 - 修复pullJsonConfig调用时的参数类型转换问题 - 在设置界面添加推送开关复选框和推送API输入框 - 集成OCR获取UID功能到配置初始化流程
This commit is contained in:
@@ -11,7 +11,8 @@ const config = {
|
||||
api: {
|
||||
httpPullJsonConfig: undefined,
|
||||
httpPushAllJsonConfig: undefined,
|
||||
}
|
||||
},
|
||||
open: {open_push: false}
|
||||
},
|
||||
info: {
|
||||
key: undefined,//密钥
|
||||
@@ -408,6 +409,11 @@ async function initConfig() {
|
||||
throw new Error("密钥不匹配!")
|
||||
}
|
||||
}
|
||||
config.user.uid = await ocrUid()
|
||||
config.bgi_tools.api.httpPullJsonConfig=settings.bgi_tools_http_pull_json_config
|
||||
config.bgi_tools.api.httpPushAllJsonConfig=settings.bgi_tools_http_push_all_json_config
|
||||
config.bgi_tools.open.open_push=settings.bgi_tools_open_push
|
||||
|
||||
const domainList = JSON.parse(file.readTextSync(config.path.domain)) || [{
|
||||
name: undefined,
|
||||
type: undefined,
|
||||
@@ -459,7 +465,6 @@ async function initConfig() {
|
||||
})
|
||||
loads.sort((a, b) => a.order - b.order)
|
||||
config.domain.loads = loads
|
||||
config.user.uid = await ocrUid()
|
||||
}
|
||||
|
||||
export {
|
||||
|
||||
@@ -119,7 +119,7 @@ async function loadMode(Load, autoFightOrderSet, domainConfig) {
|
||||
break
|
||||
case LoadType.bgi_tools:
|
||||
// 通过bgi_tools方式加载配置
|
||||
const uidConfigListBgiTools = await pullJsonConfig(config.user.uid)||[]
|
||||
const uidConfigListBgiTools = await pullJsonConfig(config.user.uid+'')||[]
|
||||
if (uidConfigListBgiTools?.length > 0) {
|
||||
// 如果配置列表不为空,遍历并添加到结果集合中
|
||||
uidConfigListBgiTools.forEach(item => {
|
||||
|
||||
@@ -28,6 +28,11 @@
|
||||
"type": "input-text",
|
||||
"label": "bgi_tools拉取配置api(去看文档)"
|
||||
},
|
||||
{
|
||||
"name": "bgi_tools_open_push",
|
||||
"type": "checkbox",
|
||||
"label": "开始推送bgi_tools配置"
|
||||
},
|
||||
{
|
||||
"name": "bgi_tools_http_push_all_json_config",
|
||||
"type": "input-text",
|
||||
|
||||
Reference in New Issue
Block a user