parent
a0a813ed09
commit
727999b4c8
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 hostname = url.hostname;
|
||||||
const port = url.port ? `:${url.port}` : "";
|
const port = url.port ? `:${url.port}` : "";
|
||||||
const path = config.path ? `/${config.path.replace(/^\/+|\/+$/g, "")}` : "";
|
const path = config.path ? `/${config.path.replace(/^\/+|\/+$/g, "")}` : "";
|
||||||
|
const disableTLS = url.protocol === "http:";
|
||||||
|
|
||||||
let shoutrrrUrl = `gotify://${hostname}${port}${path}/${config.token}`;
|
let shoutrrrUrl = `gotify://${hostname}${port}${path}/${config.token}`;
|
||||||
|
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
|
||||||
|
if (disableTLS) {
|
||||||
|
params.set("DisableTLS", "true");
|
||||||
|
}
|
||||||
|
|
||||||
if (config.priority !== undefined) {
|
if (config.priority !== undefined) {
|
||||||
shoutrrrUrl += `?priority=${config.priority}`;
|
params.set("priority", String(config.priority));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.toString()) {
|
||||||
|
shoutrrrUrl += `?${params.toString()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return shoutrrrUrl;
|
return shoutrrrUrl;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue