From b2167ae5e43e4f60245e72b941571c3d9c41dd87 Mon Sep 17 00:00:00 2001 From: whyour Date: Tue, 7 Mar 2023 22:20:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/loaders/initTask.ts | 1 + back/services/notify.ts | 8 ++++---- back/services/subscription.ts | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/back/loaders/initTask.ts b/back/loaders/initTask.ts index fbbea692..17da8ad9 100644 --- a/back/loaders/initTask.ts +++ b/back/loaders/initTask.ts @@ -41,6 +41,7 @@ export default async () => { } // 运行所有订阅 + await subscriptionService.setSshConfig(); const subs = await subscriptionService.list(); for (const sub of subs) { subscriptionService.handleTask(sub, !sub.is_disabled, !sub.is_disabled); diff --git a/back/services/notify.ts b/back/services/notify.ts index 8cbe5fd1..0b639194 100644 --- a/back/services/notify.ts +++ b/back/services/notify.ts @@ -484,11 +484,11 @@ export default class NotificationService { return { formatUrl: url - .replaceAll('$title', encodeURIComponent(this.title)) - .replaceAll('$content', encodeURIComponent(this.content)), + ?.replaceAll('$title', encodeURIComponent(this.title)) + ?.replaceAll('$content', encodeURIComponent(this.content)), formatBody: body - .replaceAll('$title', this.title) - .replaceAll('$content', this.content), + ?.replaceAll('$title', this.title) + ?.replaceAll('$content', this.content), }; } } diff --git a/back/services/subscription.ts b/back/services/subscription.ts index e72a718a..421fbeda 100644 --- a/back/services/subscription.ts +++ b/back/services/subscription.ts @@ -104,7 +104,7 @@ export default class SubscriptionService { } } - private async setSshConfig() { + public async setSshConfig() { const docs = await SubscriptionModel.findAll(); this.sshKeyService.setSshConfig(docs); }