From 8217a53fcf16780ba95a6b68993538e0829211a2 Mon Sep 17 00:00:00 2001 From: Ukenn Date: Tue, 8 Feb 2022 00:14:19 +0800 Subject: [PATCH] =?UTF-8?q?bark=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=8E=A8=E9=80=81=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/data/notify.ts | 1 + back/services/notify.ts | 4 ++-- src/utils/config.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/back/data/notify.ts b/back/data/notify.ts index a28e0721..aa4887b9 100644 --- a/back/data/notify.ts +++ b/back/data/notify.ts @@ -34,6 +34,7 @@ export class ServerChanNotification extends NotificationBaseInfo { export class BarkNotification extends NotificationBaseInfo { public barkPush = ''; + public barkIcon = 'https://lf9-survey.bytetos.com/obj/web.business.image/202201205d0d7b5e576ee603497ab6f3'; public barkSound = ''; public barkGroup = 'qinglong'; } diff --git a/back/services/notify.ts b/back/services/notify.ts index 84119d7c..1a12abd0 100644 --- a/back/services/notify.ts +++ b/back/services/notify.ts @@ -119,7 +119,7 @@ export default class NotificationService { } private async bark() { - let { barkPush, barkSound, barkGroup } = this.params; + let { barkPush, barkIcon, barkSound, barkGroup } = this.params; if (!barkPush.startsWith('http') && !barkPush.startsWith('https')) { barkPush = `https://api.day.app/${barkPush}`; } @@ -127,7 +127,7 @@ export default class NotificationService { this.title, )}/${encodeURIComponent( this.content, - )}?sound=${barkSound}&group=${barkGroup}`; + )}?icon=${barkIcon}?sound=${barkSound}&group=${barkGroup}`; const res: any = await got .get(url, { timeout: this.timeout, diff --git a/src/utils/config.ts b/src/utils/config.ts index 0b21d04f..3a5d4a04 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -119,6 +119,7 @@ export default { tip: 'Bark的信息IP/设备码,例如:https://api.day.app/XXXXXXXX', required: true, }, + { label: 'barkIcon', tip: 'BARK推送图标,自定义推送图标 (需iOS15或以上才能显示)' }, { label: 'barkSound', tip: 'BARK推送铃声,铃声列表去APP查看复制填写' }, { label: 'barkGroup', tip: 'BARK推送消息的分组, 默认为qinglong' }, ],