mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
增加PushMe消息通道 (#2018),修复系统设置保存通知
This commit is contained in:
@@ -28,6 +28,7 @@ export default class NotificationService {
|
||||
['iGot', this.iGot],
|
||||
['pushPlus', this.pushPlus],
|
||||
['email', this.email],
|
||||
['pushMe', this.pushMe],
|
||||
['webhook', this.webhook],
|
||||
['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.body === 'success') {
|
||||
return true;
|
||||
} else {
|
||||
throw new Error(res.body);
|
||||
}
|
||||
} catch (error: any) {
|
||||
throw new Error(error.response ? error.response.body : error);
|
||||
}
|
||||
}
|
||||
|
||||
private async webhook() {
|
||||
const {
|
||||
webhookUrl,
|
||||
|
||||
Reference in New Issue
Block a user