支持旧版bug龙订阅

This commit is contained in:
可达鸭 2025-02-21 19:38:15 +08:00
parent 24f1cb20f1
commit e091c3af2d
2 changed files with 14 additions and 8 deletions

View File

@ -191,7 +191,9 @@ class Ql {
let iniPath = this.env.iniPath || `${abspath}/config` let iniPath = this.env.iniPath || `${abspath}/config`
let crons = await this.getCrons() let crons = await this.getCrons()
let data = {} let data = {}
for (let i of crons.data) { let cronData = crons.data || crons
let label = crons.data ? true : false
for (let i of cronData) {
let command = i.command.match(/task\s*qitoqito_psyduck\/(\w+\.js)/) let command = i.command.match(/task\s*qitoqito_psyduck\/(\w+\.js)/)
if (command) { if (command) {
let script = command[1] let script = command[1]
@ -266,7 +268,10 @@ import {fileURLToPath, pathToFileURL} from 'url';
name: `PsyDuck_${title}`, name: `PsyDuck_${title}`,
schedule: crontab, schedule: crontab,
command: `task qitoqito_psyduck/${filename}.js`, command: `task qitoqito_psyduck/${filename}.js`,
labels: [`PsyDuck`] // labels: label ? [`PsyDuck`] : ''
}
if (label) {
dicts[`${filename}.js`].labels = [`PsyDuck`]
} }
} }
} catch (e) { } catch (e) {
@ -328,7 +333,10 @@ import {fileURLToPath, pathToFileURL} from 'url';
name: `PsyDuck_${psyDuck.profile.title}`, name: `PsyDuck_${psyDuck.profile.title}`,
schedule: crontab, schedule: crontab,
command: `task qitoqito_psyduck/${script}`, command: `task qitoqito_psyduck/${script}`,
labels: [`PsyDuck`] // labels: label ? [`PsyDuck`] : ''
}
if (label) {
dicts[script].labels = [`PsyDuck`]
} }
} }
} }

View File

@ -32,7 +32,7 @@ export class Panel {
async _qlTask() { async _qlTask() {
let envs = await this.getEnvs(`${this.type}_cookie`.toUpperCase()) let envs = await this.getEnvs(`${this.type}_cookie`.toUpperCase())
if (envs.length) { if (envs.length>0) {
for (let i of envs) { for (let i of envs) {
let pin = this.func.userName(i.value) let pin = this.func.userName(i.value)
if (this.dict[pin]) { if (this.dict[pin]) {
@ -62,12 +62,10 @@ export class Panel {
value: this.dict[i].cookie value: this.dict[i].cookie
}) })
} }
if (array.length) { if (array.length>0) {
let data = await this.addEnvs(array) let data = await this.addEnvs(array)
if (data.code == 200) { if (data.code == 200) {
for (let pin in this.dict) { this.func.msg(`新增: ${i} 成功`)
this.func.msg(`新增: ${pin} 成功`)
}
} }
else { else {
console.error('[Error] 添加账号失败'); console.error('[Error] 添加账号失败');