mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-25 21:54:16 -08:00
feat: support sound and title in TechulusPush
(#5178)
Some checks are pending
Auto Test / auto-test (18, ARM64) (push) Blocked by required conditions
Auto Test / auto-test (18, macos-latest) (push) Blocked by required conditions
Auto Test / auto-test (18, ubuntu-latest) (push) Blocked by required conditions
Auto Test / auto-test (18, windows-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, ARM64) (push) Blocked by required conditions
Auto Test / auto-test (20, macos-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, ubuntu-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, windows-latest) (push) Blocked by required conditions
Auto Test / armv7-simple-test (18, ARMv7) (push) Waiting to run
Auto Test / armv7-simple-test (20, ARMv7) (push) Waiting to run
Auto Test / check-linters (push) Waiting to run
Auto Test / e2e-test (push) Waiting to run
CodeQL / Analyze (go) (push) Waiting to run
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
Merge Conflict Labeler / Labeling (push) Waiting to run
json-yaml-validate / json-yaml-validate (push) Waiting to run
Some checks are pending
Auto Test / auto-test (18, ARM64) (push) Blocked by required conditions
Auto Test / auto-test (18, macos-latest) (push) Blocked by required conditions
Auto Test / auto-test (18, ubuntu-latest) (push) Blocked by required conditions
Auto Test / auto-test (18, windows-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, ARM64) (push) Blocked by required conditions
Auto Test / auto-test (20, macos-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, ubuntu-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, windows-latest) (push) Blocked by required conditions
Auto Test / armv7-simple-test (18, ARMv7) (push) Waiting to run
Auto Test / armv7-simple-test (20, ARMv7) (push) Waiting to run
Auto Test / check-linters (push) Waiting to run
Auto Test / e2e-test (push) Waiting to run
CodeQL / Analyze (go) (push) Waiting to run
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
Merge Conflict Labeler / Labeling (push) Waiting to run
json-yaml-validate / json-yaml-validate (push) Waiting to run
This commit is contained in:
parent
bbc75b840b
commit
bafca6bd37
|
@ -10,11 +10,22 @@ class TechulusPush extends NotificationProvider {
|
||||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||||
const okMsg = "Sent Successfully.";
|
const okMsg = "Sent Successfully.";
|
||||||
|
|
||||||
try {
|
let data = {
|
||||||
await axios.post(`https://push.techulus.com/api/v1/notify/${notification.pushAPIKey}`, {
|
"title": notification?.pushTitle?.length ? notification.pushTitle : "Uptime-Kuma",
|
||||||
"title": "Uptime-Kuma",
|
|
||||||
"body": msg,
|
"body": msg,
|
||||||
});
|
"timeSensitive": notification.pushTimeSensitive ?? true,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (notification.pushChannel) {
|
||||||
|
data.channel = notification.pushChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notification.pushSound) {
|
||||||
|
data.sound = notification.pushSound;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await axios.post(`https://push.techulus.com/api/v1/notify/${notification.pushAPIKey}`, data);
|
||||||
return okMsg;
|
return okMsg;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.throwGeneralAxiosError(error);
|
this.throwGeneralAxiosError(error);
|
||||||
|
|
|
@ -4,6 +4,53 @@
|
||||||
<HiddenInput id="push-api-key" v-model="$parent.notification.pushAPIKey" :required="true" autocomplete="new-password"></HiddenInput>
|
<HiddenInput id="push-api-key" v-model="$parent.notification.pushAPIKey" :required="true" autocomplete="new-password"></HiddenInput>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="push-api-title" class="form-label">{{ $t("Title") }}</label>
|
||||||
|
<input id="push-api-title" v-model="$parent.notification.pushTitle" type="text" class="form-control">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="push-api-channel" class="form-label">{{ $t("Notification Channel") }}</label>
|
||||||
|
<input id="push-api-channel" v-model="$parent.notification.pushChannel" type="text" class="form-control" patttern="[A-Za-z0-9-]+">
|
||||||
|
<div class="form-text">
|
||||||
|
{{ $t("Alphanumerical string and hyphens only") }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="push-api-sound" class="form-label">{{ $t("Sound") }}</label>
|
||||||
|
<select id="push-api-sound" v-model="$parent.notification.pushSound" class="form-select">
|
||||||
|
<option value="default">{{ $t("Default") }}</option>
|
||||||
|
<option value="arcade">{{ $t("Arcade") }}</option>
|
||||||
|
<option value="correct">{{ $t("Correct") }}</option>
|
||||||
|
<option value="fail">{{ $t("Fail") }}</option>
|
||||||
|
<option value="harp">{{ $t("Harp") }}</option>
|
||||||
|
<option value="reveal">{{ $t("Reveal") }}</option>
|
||||||
|
<option value="bubble">{{ $t("Bubble") }}</option>
|
||||||
|
<option value="doorbell">{{ $t("Doorbell") }}</option>
|
||||||
|
<option value="flute">{{ $t("Flute") }}</option>
|
||||||
|
<option value="money">{{ $t("Money") }}</option>
|
||||||
|
<option value="scifi">{{ $t("Scifi") }}</option>
|
||||||
|
<option value="clear">{{ $t("Clear") }}</option>
|
||||||
|
<option value="elevator">{{ $t("Elevator") }}</option>
|
||||||
|
<option value="guitar">{{ $t("Guitar") }}</option>
|
||||||
|
<option value="pop">{{ $t("Pop") }}</option>
|
||||||
|
</select>
|
||||||
|
<div class="form-text">
|
||||||
|
{{ $t("Custom sound to override default notification sound") }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input v-model="$parent.notification.pushTimeSensitive" class="form-check-input" type="checkbox">
|
||||||
|
<label class="form-check-label">{{ $t("Time Sensitive (iOS Only)") }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-text">
|
||||||
|
{{ $t("Time sensitive notifications will be delivered immediately, even if the device is in do not disturb mode.") }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px;">
|
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px;">
|
||||||
<a href="https://docs.push.techulus.com" target="_blank">https://docs.push.techulus.com</a>
|
<a href="https://docs.push.techulus.com" target="_blank">https://docs.push.techulus.com</a>
|
||||||
</i18n-t>
|
</i18n-t>
|
||||||
|
@ -16,5 +63,19 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
HiddenInput,
|
HiddenInput,
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
if (typeof this.$parent.notification.pushTitle === "undefined") {
|
||||||
|
this.$parent.notification.pushTitle = "Uptime-Kuma";
|
||||||
|
}
|
||||||
|
if (typeof this.$parent.notification.pushChannel === "undefined") {
|
||||||
|
this.$parent.notification.pushChannel = "uptime-kuma";
|
||||||
|
}
|
||||||
|
if (typeof this.$parent.notification.pushSound === "undefined") {
|
||||||
|
this.$parent.notification.pushSound = "default";
|
||||||
|
}
|
||||||
|
if (typeof this.$parent.notification.pushTimeSensitive === "undefined") {
|
||||||
|
this.$parent.notification.pushTimeSensitive = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1027,5 +1027,25 @@
|
||||||
"greater than": "greater than",
|
"greater than": "greater than",
|
||||||
"less than or equal to": "less than or equal to",
|
"less than or equal to": "less than or equal to",
|
||||||
"greater than or equal to": "greater than or equal to",
|
"greater than or equal to": "greater than or equal to",
|
||||||
"record": "record"
|
"record": "record",
|
||||||
|
"Notification Channel": "Notification Channel",
|
||||||
|
"Sound": "Sound",
|
||||||
|
"Alphanumerical string and hyphens only": "Alphanumerical string and hyphens only",
|
||||||
|
"Arcade": "Arcade",
|
||||||
|
"Correct": "Correct",
|
||||||
|
"Fail":"Fail",
|
||||||
|
"Harp":"Harp",
|
||||||
|
"Reveal":"Reveal",
|
||||||
|
"Bubble":"Bubble",
|
||||||
|
"Doorbell":"Doorbell",
|
||||||
|
"Flute":"Flute",
|
||||||
|
"Money":"Money",
|
||||||
|
"Scifi":"Scifi",
|
||||||
|
"Clear":"Clear",
|
||||||
|
"Elevator":"Elevator",
|
||||||
|
"Guitar":"Guitar",
|
||||||
|
"Pop":"Pop",
|
||||||
|
"Custom sound to override default notification sound": "Custom sound to override default notification sound",
|
||||||
|
"Time Sensitive (iOS Only)": "Time Sensitive (iOS Only)",
|
||||||
|
"Time sensitive notifications will be delivered immediately, even if the device is in do not disturb mode.": "Time sensitive notifications will be delivered immediately, even if the device is in do not disturb mode."
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue