#187 Server v1 NTFY username password

This commit is contained in:
Glax 2024-06-15 21:33:42 +02:00
parent d52ec8d36f
commit 5614729eab

View File

@ -492,12 +492,13 @@ public class Server : GlobalBase
}else if (notificationConnectorType is NotificationConnector.NotificationConnectorType.Ntfy) }else if (notificationConnectorType is NotificationConnector.NotificationConnectorType.Ntfy)
{ {
if (!requestVariables.TryGetValue("ntfyUrl", out string? ntfyUrl) || if (!requestVariables.TryGetValue("ntfyUrl", out string? ntfyUrl) ||
!requestVariables.TryGetValue("ntfyAuth", out string? ntfyAuth)) !requestVariables.TryGetValue("ntfyUser", out string? ntfyUser)||
!requestVariables.TryGetValue("ntfyPass", out string? ntfyPass))
{ {
SendResponse(HttpStatusCode.BadRequest, response); SendResponse(HttpStatusCode.BadRequest, response);
break; break;
} }
AddNotificationConnector(new Ntfy(this, ntfyUrl, ntfyAuth)); AddNotificationConnector(new Ntfy(this, ntfyUrl, ntfyUser, ntfyPass, null));
SendResponse(HttpStatusCode.Accepted, response); SendResponse(HttpStatusCode.Accepted, response);
} }
else else
@ -534,12 +535,13 @@ public class Server : GlobalBase
}else if (notificationConnectorType is NotificationConnector.NotificationConnectorType.Ntfy) }else if (notificationConnectorType is NotificationConnector.NotificationConnectorType.Ntfy)
{ {
if (!requestVariables.TryGetValue("ntfyUrl", out string? ntfyUrl) || if (!requestVariables.TryGetValue("ntfyUrl", out string? ntfyUrl) ||
!requestVariables.TryGetValue("ntfyAuth", out string? ntfyAuth)) !requestVariables.TryGetValue("ntfyUser", out string? ntfyUser)||
!requestVariables.TryGetValue("ntfyPass", out string? ntfyPass))
{ {
SendResponse(HttpStatusCode.BadRequest, response); SendResponse(HttpStatusCode.BadRequest, response);
break; break;
} }
notificationConnector = new Ntfy(this, ntfyUrl, ntfyAuth); notificationConnector = new Ntfy(this, ntfyUrl, ntfyUser, ntfyPass, null);
} }
else else
{ {