feat: add WPUSH notification provider (#3066)

Add WPUSH as a notification channel for Qinglong panel settings and
sample notify scripts (Python/JS), using POST https://api.wpush.cn/api/v1/send
with success code === 0. Supports optional channel and topic_code.
This commit is contained in:
Alone88
2026-09-13 00:50:56 +08:00
committed by GitHub
parent a94e665054
commit 841740f19a
8 changed files with 168 additions and 3 deletions
+28
View File
@@ -37,6 +37,7 @@ export default class NotificationService {
['wxPusherBot', this.wxPusherBot],
['wxPusherSpt', this.wxPusherSpt],
['openiLink', this.openiLink],
['wpush', this.wpush],
]);
private title = '';
@@ -947,4 +948,31 @@ export default class NotificationService {
throw new Error(error.response ? error.response.body : error);
}
}
private async wpush() {
const { wpushApiKey, wpushChannel, wpushTopicCode } = this.params;
const url = 'https://api.wpush.cn/api/v1/send';
const json: Record<string, string> = {
apikey: `${wpushApiKey}`,
title: `${this.title}`,
content: `${this.content}`,
channel: `${wpushChannel || 'wechat'}`,
};
if (wpushTopicCode) {
json.topic_code = `${wpushTopicCode}`;
}
try {
const res = await httpClient.post(url, {
...this.gotOption,
json,
});
if (res.code === 0) {
return true;
} else {
throw new Error(JSON.stringify(res));
}
} catch (error: any) {
throw new Error(error.response ? error.response.body : error);
}
}
}