From 31ae65b2b7bce3de2a9db279222963f8c0b12def Mon Sep 17 00:00:00 2001 From: Yovarni Yearwood Date: Sat, 4 Sep 2021 15:04:13 -0400 Subject: [PATCH] Versioning Fix & Improvement (#553) * Fix UpdaterService versioning (#544) * Add "Available" to newer, non-installed updates * Add if...else logic to Available/Installed badge * Change substring to account for bigger versions (#544) * Cache BuildInfo.version into local variable (#544) * Cache BuildInfo.Version.ToString() into local variable (#544) Co-authored-by: Yovarni Yearwood --- API/API.csproj | 4 +--- API/Services/Tasks/VersionUpdaterService.cs | 11 ++++++++--- .../src/app/admin/changelog/changelog.component.html | 9 +++++++-- 3 files changed, 16 insertions(+), 8 deletions(-) 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 @@ kareadita.github.io Copyright 2020-$([System.DateTime]::Now.ToString('yyyy')) kavitareader.com (GNU General Public v3) - - 0.4.1 $(Configuration)-dev false @@ -75,7 +73,7 @@ - + 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 @@
-
{{update.updateTitle}} Installed
+
{{update.updateTitle}}  + Installed + + Available + +

           Download
         
@@ -11,4 +16,4 @@
-
\ No newline at end of file +