parent
a0a813ed09
commit
74b21d93d6
1 changed files with 12 additions and 1 deletions
|
|
@ -5,11 +5,22 @@ export const buildGotifyShoutrrrUrl = (config: Extract<NotificationConfig, { typ
|
|||
const hostname = url.hostname;
|
||||
const port = url.port ? `:${url.port}` : "";
|
||||
const path = config.path ? `/${config.path.replace(/^\/+|\/+$/g, "")}` : "";
|
||||
const disableTLS = url.protocol === "http:";
|
||||
|
||||
let shoutrrrUrl = `gotify://${hostname}${port}${path}/${config.token}`;
|
||||
|
||||
const params = new URLSearchParams();
|
||||
|
||||
if (disableTLS) {
|
||||
params.set("DisableTLS", "true");
|
||||
}
|
||||
|
||||
if (config.priority !== undefined) {
|
||||
shoutrrrUrl += `?priority=${config.priority}`;
|
||||
params.set("priority", String(config.priority));
|
||||
}
|
||||
|
||||
if (params.toString()) {
|
||||
shoutrrrUrl += `?${params.toString()}`;
|
||||
}
|
||||
|
||||
return shoutrrrUrl;
|
||||
|
|
|
|||
Loading…
Reference in a new issue