From 8a8e7be076d61b118f9c8b8466817a0168b129cf 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 baefe9d0ac..736b40b12f 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 25a26d3bbb..c44c766b3c 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; } });