From c319f2531cbc5cf614ac88c80b29512d2c8e1bdb Mon Sep 17 00:00:00 2001 From: zhaojisen <1301338853@qq.com> Date: Wed, 24 Dec 2025 11:06:00 +0800 Subject: [PATCH] Fixed: Fix the issue of version matching --- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- ui/components/SideBar/profile.vue | 36 ++++++++++++++++++++++++++++++- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 4c5d9cf..1d89b9e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jumpserver-client", "type": "module", - "version": "4.1.0", + "version": "4.1.1", "private": true, "packageManager": "pnpm@10.25.0", "description": "JumpServer client tool", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 8ec424f..d0ed2ab 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -4,7 +4,7 @@ version = 4 [[package]] name = "JumpServerClient" -version = "4.1.0" +version = "4.1.1" dependencies = [ "anyhow", "axum", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 4e3e781..db2955b 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "JumpServerClient" -version = "4.1.0" +version = "4.1.1" description = "JumpServer client tool" authors = [ "JumpServer" ] license = "MIT" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 0f6172b..4bea07a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -36,7 +36,7 @@ "devUrl": "http://localhost:3000" }, "productName": "JumpServerClient", - "version": "4.1.0", + "version": "4.1.1", "identifier": "com.jumpserver.client", "plugins": { "deep-link": { diff --git a/ui/components/SideBar/profile.vue b/ui/components/SideBar/profile.vue index 366114a..6864de4 100644 --- a/ui/components/SideBar/profile.vue +++ b/ui/components/SideBar/profile.vue @@ -228,6 +228,32 @@ function normalizeVersionMessage(raw: string) { } } +function normalizeMajorMinor(version: string) { + const cleaned = (version || "").trim(); + if (!cleaned) return ""; + + const parts = cleaned.split("."); + const major = (parts[0] || "").replace(/\D/g, ""); + if (!major) return ""; + + const minor = (parts[1] || "").replace(/\D/g, ""); + return minor ? `${major}.${minor}` : major; +} + +function normalizeMajorMinorList(versions: string[]) { + const normalized: string[] = []; + const seen = new Set(); + + for (const version of versions) { + const value = normalizeMajorMinor(version); + if (!value || seen.has(value)) continue; + seen.add(value); + normalized.push(value); + } + + return normalized; +} + const emitVersionAlertAndCloseModal = (payload: VersionAlertPayload) => { openModal.value = false; loginBtn.value = false; @@ -247,7 +273,15 @@ const checkVersionBeforeOAuth = async (site: string) => { return false; } - if (appVersion && versions.length > 0 && !versions.includes(appVersion)) { + const normalizedAppVersion = normalizeMajorMinor(appVersion); + const normalizedVersions = normalizeMajorMinorList(versions); + + if (normalizedAppVersion && normalizedVersions.length > 0) { + if (!normalizedVersions.includes(normalizedAppVersion)) { + emitVersionAlertAndCloseModal({ type: "noMatch", version: versions[versions.length - 1] }); + return false; + } + } else if (appVersion && versions.length > 0 && !versions.includes(appVersion)) { emitVersionAlertAndCloseModal({ type: "noMatch", version: versions[versions.length - 1] }); return false; }