From 37e3e34441d8bfd0c37e8f210f2e07a43ea7ec82 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Tue, 10 Jan 2023 08:58:24 -0800 Subject: [PATCH] fix: :bug: better update detection logic --- packages/client/src/pages/admin/index.vue | 6 +++--- packages/client/src/ui/_common_/navbar.vue | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/client/src/pages/admin/index.vue b/packages/client/src/pages/admin/index.vue index baefe9d0a..736b40b12 100644 --- a/packages/client/src/pages/admin/index.vue +++ b/packages/client/src/pages/admin/index.vue @@ -72,9 +72,9 @@ os.api('admin/abuse-user-reports', { if (defaultStore.state.showAdminUpdates) { os.api('latest-version').then(res => { - const cleanRes = res?.tag_name.replace(/[^0-9]/g, ''); - const cleanVersion = version.replace(/[^0-9]/g, ''); - if (cleanRes !== cleanVersion) { + const cleanRes = parseInt(res?.tag_name.replace(/[^0-9]/g, '')); + const cleanVersion = parseInt(version.replace(/[^0-9]/g, '')); + if (cleanRes > cleanVersion) { updateAvailable = true; } }); diff --git a/packages/client/src/ui/_common_/navbar.vue b/packages/client/src/ui/_common_/navbar.vue index 25a26d3bb..c44c766b3 100644 --- a/packages/client/src/ui/_common_/navbar.vue +++ b/packages/client/src/ui/_common_/navbar.vue @@ -108,9 +108,9 @@ if ($i?.isAdmin) { if (defaultStore.state.showAdminUpdates) { os.api('latest-version').then(res => { - const cleanRes = res?.tag_name.replace(/[^0-9]/g, ''); - const cleanVersion = version.replace(/[^0-9]/g, ''); - if (cleanRes !== cleanVersion) { + const cleanRes = parseInt(res?.tag_name.replace(/[^0-9]/g, '')); + const cleanVersion = parseInt(version.replace(/[^0-9]/g, '')); + if (cleanRes > cleanVersion) { updateAvailable = true; } });