mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
增加自定义hook通知
This commit is contained in:
@@ -26,6 +26,7 @@ export default class NotificationService {
|
||||
['iGot', this.iGot],
|
||||
['pushPlus', this.pushPlus],
|
||||
['email', this.email],
|
||||
['webhook', this.webhook],
|
||||
]);
|
||||
|
||||
private timeout = 10000;
|
||||
@@ -383,4 +384,19 @@ export default class NotificationService {
|
||||
|
||||
return !!info.messageId;
|
||||
}
|
||||
|
||||
private async webhook() {
|
||||
const { webhookUrl, webhookBody, webhookHeaders, webhookMethod } =
|
||||
this.params;
|
||||
|
||||
const { statusCode } = await got(webhookUrl, {
|
||||
method: webhookMethod,
|
||||
headers: webhookHeaders,
|
||||
body: webhookBody,
|
||||
timeout: this.timeout,
|
||||
retry: 0,
|
||||
});
|
||||
|
||||
return String(statusCode).includes('20');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user