diff --git a/client/src/app/models/version.model.ts b/client/src/app/models/version.model.ts
new file mode 100644
index 0000000..6e8a5c1
--- /dev/null
+++ b/client/src/app/models/version.model.ts
@@ -0,0 +1,3 @@
+export class Version {
+ public version: string;
+}
diff --git a/client/src/app/navbar/navbar.component.html b/client/src/app/navbar/navbar.component.html
index beee55f..5a92264 100644
--- a/client/src/app/navbar/navbar.component.html
+++ b/client/src/app/navbar/navbar.component.html
@@ -55,7 +55,7 @@
Profile
Logout
- Version 2.0.102
+ Version {{ version }}
diff --git a/client/src/app/navbar/navbar.component.ts b/client/src/app/navbar/navbar.component.ts
index 5efb54c..92e596b 100644
--- a/client/src/app/navbar/navbar.component.ts
+++ b/client/src/app/navbar/navbar.component.ts
@@ -15,6 +15,7 @@ export class NavbarComponent implements OnInit {
public profile: Profile;
public providerLink: string;
+ public version: string;
constructor(
private settingsService: SettingsService,
@@ -50,6 +51,10 @@ export class NavbarComponent implements OnInit {
break;
}
});
+
+ this.settingsService.getVersion().subscribe((result) => {
+ this.version = result.version;
+ });
}
public logout(): void {
diff --git a/client/src/app/settings.service.ts b/client/src/app/settings.service.ts
index e56ac0c..255cc8e 100644
--- a/client/src/app/settings.service.ts
+++ b/client/src/app/settings.service.ts
@@ -4,6 +4,7 @@ import { Observable } from 'rxjs';
import { Profile } from './models/profile.model';
import { Setting } from './models/setting.model';
import { APP_BASE_HREF } from '@angular/common';
+import { Version } from './models/version.model';
@Injectable({
providedIn: 'root',
@@ -26,6 +27,10 @@ export class SettingsService {
return this.http.get(`${this.baseHref}Api/Settings/Profile`);
}
+ public getVersion(): Observable {
+ return this.http.get(`${this.baseHref}Api/Settings/Version`);
+ }
+
public testPath(path: string): Observable {
return this.http.post(`${this.baseHref}Api/Settings/TestPath`, { path });
}
diff --git a/dotnet-publish.ps1 b/dotnet-publish.ps1
index 6b787a4..04e5697 100644
--- a/dotnet-publish.ps1
+++ b/dotnet-publish.ps1
@@ -3,14 +3,10 @@ $utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
$version = (Get-Content "package.json" | ConvertFrom-Json).version
$csProj = "$pwd\server\RdtClient.Web\RdtClient.Web.csproj"
-$navbar = "$pwd\client\src\app\navbar\navbar.component.html";
$newCsProj = (Get-Content $csProj) -replace '.*?<\/Version>', "$version"
[System.IO.File]::WriteAllLines($csProj, $newCsProj, $utf8NoBomEncoding)
-$newNavbar = (Get-Content $navbar) -replace 'Version .*?<', "Version $version<"
-[System.IO.File]::WriteAllLines($navbar, $newNavbar, $utf8NoBomEncoding)
-
Write-Output "Commit and push now, press any key to continue"
[Console]::ReadKey()
diff --git a/server/RdtClient.Web/Controllers/SettingsController.cs b/server/RdtClient.Web/Controllers/SettingsController.cs
index bd7f0e6..f98942a 100644
--- a/server/RdtClient.Web/Controllers/SettingsController.cs
+++ b/server/RdtClient.Web/Controllers/SettingsController.cs
@@ -1,4 +1,5 @@
using System.Diagnostics;
+using System.Reflection;
using Aria2NET;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -44,6 +45,18 @@ public class SettingsController(Settings settings, Torrents torrents) : Controll
var profile = await torrents.GetProfile();
return Ok(profile);
}
+
+ [HttpGet]
+ [Route("Version")]
+ public ActionResult Version()
+ {
+ var version = Assembly.GetExecutingAssembly().GetName().Version!;
+
+ return Ok(new
+ {
+ Version = version
+ });
+ }
[HttpPost]
[Route("TestPath")]