refactor(notification): 重构 PushPlusPlus 通知提供商

- 删除 PushPlusPlus 类和相关组件
- 新增 PushPlus 类和组件
- 更新通知提供商列表和相关配置
- 修改国际化文案,将 PushPlusPlus 改为 PushPlus
This commit is contained in:
Teror Fox 2025-03-22 15:31:59 +08:00
parent 657d10970b
commit 82a79418ed
No known key found for this signature in database
GPG key ID: 82B1E8A0C5C0BAEA
9 changed files with 39 additions and 31 deletions

View file

@ -2,22 +2,30 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios");
const { DOWN, UP } = require("../../src/util");
class PushPlusPlus extends NotificationProvider {
name = "PushPlusPlus";
class PushPlus extends NotificationProvider {
name = "PushPlus";
/**
* @inheritdoc
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const url = `https://pushplus.plus/send`;
const url = `https://www.pushplus.plus/send`;
try {
await axios.post(notification.PushPlusPlusToken, {
await axios.post(url, {
"token": notification.pushPlusSendToken,
"title": this.checkStatus(heartbeatJSON, monitorJSON),
"content": msg,
});
"template": "html"
}, { headers: { "Content-Type": "application/json" } }
);
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
console.error("PushPlus Error:", error.response?.data || error.message);
throw new Error("Notification failed: " + error.message);
}
}
@ -39,4 +47,4 @@ class PushPlusPlus extends NotificationProvider {
}
}
module.exports = PushPlusPlus;
module.exports = PushPlus;

View file

@ -39,7 +39,7 @@ const PromoSMS = require("./notification-providers/promosms");
const Pushbullet = require("./notification-providers/pushbullet");
const PushDeer = require("./notification-providers/pushdeer");
const Pushover = require("./notification-providers/pushover");
const PushPlusPlus = require("./notification-providers/pushplusplus");
const PushPlus = require("./notification-providers/pushplus");
const Pushy = require("./notification-providers/pushy");
const RocketChat = require("./notification-providers/rocket-chat");
const SerwerSMS = require("./notification-providers/serwersms");
@ -129,7 +129,7 @@ class Notification {
new Pushbullet(),
new PushDeer(),
new Pushover(),
new PushPlusPlus(),
new PushPlus(),
new Pushy(),
new RocketChat(),
new ServerChan(),

View file

@ -182,7 +182,7 @@ export default {
"SMSManager": "SmsManager (smsmanager.cz)",
"WeCom": "WeCom (企业微信群机器人)",
"ServerChan": "ServerChan (Server酱)",
"PushPlusPlus": "PushPlusPlus(推送加)",
"PushPlusPlus": "PushPlus(推送加)",
"smsc": "SMSC",
"WPush": "WPush(wpush.cn)",
"YZJ": "YZJ (云之家自定义机器人)"

View file

@ -0,0 +1,16 @@
<template>
<div class="mb-3">
<label for="pushPlus-sendkey" class="form-label">{{ $t("SendKey") }}</label>
<HiddenInput id="pushPlus-sendkey" v-model="$parent.notification.pushPlusSendKey" :required="true" autocomplete="new-password"></HiddenInput>
</div>
</template>
<script>
import HiddenInput from "../HiddenInput.vue";
export default {
components: {
HiddenInput,
},
};
</script>

View file

@ -1,16 +0,0 @@
<template>
<div class="mb-3">
<label for="pushplusplus-sendkey" class="form-label">{{ $t("SendKey") }}</label>
<HiddenInput id="pushplusplus-sendkey" v-model="$parent.notification.PushPlusPlusSendKey" :required="true" autocomplete="new-password"></HiddenInput>
</div>
</template>
<script>
import HiddenInput from "../HiddenInput.vue";
export default {
components: {
HiddenInput,
},
};
</script>

View file

@ -39,7 +39,7 @@ import PromoSMS from "./PromoSMS.vue";
import Pushbullet from "./Pushbullet.vue";
import PushDeer from "./PushDeer.vue";
import Pushover from "./Pushover.vue";
import PushPlusPlus from "./PushPlusPlus.vue";
import PushPlus from "./PushPlus.vue";
import Pushy from "./Pushy.vue";
import RocketChat from "./RocketChat.vue";
import ServerChan from "./ServerChan.vue";
@ -117,7 +117,7 @@ const NotificationFormList = {
"PushByTechulus": TechulusPush,
"PushDeer": PushDeer,
"pushover": Pushover,
"PushPlusPlus": PushPlusPlus,
"PushPlusPlus": PushPlus,
"pushy": Pushy,
"rocket.chat": RocketChat,
"serwersms": SerwerSMS,

View file

@ -1101,5 +1101,5 @@
"Separate multiple email addresses with commas": "用逗号分隔多个电子邮件地址",
"rabbitmqHelpText": "要使用此监控项,您需要在 RabbitMQ 设置中启用管理插件。有关更多信息,请参阅 {rabitmq_documentation}。",
"aboutSlackUsername": "更改消息发件人的显示名称。如果您想提及某人,请另行将其包含在友好名称中。",
"PushPlusPlus Token": "PushPlusPlus Token"
"PushPlus Token": "PushPlus Token"
}

View file

@ -1086,5 +1086,5 @@
"cellsyntDestination": "收件人的手機號碼需要使用以 00+國家代碼開頭的國際通用格式,例如若要發給英國的號碼 07920 110 000 需使用 00447920110000 作為收件人手機號碼至多17位數。需發送給多個收件人手機號碼時可使用英文逗號分隔每次請求最 多250 00個收件人手機號碼。",
"threemaRecipient": "收件人",
"threemaRecipientTypeIdentityFormat": "8 位字符",
"PushPlusPlus Token": "PushPlusPlus Token"
"PushPlus Token": "PushPlus Token"
}

View file

@ -1086,5 +1086,5 @@
"Separate multiple email addresses with commas": "用逗號分隔多個電子郵件地址",
"record": "記錄",
"New Group": "新分組",
"PushPlusPlus Token": "PushPlusPlus Token"
"PushPlus Token": "PushPlus Token"
}