Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

Versioning Fix & Improvement (#553)

Yovarni Yearwood31ae65b2b7bc
diff --git a/API/API.csproj b/API/API.csproj
index 74bf6fbbc..abafdd08c 100644
--- a/API/API.csproj
+++ b/API/API.csproj
@@ -22,8 +22,6 @@
<Company>kareadita.github.io</Company>
<Copyright>Copyright 2020-$([System.DateTime]::Now.ToString('yyyy')) kavitareader.com (GNU General Public v3)</Copyright>
- <!-- Should be replaced by CI -->
- <AssemblyVersion>0.4.1</AssemblyVersion>
<AssemblyConfiguration>$(Configuration)-dev</AssemblyConfiguration>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
@@ -75,7 +73,7 @@
<ProjectReference Include="..\Kavita.Common\Kavita.Common.csproj" />
</ItemGroup>
-
+
<ItemGroup>
<None Remove="Hangfire-log.db" />
diff --git a/API/Services/Tasks/VersionUpdaterService.cs b/API/Services/Tasks/VersionUpdaterService.cs
index 5b3607ffc..5ce551afe 100644
--- a/API/Services/Tasks/VersionUpdaterService.cs
+++ b/API/Services/Tasks/VersionUpdaterService.cs
@@ -90,12 +90,17 @@ namespace API.Services.Tasks
private UpdateNotificationDto CreateDto(GithubReleaseMetadata update)
{
if (update == null || string.IsNullOrEmpty(update.Tag_Name)) return null;
- var version = update.Tag_Name.Replace("v", string.Empty);
- var updateVersion = new Version(version);
+ var updateVersion = new Version(update.Tag_Name.Replace("v", string.Empty));
+ var currentVersion = BuildInfo.Version.ToString();
+
+ if (updateVersion.Revision == -1)
+ {
+ currentVersion = currentVersion.Substring(0, currentVersion.LastIndexOf("."));
+ }
return new UpdateNotificationDto()
{
- CurrentVersion = version,
+ CurrentVersion = currentVersion,
UpdateVersion = updateVersion.ToString(),
UpdateBody = _markdown.Transform(update.Body.Trim()),
UpdateTitle = update.Name,
diff --git a/UI/Web/src/app/admin/changelog/changelog.component.html b/UI/Web/src/app/admin/changelog/changelog.component.html
index 073b72b95..59d091db3 100644
--- a/UI/Web/src/app/admin/changelog/changelog.component.html
+++ b/UI/Web/src/app/admin/changelog/changelog.component.html
@@ -1,7 +1,12 @@
<ng-container *ngFor="let update of updates; let indx = index;">
<div class="card w-100 mb-2" style="width: 18rem;">
<div class="card-body">
- <h5 class="card-title">{{update.updateTitle}}&nbsp;<span class="badge badge-secondary" *ngIf="update.updateVersion === update.currentVersion">Installed</span></h5>
+ <h5 class="card-title">{{update.updateTitle}}&nbsp;
+ <span class="badge badge-secondary" *ngIf="update.updateVersion <= update.currentVersion; else available">Installed</span>
+ <ng-template #available>
+ <span class="badge badge-secondary">Available</span>
+ </ng-template>
+ </h5>
<pre class="card-text update-body" [innerHtml]="update.updateBody | safeHtml"></pre>
<a *ngIf="!update.isDocker" href="{{update.updateUrl}}" class="btn btn-{{indx === 0 ? 'primary' : 'secondary'}} float-right" target="_blank">Download</a>
</div>
@@ -11,4 +16,4 @@
<div class="spinner-border text-secondary" *ngIf="isLoading" role="status">
<span class="invisible">Loading...</span>
-</div>
\ No newline at end of file
+</div>