mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-27 14:46:06 +08:00
增加PushMe消息通道
This commit is contained in:
parent
596cacee65
commit
d1fb3f4390
|
@ -15,6 +15,7 @@ export enum NotificationMode {
|
||||||
'iGot' = 'iGot',
|
'iGot' = 'iGot',
|
||||||
'pushPlus' = 'pushPlus',
|
'pushPlus' = 'pushPlus',
|
||||||
'email' = 'email',
|
'email' = 'email',
|
||||||
|
'pushMe' = 'pushMe',
|
||||||
'feishu' = 'feishu',
|
'feishu' = 'feishu',
|
||||||
'webhook' = 'webhook',
|
'webhook' = 'webhook',
|
||||||
}
|
}
|
||||||
|
@ -101,6 +102,10 @@ export class EmailNotification extends NotificationBaseInfo {
|
||||||
public emailPass: string = '';
|
public emailPass: string = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class PushMeNotification extends NotificationBaseInfo {
|
||||||
|
public pushMeKey: string = '';
|
||||||
|
}
|
||||||
|
|
||||||
export class WebhookNotification extends NotificationBaseInfo {
|
export class WebhookNotification extends NotificationBaseInfo {
|
||||||
public webhookHeaders: string = '';
|
public webhookHeaders: string = '';
|
||||||
public webhookBody: string = '';
|
public webhookBody: string = '';
|
||||||
|
@ -131,5 +136,6 @@ export interface NotificationInfo
|
||||||
IGotNotification,
|
IGotNotification,
|
||||||
PushPlusNotification,
|
PushPlusNotification,
|
||||||
EmailNotification,
|
EmailNotification,
|
||||||
|
PushMeNotification,
|
||||||
WebhookNotification,
|
WebhookNotification,
|
||||||
LarkNotification {}
|
LarkNotification {}
|
||||||
|
|
|
@ -28,6 +28,7 @@ export default class NotificationService {
|
||||||
['iGot', this.iGot],
|
['iGot', this.iGot],
|
||||||
['pushPlus', this.pushPlus],
|
['pushPlus', this.pushPlus],
|
||||||
['email', this.email],
|
['email', this.email],
|
||||||
|
['pushMe', this.pushMe],
|
||||||
['webhook', this.webhook],
|
['webhook', this.webhook],
|
||||||
['lark', this.lark],
|
['lark', this.lark],
|
||||||
]);
|
]);
|
||||||
|
@ -561,6 +562,28 @@ export default class NotificationService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async pushMe() {
|
||||||
|
const { pushMeKey } = this.params;
|
||||||
|
try {
|
||||||
|
const res: any = await got
|
||||||
|
.post(`https://push.i-i.me/?push_key=${pushMeKey}`, {
|
||||||
|
...this.gotOption,
|
||||||
|
json: {
|
||||||
|
title: this.title,
|
||||||
|
content: this.content
|
||||||
|
},
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
});
|
||||||
|
if (res === 'success') {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(res);
|
||||||
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
throw new Error(error.response ? error.response.body : error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async webhook() {
|
private async webhook() {
|
||||||
const {
|
const {
|
||||||
webhookUrl,
|
webhookUrl,
|
||||||
|
|
|
@ -96,6 +96,7 @@ export default {
|
||||||
{ value: 'chat', label: '群晖chat' },
|
{ value: 'chat', label: '群晖chat' },
|
||||||
{ value: 'email', label: '邮箱' },
|
{ value: 'email', label: '邮箱' },
|
||||||
{ value: 'lark', label: '飞书机器人' },
|
{ value: 'lark', label: '飞书机器人' },
|
||||||
|
{ value: 'pushMe', label: 'PushMe' },
|
||||||
{ value: 'webhook', label: '自定义通知' },
|
{ value: 'webhook', label: '自定义通知' },
|
||||||
{ value: 'closed', label: '已关闭' },
|
{ value: 'closed', label: '已关闭' },
|
||||||
],
|
],
|
||||||
|
@ -268,6 +269,13 @@ export default {
|
||||||
{ label: 'emailUser', tip: '邮箱地址', required: true },
|
{ label: 'emailUser', tip: '邮箱地址', required: true },
|
||||||
{ label: 'emailPass', tip: '邮箱SMTP授权码', required: true },
|
{ label: 'emailPass', tip: '邮箱SMTP授权码', required: true },
|
||||||
],
|
],
|
||||||
|
pushMe: [
|
||||||
|
{
|
||||||
|
label: 'pushMeKey',
|
||||||
|
tip: 'PushMe的Key,https://push.i-i.me/',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
webhook: [
|
webhook: [
|
||||||
{
|
{
|
||||||
label: 'webhookMethod',
|
label: 'webhookMethod',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user