Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Models/DeviceModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public async Task SendNotifications(GotifyMessage iGotifyMessage, WebsocketClien
}

var ntfy = new SecNtfy(Environments.secNtfyUrl);
_ = ntfy.SendNotification(usr.DeviceToken, title, msg, iGotifyMessage.priority == 10, imageUrl,
var response = await ntfy.SendNotification(usr.DeviceToken, title, msg, iGotifyMessage.priority == 10, imageUrl,
iGotifyMessage.priority);
Console.WriteLine(response);
}
}
17 changes: 15 additions & 2 deletions Services/GotifySocketService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,28 @@ private void StartConnection(List<Users> userList, string secntfyUrl)
StartConnection(userList, secntfyUrl);
return;
}

isSecNtfyAvailable = SecNtfy.CheckIfUrlReachable(secntfyUrl) ? "yes" : "no";
}
catch
{
Console.WriteLine($"Gotify Server: '{user.GotifyUrl}' is not available try to reconnect in 10s.");
StartDelayedConnection(userList, secntfyUrl);
return;
}

try
{
bool isSecNtfyAvailableBool = SecNtfy.CheckIfUrlReachable(secntfyUrl);
isSecNtfyAvailable = isSecNtfyAvailableBool ? "yes" : "no";

if (!isSecNtfyAvailableBool)
Console.WriteLine($"SecNtfy Server: '{secntfyUrl}' is not available, please check your internet connection!");
}
catch
{
Console.WriteLine($"SecNtfy Server: '{secntfyUrl}' is not available try to reconnect in 10s.");
StartDelayedConnection(userList, secntfyUrl);
return;
}

Console.WriteLine($"Gotify - Url: {user.GotifyUrl}");
Console.WriteLine($"Is Gotify - Url available: {isGotifyAvailable}");
Expand Down
15 changes: 12 additions & 3 deletions Services/WebSockClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,18 @@ public void Start(string clientToken, bool isRestart = false)
Start(wsName, true);
break;
case DisconnectionType.Error:
Console.WriteLine(
$"Webseocket Reconnection failed with Error. Try to reconnect ClientToken: {wsName} in 10s.");
ReconnectDelayed(wsName);
if (type.Exception != null && type.Exception.Message.Contains("401"))
{
Console.WriteLine($"ClientToken: {wsName} is not authorized and returned a 401 Unauthorized error! Skipping reconnection...");
Stop();
}
else
{
Console.WriteLine(
$"Webseocket Reconnection failed with Error. Try to reconnect ClientToken: {wsName} in 10s.");
ReconnectDelayed(wsName);
}

break;
case DisconnectionType.Exit:
break;
Expand Down
7 changes: 3 additions & 4 deletions iGotify Notification Assist.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<RootNamespace>iGotify_Notification_Assist</RootNamespace>
<AssemblyVersion>1.5.1.0</AssemblyVersion>
<FileVersion>1.5.1.0</FileVersion>
<Version>1.5.1.0</Version>
<AssemblyVersion>1.5.1.1</AssemblyVersion>
<FileVersion>1.5.1.1</FileVersion>
<Version>1.5.1.1</Version>
<LangVersion>default</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapper" Version="2.1.66" />
<PackageReference Include="Dapper.Contrib" Version="2.0.78" />
<PackageReference Include="Dapper.Mapper" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
Expand Down
1 change: 1 addition & 0 deletions iGotifyNotificationAssist.sln.DotSettings.user
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASecNtfy_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb26cc17506944dd48fbdaecd1892512f3e00_003F53_003F3be8b167_003FSecNtfy_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASecNtfy_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb26cc17506944dd48fbdaecd1892512f3e00_003F53_003F3be8b167_003FSecNtfy_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASecNtfy_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb26cc17506944dd48fbdaecd1892512f3e00_003Fa2_003F95ee9bb0_003FSecNtfy_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASecNtfy_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb26cc17506944dd48fbdaecd1892512f3e00_003Fa2_003F95ee9bb0_003FSecNtfy_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASqliteDataReader_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Ff74c15be4ebfb9eebdf1d29c607aa58a3dd7cfccafcbf075c7887256d97ccb40_003FSqliteDataReader_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStackFrameIterator_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F821eadf8c89b36691b3def72d04889d8d4cd791563a97558876f873a81a1a085_003FStackFrameIterator_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThread_002ECoreCLR_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fa3aad6bae93c22cddbd7de9e546a684ecd4718317311a5292bf4707a11d0e3_003FThread_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
Expand Down
Loading