fix: add DisableTLS param if server is http

Closes #561
This commit is contained in:
Nicolas Meienberger 2026-02-23 20:39:28 +01:00
parent a0a813ed09
commit 727999b4c8

View file

@ -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;