mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-04-18 13:57:52 -04:00
20 lines
617 B
TypeScript
20 lines
617 B
TypeScript
import type { NotificationConfig } from "~/schemas/notifications";
|
|
|
|
export const buildPushoverShoutrrrUrl = (config: Extract<NotificationConfig, { type: "pushover" }>) => {
|
|
const shoutrrrUrl = new URL("pushover://placeholder");
|
|
shoutrrrUrl.username = "shoutrrr";
|
|
shoutrrrUrl.password = config.apiToken;
|
|
shoutrrrUrl.hostname = config.userKey;
|
|
shoutrrrUrl.pathname = "/";
|
|
|
|
if (config.devices) {
|
|
shoutrrrUrl.searchParams.append("devices", config.devices);
|
|
}
|
|
|
|
if (config.priority !== undefined) {
|
|
shoutrrrUrl.searchParams.append("priority", config.priority.toString());
|
|
}
|
|
|
|
return shoutrrrUrl.toString();
|
|
};
|