From b6a8947cc19ef1a2d421648456b69dc907e814f0 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 12 Jun 2024 11:30:26 +0200 Subject: [PATCH] Changed ImageUrl --- Models/DeviceModel.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Models/DeviceModel.cs b/Models/DeviceModel.cs index 308b2f8..0646c73 100644 --- a/Models/DeviceModel.cs +++ b/Models/DeviceModel.cs @@ -39,7 +39,10 @@ public async Task SendNotifications(GotifyMessage iGotifyMessage, WebsocketClien { var title = iGotifyMessage.title; var msg = iGotifyMessage.message; - var imageUrl = $"{webSock.Url.ToString()}$$${iGotifyMessage.appid}$$${webSock.Name}"; + + var protocol = webSock.Url.ToString().Contains("ws://") ? "http://" : "https://"; + var gotifyServerUrl = webSock.Url.ToString().Replace("ws://", "").Replace("wss://", "").Replace("\"", "").Split("/stream"); + var imageUrl = gotifyServerUrl.Length > 0 ? $"{protocol}{gotifyServerUrl[0]}$$${iGotifyMessage.appid}$$${webSock.Name}" : ""; var usr = await DatabaseService.GetUser(webSock.Name!);