From 0526cfbb2a093ee51c9482ea74e4c6f43374bf73 Mon Sep 17 00:00:00 2001 From: naskya Date: Thu, 21 Sep 2023 17:35:57 +0900 Subject: [PATCH] fix: conditions for checking updates --- packages/client/src/pages/admin/index.vue | 7 ++----- packages/client/src/ui/_common_/navbar.vue | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/client/src/pages/admin/index.vue b/packages/client/src/pages/admin/index.vue index eabf7b439..e10625518 100644 --- a/packages/client/src/pages/admin/index.vue +++ b/packages/client/src/pages/admin/index.vue @@ -121,11 +121,8 @@ os.api("admin/abuse-user-reports", { if (defaultStore.state.showAdminUpdates) { os.api("latest-version").then((res) => { - const cleanRes = parseInt(res?.tag_name.replace(/[^0-9]/g, "")); - const cleanVersion = parseInt(version.replace(/[^0-9]/g, "")); - if (cleanRes > cleanVersion) { - updateAvailable.value = true; - } + if (res == null || res.tag_name == null) return; + updateAvailable.value = !version.startsWith(res.tag_name); }); } diff --git a/packages/client/src/ui/_common_/navbar.vue b/packages/client/src/ui/_common_/navbar.vue index 5124a3dc2..bd362ca1a 100644 --- a/packages/client/src/ui/_common_/navbar.vue +++ b/packages/client/src/ui/_common_/navbar.vue @@ -215,11 +215,8 @@ if ($i?.isAdmin) { if (defaultStore.state.showAdminUpdates) { os.api("latest-version").then((res) => { - const cleanRes = parseInt(res?.tag_name.replace(/[^0-9]/g, "")); - const cleanVersion = parseInt(version.replace(/[^0-9]/g, "")); - if (cleanRes > cleanVersion) { - updateAvailable.value = true; - } + if (res == null || res.tag_name == null) return; + updateAvailable.value = !version.startsWith(res.tag_name); }); }