Skip to content

Commit 1bc246f

Browse files
authored
Merge pull request #179 from androidseb25/dev
Update 1.5.0.1
2 parents d1d433a + dd0871b commit 1bc246f

File tree

6 files changed

+35
-19
lines changed

6 files changed

+35
-19
lines changed

.github/workflows/publish.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ jobs:
2727
uses: docker/setup-buildx-action@v3
2828
with:
2929
version: latest
30+
- name: Get version informations
31+
id: infos
32+
run: |
33+
versionGit=${{ steps.get-latest-tag.outputs.tag }}
34+
versionProject=v$(grep '<Version>' 'iGotify Notification Assist.csproj' | cut -d '>' -f2 | cut -d '<' -f1 | xargs)
35+
if [ "$versionGit" != "$versionProject" -a $(git tag | grep -c "$versionProject") -eq 0 ]; then
36+
echo "version=$versionProject" >> $GITHUB_OUTPUT
37+
echo "createtag=true" >> $GITHUB_OUTPUT
38+
exit 0
39+
fi
40+
echo "version=$versionGit" >> $GITHUB_OUTPUT
41+
echo "createtag=false" >> $GITHUB_OUTPUT
3042
- name: Login to GitHub Container Registry
3143
uses: docker/login-action@v1
3244
with:
@@ -36,11 +48,11 @@ jobs:
3648
- name: Run Buildx & Push Multi Arch for dev
3749
if: steps.extract_branch.outputs.branch == 'dev'
3850
run: |
39-
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 .
51+
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 .
4052
- name: Run Buildx & Push Multi Arch for public
4153
if: steps.extract_branch.outputs.branch != 'dev'
4254
run: |
43-
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 .
55+
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 .
4456
- name: Gotify Notification SUCCESS
4557
if: success()
4658
uses: eikendev/gotify-action@master

Models/CustomHeaders.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ namespace iGotify_Notification_Assist.Models;
22

33
public class CustomHeaders
44
{
5-
public string Key { get; set; }
6-
public string Value { get; set; }
5+
public string? Key { get; set; }
6+
public string? Value { get; set; }
77
}

Services/DatabaseService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static bool CreateDatebase(string path)
2525

2626
// Create a sample table
2727
const string createTableQuery =
28-
"create table if not exists Users (Uid integer primary key, ClientToken text not null, DeviceToken text not null, Headers text not null);";
28+
"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);";
2929
dbConnection.Execute(createTableQuery);
3030

3131
// Perform other database operations as needed

Services/GotifySocketService.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void Init()
3737
isInit = isDbFileExists;
3838
}
3939

40-
public static async void KillWsThread(string clientToken)
40+
public static void KillWsThread(string clientToken)
4141
{
4242
if (_threadSockets != null)
4343
{
@@ -47,24 +47,24 @@ public static async void KillWsThread(string clientToken)
4747
try
4848
{
4949
// 1) Signal termination
50-
threadSocket.cts.Cancel();
50+
threadSocket.cts?.Cancel();
5151

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

5555
// 3) Wait for thread end (short timeout so nothing hangs)
56-
if (threadSocket.thread.IsAlive)
56+
if (threadSocket.thread!.IsAlive)
5757
threadSocket.thread.Join(millisecondsTimeout: 500);
5858
}
5959
finally
6060
{
61-
threadSocket.cts.Dispose();
61+
threadSocket.cts?.Dispose();
6262
_threadSockets.Remove(threadSocket);
6363
}
6464
}
6565
}
6666

67-
public static async void KillAllWsThread()
67+
public static void KillAllWsThread()
6868
{
6969
if (_threadSockets != null)
7070
{
@@ -73,13 +73,13 @@ public static async void KillAllWsThread()
7373
try
7474
{
7575
// 1) Signal termination
76-
threadSocket.cts.Cancel();
76+
threadSocket.cts?.Cancel();
7777

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

8181
// 3) Wait for thread end (short timeout so nothing hangs)
82-
if (threadSocket.thread.IsAlive)
82+
if (threadSocket.thread!.IsAlive)
8383
threadSocket.thread.Join(millisecondsTimeout: 500);
8484
}
8585
catch (Exception e)
@@ -88,7 +88,7 @@ public static async void KillAllWsThread()
8888
}
8989
finally
9090
{
91-
threadSocket.cts.Dispose();
91+
threadSocket.cts?.Dispose();
9292
}
9393
}
9494

@@ -136,7 +136,7 @@ public static void StartWsThread(Users user)
136136

137137
private static void StartWsConn(ThreadSocket threadSocket, Users user)
138138
{
139-
while (!threadSocket.cts.IsCancellationRequested)
139+
while (!threadSocket.cts!.IsCancellationRequested)
140140
{
141141
try
142142
{
@@ -170,7 +170,7 @@ private static void StartWsConn(ThreadSocket threadSocket, Users user)
170170

171171
private static void StartWsConn(ThreadSocket threadSocket, string gotifyServerUrl, string clientToken)
172172
{
173-
while (!threadSocket.cts.IsCancellationRequested)
173+
while (!threadSocket.cts!.IsCancellationRequested)
174174
{
175175
try
176176
{

Services/WebSockClient.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public void Start(string clientToken, bool isRestart = false)
3030
var client = new ClientWebSocket();
3131
foreach (var header in customHeaders)
3232
{
33+
if (header.Key == null || header.Value == null)
34+
continue;
3335
client.Options.SetRequestHeader(header.Key, header.Value);
3436
}
3537

iGotify Notification Assist.csproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
<InvariantGlobalization>true</InvariantGlobalization>
88
<RootNamespace>iGotify_Notification_Assist</RootNamespace>
9-
<AssemblyVersion>1.5.0.0</AssemblyVersion>
10-
<FileVersion>1.5.0.0</FileVersion>
11-
<Version>1.5.0.0</Version>
9+
<AssemblyVersion>1.5.0.1</AssemblyVersion>
10+
<FileVersion>1.5.0.1</FileVersion>
11+
<Version>1.5.0.1</Version>
1212
<LangVersion>default</LangVersion>
1313
</PropertyGroup>
1414

@@ -19,8 +19,10 @@
1919
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.8" />
2020
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.8" />
2121
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
22-
<PackageReference Include="Scalar.AspNetCore" Version="2.7.0" />
22+
<PackageReference Include="Scalar.AspNetCore" Version="2.7.2" />
2323
<PackageReference Include="secntfy.nuget" Version="1.0.5" />
24+
<PackageReference Include="System.Net.Http" Version="4.3.4" />
25+
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
2426
<PackageReference Include="Websocket.Client" Version="5.2.0" />
2527
</ItemGroup>
2628

0 commit comments

Comments
 (0)