diff --git a/back/data/notify.ts b/back/data/notify.ts index 0bbe9c82..10ee8558 100644 --- a/back/data/notify.ts +++ b/back/data/notify.ts @@ -55,6 +55,8 @@ export class BarkNotification extends NotificationBaseInfo { public barkIcon = 'https://qn.whyour.cn/logo.png'; public barkSound = ''; public barkGroup = 'qinglong'; + public barkLevel = 'active'; + public barkUrl = ''; } export class TelegramBotNotification extends NotificationBaseInfo { diff --git a/back/services/notify.ts b/back/services/notify.ts index 0edaacf2..c4ea67f0 100644 --- a/back/services/notify.ts +++ b/back/services/notify.ts @@ -195,7 +195,7 @@ export default class NotificationService { } private async bark() { - let { barkPush, barkIcon, barkSound, barkGroup } = this.params; + let { barkPush, barkIcon, barkSound, barkGroup, barkLevel, barkUrl } = this.params; if (!barkPush.startsWith('http')) { barkPush = `https://api.day.app/${barkPush}`; } @@ -203,7 +203,7 @@ export default class NotificationService { this.title, )}/${encodeURIComponent( this.content, - )}?icon=${barkIcon}&sound=${barkSound}&group=${barkGroup}`; + )}?icon=${barkIcon}&sound=${barkSound}&group=${barkGroup}&level=${barkLevel}&url=${barkUrl}`; try { const res: any = await got diff --git a/sample/notify.js b/sample/notify.js index 7f759401..19a8ff5e 100644 --- a/sample/notify.js +++ b/sample/notify.js @@ -55,6 +55,10 @@ let BARK_ICON = 'https://qn.whyour.cn/logo.png'; let BARK_SOUND = ''; //BARK app推送消息的分组, 默认为"QingLong" let BARK_GROUP = 'QingLong'; +//BARK app推送消息的时效性, 默认为"active" +let BARK_LEVEL = 'active'; +//BARK app推送消息的跳转URL +let BARK_URL = ''; // =======================================telegram机器人通知设置区域=========================================== //此处填你telegram bot 的Token,telegram机器人通知推送必填项.例如:1077xxx4424:AAFjv0FcqxxxxxxgEMGfi22B4yh15R5uw @@ -211,6 +215,12 @@ if (process.env.BARK_PUSH) { if (process.env.BARK_GROUP) { BARK_GROUP = process.env.BARK_GROUP; } + if (process.env.BARK_LEVEL) { + BARK_LEVEL = process.env.BARK_LEVEL; + } + if (process.env.BARK_URL) { + BARK_URL = process.env.BARK_URL; + } } else { if ( BARK_PUSH && @@ -552,7 +562,7 @@ function BarkNotify(text, desp, params = {}) { const options = { url: `${BARK_PUSH}/${encodeURIComponent(text)}/${encodeURIComponent( desp, - )}?icon=${BARK_ICON}&sound=${BARK_SOUND}&group=${BARK_GROUP}&${querystring.stringify( + )}?icon=${BARK_ICON}&sound=${BARK_SOUND}&group=${BARK_GROUP}&level=${BARK_LEVEL}&url=${BARK_URL}&${querystring.stringify( params, )}`, headers: { diff --git a/sample/notify.py b/sample/notify.py index 27d817bd..1d43b609 100644 --- a/sample/notify.py +++ b/sample/notify.py @@ -40,6 +40,8 @@ push_config = { 'BARK_GROUP': '', # bark 推送分组 'BARK_SOUND': '', # bark 推送声音 'BARK_ICON': '', # bark 推送图标 + 'BARK_LEVEL': '', # bark 推送时效性 + 'BARK_URL': '', # bark 推送跳转URL 'CONSOLE': True, # 控制台输出 @@ -130,6 +132,8 @@ def bark(title: str, content: str) -> None: "BARK_GROUP": "group", "BARK_SOUND": "sound", "BARK_ICON": "icon", + "BARK_LEVEL": "level", + "BARK_URL": "url", } params = "" for pair in filter(