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
16 changes: 14 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ jobs:
uses: docker/setup-buildx-action@v3
with:
version: latest
- name: Get version informations
id: infos
run: |
versionGit=${{ steps.get-latest-tag.outputs.tag }}
versionProject=v$(grep '<Version>' 'iGotify Notification Assist.csproj' | cut -d '>' -f2 | cut -d '<' -f1 | xargs)
if [ "$versionGit" != "$versionProject" -a $(git tag | grep -c "$versionProject") -eq 0 ]; then
echo "version=$versionProject" >> $GITHUB_OUTPUT
echo "createtag=true" >> $GITHUB_OUTPUT
exit 0
fi
echo "version=$versionGit" >> $GITHUB_OUTPUT
echo "createtag=false" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
Expand All @@ -36,11 +48,11 @@ jobs:
- name: Run Buildx & Push Multi Arch for dev
if: steps.extract_branch.outputs.branch == 'dev'
run: |
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t ghcr.io/androidseb25/igotify-notification-assist-dev:latest -f ./Dockerfile --provenance=false --sbom=false --output type=image,push=true .
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t ghcr.io/androidseb25/igotify-notification-assist-dev:latest -t ghcr.io/androidseb25/igotify-notification-assist-dev:${{ steps.infos.outputs.version }} -f ./Dockerfile --provenance=false --sbom=false --output type=image,push=true .
- name: Run Buildx & Push Multi Arch for public
if: steps.extract_branch.outputs.branch != 'dev'
run: |
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t ghcr.io/androidseb25/igotify-notification-assist:latest -f ./Dockerfile --provenance=false --sbom=false --output type=image,push=true .
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t ghcr.io/androidseb25/igotify-notification-assist:latest -t ghcr.io/androidseb25/igotify-notification-assist:${{ steps.infos.outputs.version }} -f ./Dockerfile --provenance=false --sbom=false --output type=image,push=true .
- name: Gotify Notification SUCCESS
if: success()
uses: eikendev/gotify-action@master
Expand Down
4 changes: 2 additions & 2 deletions Models/CustomHeaders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ namespace iGotify_Notification_Assist.Models;

public class CustomHeaders
{
public string Key { get; set; }
public string Value { get; set; }
public string? Key { get; set; }
public string? Value { get; set; }
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[![Donate with PayPal](https://raw.githubusercontent.com/androidseb25/iGotify-Notification-Assistent/main/paypal-donate-icon-7_20.png)](https://www.paypal.com/donate/?hosted_button_id=VFSL9ZECRD6D6)
![Stars](https://img.shields.io/github/stars/androidseb25/iGotify-Notification-Assistent?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAEsWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyIKICAgIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIKICAgIHhtbG5zOnhtcD0iaHR0cDov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bkKAeGDc9BMnk0YmmuOtKGoFkLtNebmJj4R3gDsdt6T8W+vnEAAAAASUVORK5CYII=)
[![Crowdin](https://badges.crowdin.net/igotify/localized.svg)](https://crowdin.com/project/igotify)
[![Qodana](https://github.com/androidseb25/iGotify-Notification-Assistent/actions/workflows/code_quality.yml/badge.svg?branch=main)](https://github.com/androidseb25/iGotify-Notification-Assistent/actions/workflows/code_quality.yml)

# iGotify

Expand Down
2 changes: 1 addition & 1 deletion Services/DatabaseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static bool CreateDatebase(string path)

// Create a sample table
const string createTableQuery =
"create table if not exists Users (Uid integer primary key, ClientToken text not null, DeviceToken text not null, Headers text not null);";
"create table if not exists Users (Uid integer primary key, ClientToken text not null, DeviceToken text not null, GotifyUrl text not null, Headers text not null);";
dbConnection.Execute(createTableQuery);

// Perform other database operations as needed
Expand Down
20 changes: 10 additions & 10 deletions Services/GotifySocketService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void Init()
isInit = isDbFileExists;
}

public static async void KillWsThread(string clientToken)
public static void KillWsThread(string clientToken)
{
if (_threadSockets != null)
{
Expand All @@ -47,24 +47,24 @@ public static async void KillWsThread(string clientToken)
try
{
// 1) Signal termination
threadSocket.cts.Cancel();
threadSocket.cts?.Cancel();

// 2) If you have a WebSocket, close it actively so that blocking reads wake up
threadSocket.ws!.Stop();

// 3) Wait for thread end (short timeout so nothing hangs)
if (threadSocket.thread.IsAlive)
if (threadSocket.thread!.IsAlive)
threadSocket.thread.Join(millisecondsTimeout: 500);
}
finally
{
threadSocket.cts.Dispose();
threadSocket.cts?.Dispose();
_threadSockets.Remove(threadSocket);
}
}
}

public static async void KillAllWsThread()
public static void KillAllWsThread()
{
if (_threadSockets != null)
{
Expand All @@ -73,13 +73,13 @@ public static async void KillAllWsThread()
try
{
// 1) Signal termination
threadSocket.cts.Cancel();
threadSocket.cts?.Cancel();

// 2) If you have a WebSocket, close it actively so that blocking reads wake up
threadSocket.ws!.Stop();

// 3) Wait for thread end (short timeout so nothing hangs)
if (threadSocket.thread.IsAlive)
if (threadSocket.thread!.IsAlive)
threadSocket.thread.Join(millisecondsTimeout: 500);
}
catch (Exception e)
Expand All @@ -88,7 +88,7 @@ public static async void KillAllWsThread()
}
finally
{
threadSocket.cts.Dispose();
threadSocket.cts?.Dispose();
}
}

Expand Down Expand Up @@ -136,7 +136,7 @@ public static void StartWsThread(Users user)

private static void StartWsConn(ThreadSocket threadSocket, Users user)
{
while (!threadSocket.cts.IsCancellationRequested)
while (!threadSocket.cts!.IsCancellationRequested)
{
try
{
Expand Down Expand Up @@ -170,7 +170,7 @@ private static void StartWsConn(ThreadSocket threadSocket, Users user)

private static void StartWsConn(ThreadSocket threadSocket, string gotifyServerUrl, string clientToken)
{
while (!threadSocket.cts.IsCancellationRequested)
while (!threadSocket.cts!.IsCancellationRequested)
{
try
{
Expand Down
2 changes: 2 additions & 0 deletions Services/WebSockClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public void Start(string clientToken, bool isRestart = false)
var client = new ClientWebSocket();
foreach (var header in customHeaders)
{
if (header.Key == null || header.Value == null)
continue;
client.Options.SetRequestHeader(header.Key, header.Value);
}

Expand Down
10 changes: 6 additions & 4 deletions iGotify Notification Assist.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<RootNamespace>iGotify_Notification_Assist</RootNamespace>
<AssemblyVersion>1.5.0.0</AssemblyVersion>
<FileVersion>1.5.0.0</FileVersion>
<Version>1.5.0.0</Version>
<AssemblyVersion>1.5.0.1</AssemblyVersion>
<FileVersion>1.5.0.1</FileVersion>
<Version>1.5.0.1</Version>
<LangVersion>default</LangVersion>
</PropertyGroup>

Expand All @@ -19,8 +19,10 @@
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.8" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Scalar.AspNetCore" Version="2.7.0" />
<PackageReference Include="Scalar.AspNetCore" Version="2.7.2" />
<PackageReference Include="secntfy.nuget" Version="1.0.5" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="Websocket.Client" Version="5.2.0" />
</ItemGroup>

Expand Down
Loading