fix: add DisableTLS param if server is http (#563)

Closes #561
This commit is contained in:
Nico 2026-02-23 21:31:53 +01:00 committed by GitHub
parent a0a813ed09
commit 74b21d93d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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;