Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support sound and title in TechulusPush #5178

Merged
merged 5 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions server/notification-providers/techulus-push.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,22 @@ class TechulusPush extends NotificationProvider {
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";

let data = {
"title": notification?.pushTitle?.length ? notification.pushTitle : "Uptime-Kuma",
CommanderStorm marked this conversation as resolved.
Show resolved Hide resolved
"body": msg,
"timeSensitive": true,
CommanderStorm marked this conversation as resolved.
Show resolved Hide resolved
};

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}`, {
"title": "Uptime-Kuma",
"body": msg,
});
await axios.post(`https://push.techulus.com/api/v1/notify/${notification.pushAPIKey}`, data);
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
Expand Down
33 changes: 32 additions & 1 deletion src/components/notifications/TechulusPush.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,40 @@
<template>
<div class="mb-3">
<label for="push-api-key" class="form-label">{{ $t("API Key") }}</label>
<label for="push-api-key" class="form-label">{{ $t("API Key (required)") }}</label>
CommanderStorm marked this conversation as resolved.
Show resolved Hide resolved
<HiddenInput id="push-api-key" v-model="$parent.notification.pushAPIKey" :required="true" autocomplete="new-password"></HiddenInput>
</div>

<div class="mb-3">
CommanderStorm marked this conversation as resolved.
Show resolved Hide resolved
<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("Channel") }}</label>
CommanderStorm marked this conversation as resolved.
Show resolved Hide resolved
<input id="push-api-channel" v-model="$parent.notification.pushChannel" type="text" class="form-control">
CommanderStorm marked this conversation as resolved.
Show resolved Hide resolved
</div>

<div class="mb-3">
<label for="push-api-sound" class="form-label">{{ $t("Sound") }}</label>
arjunkomath marked this conversation as resolved.
Show resolved Hide resolved
<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>

<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>
</i18n-t>
Expand Down
Loading