mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-02-13 15:01:30 -05:00
* feat: add generic webhook form & refactor each type in its own form * chore: pr feedbacks * fix(email-form): filter out empty emails
23 lines
588 B
TypeScript
23 lines
588 B
TypeScript
import type { NotificationConfig } from "~/schemas/notifications";
|
|
|
|
export const buildPushoverShoutrrrUrl = (config: Extract<NotificationConfig, { type: "pushover" }>) => {
|
|
const params = new URLSearchParams();
|
|
|
|
if (config.devices) {
|
|
params.append("devices", config.devices);
|
|
}
|
|
|
|
if (config.priority !== undefined) {
|
|
params.append("priority", config.priority.toString());
|
|
}
|
|
|
|
const queryString = params.toString();
|
|
let shoutrrrUrl = `pushover://shoutrrr:${config.apiToken}@${config.userKey}/`;
|
|
|
|
if (queryString) {
|
|
shoutrrrUrl += `?${queryString}`;
|
|
}
|
|
|
|
return shoutrrrUrl;
|
|
};
|