Merge pull request #3467 from ngc7331/pushdeer

[reopened] feat: allow the user to configure PushDeer Server URL
This commit is contained in:
Louis Lam 2023-07-31 17:57:21 +08:00 committed by GitHub
commit 9dd652733e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View file

@ -8,7 +8,9 @@ class PushDeer extends NotificationProvider {
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; let okMsg = "Sent Successfully.";
let pushdeerlink = "https://api2.pushdeer.com/message/push"; let endpoint = "/message/push";
let serverUrl = notification.pushdeerServer || "https://api2.pushdeer.com";
let pushdeerlink = `${serverUrl.trim().replace(/\/*$/, "")}${endpoint}`;
let valid = msg != null && monitorJSON != null && heartbeatJSON != null; let valid = msg != null && monitorJSON != null && heartbeatJSON != null;

View file

@ -1,4 +1,9 @@
<template> <template>
<div class="mb-3">
<label for="pushdeer-server" class="form-label">{{ $t("PushDeer Server URL") }}</label>
<input id="pushdeer-server" v-model="$parent.notification.pushdeerServer" type="text" class="form-control" placeholder="https://api2.pushdeer.com">
<div class="form-text">{{ $t("pushDeerServerDescription") }}</div>
</div>
<div class="mb-3"> <div class="mb-3">
<label for="pushdeer-key" class="form-label">{{ $t("PushDeer Key") }}</label> <label for="pushdeer-key" class="form-label">{{ $t("PushDeer Key") }}</label>
<HiddenInput id="pushdeer-key" v-model="$parent.notification.pushdeerKey" :required="true" autocomplete="new-password" placeholder="PDUxxxx"></HiddenInput> <HiddenInput id="pushdeer-key" v-model="$parent.notification.pushdeerKey" :required="true" autocomplete="new-password" placeholder="PDUxxxx"></HiddenInput>

View file

@ -700,6 +700,8 @@
"onebotPrivateMessage": "Private", "onebotPrivateMessage": "Private",
"onebotUserOrGroupId": "Group/User ID", "onebotUserOrGroupId": "Group/User ID",
"onebotSafetyTips": "For safety, must set access token", "onebotSafetyTips": "For safety, must set access token",
"PushDeer Server": "PushDeer Server",
"pushDeerServerDescription": "Leave blank to use the official server",
"PushDeer Key": "PushDeer Key", "PushDeer Key": "PushDeer Key",
"wayToGetClickSendSMSToken": "You can get API Username and API Key from {0} .", "wayToGetClickSendSMSToken": "You can get API Username and API Key from {0} .",
"Custom Monitor Type": "Custom Monitor Type", "Custom Monitor Type": "Custom Monitor Type",