diff --git a/back/loaders/initTask.ts b/back/loaders/initTask.ts index ede7f526..9e486f64 100644 --- a/back/loaders/initTask.ts +++ b/back/loaders/initTask.ts @@ -2,10 +2,12 @@ import { Container } from 'typedi'; import _ from 'lodash'; import SystemService from '../services/system'; import ScheduleService from '../services/schedule'; +import SubscriptionService from '../services/subscription'; export default async () => { const systemService = Container.get(SystemService); const scheduleService = Container.get(ScheduleService); + const subscriptionService = Container.get(SubscriptionService); // 运行删除日志任务 const data = await systemService.getLogRemoveFrequency(); @@ -20,4 +22,10 @@ export default async () => { runImmediately: true, }); } + + // 运行所有订阅 + const subs = await subscriptionService.list(); + for (const sub of subs) { + await subscriptionService.handleTask(sub); + } }; diff --git a/back/services/sshKey.ts b/back/services/sshKey.ts index 34951644..b707d78e 100644 --- a/back/services/sshKey.ts +++ b/back/services/sshKey.ts @@ -32,7 +32,7 @@ export default class SshKeyService { } private generateSingleSshConfig(alias: string, host: string): string { - return `\nHost ${alias}\n Hostname ${host}\n IdentityFile=${this.sshPath}/${alias}\n StrictHostKeyChecking no`; + return `\nHost ${alias}\n Hostname ${host}\n IdentityFile ${this.sshPath}/${alias}\n StrictHostKeyChecking no`; } private generateSshConfig(configs: string[]) { diff --git a/back/services/subscription.ts b/back/services/subscription.ts index cce105ec..9432c9f3 100644 --- a/back/services/subscription.ts +++ b/back/services/subscription.ts @@ -124,7 +124,7 @@ export default class SubscriptionService { return { url, host }; } - private handleTask(doc: Subscription, needCreate = true, needAddKey = true) { + public handleTask(doc: Subscription, needCreate = true, needAddKey = true) { const { url, host } = this.formatUrl(doc); if (doc.type === 'private-repo' && doc.pull_type === 'ssh-key') { if (needAddKey) { diff --git a/src/pages/crontab/modal.tsx b/src/pages/crontab/modal.tsx index dc65a1ee..0254852e 100644 --- a/src/pages/crontab/modal.tsx +++ b/src/pages/crontab/modal.tsx @@ -75,6 +75,7 @@ const CronModal = ({