mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-27 14:18:13 +08:00
消息通知Bark增加额外参数:时效性通知、跳转Url
This commit is contained in:
parent
742d0b2135
commit
1f3497eeb4
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue
Block a user