Changed to get the version from the API.
This commit is contained in:
parent
53a1407ef8
commit
605868fe70
6 changed files with 27 additions and 5 deletions
3
client/src/app/models/version.model.ts
Normal file
3
client/src/app/models/version.model.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export class Version {
|
||||
public version: string;
|
||||
}
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
<a class="navbar-item" routerLink="profile"> Profile </a>
|
||||
<a class="navbar-item" (click)="logout()"> Logout </a>
|
||||
<hr class="navbar-divider" />
|
||||
<a href="https://github.com/rogerfar/rdt-client" target="_blank" class="navbar-item">Version 2.0.102</a>
|
||||
<a href="https://github.com/rogerfar/rdt-client" target="_blank" class="navbar-item">Version {{ version }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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<Profile>(`${this.baseHref}Api/Settings/Profile`);
|
||||
}
|
||||
|
||||
public getVersion(): Observable<Version> {
|
||||
return this.http.get<Version>(`${this.baseHref}Api/Settings/Version`);
|
||||
}
|
||||
|
||||
public testPath(path: string): Observable<void> {
|
||||
return this.http.post<void>(`${this.baseHref}Api/Settings/TestPath`, { path });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>', "<Version>$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()
|
||||
|
|
|
|||
|
|
@ -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> Version()
|
||||
{
|
||||
var version = Assembly.GetExecutingAssembly().GetName().Version!;
|
||||
|
||||
return Ok(new
|
||||
{
|
||||
Version = version
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("TestPath")]
|
||||
|
|
|
|||
Loading…
Reference in a new issue