diff --git a/packages/client/src/init.ts b/packages/client/src/init.ts index 53d2062e15..c413fa37e4 100644 --- a/packages/client/src/init.ts +++ b/packages/client/src/init.ts @@ -40,7 +40,6 @@ import { i18n } from "@/i18n"; import { fetchInstance, instance } from "@/instance"; import { isSignedIn, me } from "@/me"; import { alert, api, confirm, popup, post, toast } from "@/os"; -import { compareFirefishVersions } from "@/scripts/compare-versions"; import { deviceKind } from "@/scripts/device-kind"; import { getAccountFromId } from "@/scripts/get-account-from-id"; import { makeHotkey } from "@/scripts/hotkey"; @@ -246,11 +245,7 @@ function checkForSplash() { try { // 変なバージョン文字列来るとcompareVersionsでエラーになるため - if ( - lastVersion != null && - compareFirefishVersions(lastVersion, version) === 1 && - defaultStore.state.showUpdates - ) { + if (lastVersion < version && defaultStore.state.showUpdates) { // ログインしてる場合だけ if (me) { popup( diff --git a/packages/client/src/pages/admin/index.vue b/packages/client/src/pages/admin/index.vue index 53cdad840f..701a63e6c2 100644 --- a/packages/client/src/pages/admin/index.vue +++ b/packages/client/src/pages/admin/index.vue @@ -85,7 +85,6 @@ import { provideMetadataReceiver, } from "@/scripts/page-metadata"; import icon from "@/scripts/icon"; -import { compareFirefishVersions } from "@/scripts/compare-versions"; const isEmpty = (x: string | null) => x == null || x === ""; const el = ref(null); @@ -122,8 +121,7 @@ os.api("admin/abuse-user-reports", { if (defaultStore.state.showAdminUpdates) { os.api("latest-version").then((res) => { - updateAvailable.value = - compareFirefishVersions(version, res?.latest_version) === 1; + updateAvailable.value = version < res?.latest_version; }); } diff --git a/packages/client/src/scripts/compare-versions.ts b/packages/client/src/scripts/compare-versions.ts deleted file mode 100644 index 7b232db838..0000000000 --- a/packages/client/src/scripts/compare-versions.ts +++ /dev/null @@ -1,19 +0,0 @@ -const less = -1; -const same = 0; -const more = 1; - -export const compareFirefishVersions = ( - oldVersion: string, - newVersion: string, -) => { - if (oldVersion === newVersion) return same; - - const o = oldVersion.split("-"); - const n = newVersion.split("-"); - - if (o[0] < n[0]) return more; - if (o[0] === n[0] && o[1] == null && n[1] != null) return more; - if (o[0] === n[0] && o[1] != null && n[1] != null && o[1] < n[1]) return more; - - return less; -}; diff --git a/packages/client/src/ui/_common_/navbar.vue b/packages/client/src/ui/_common_/navbar.vue index e2937528de..0251a38c6a 100644 --- a/packages/client/src/ui/_common_/navbar.vue +++ b/packages/client/src/ui/_common_/navbar.vue @@ -162,7 +162,6 @@ import { i18n } from "@/i18n"; import { instance } from "@/instance"; import { version } from "@/config"; import icon from "@/scripts/icon"; -import { compareFirefishVersions } from "@/scripts/compare-versions"; const isEmpty = (x: string | null) => x == null || x === ""; @@ -212,8 +211,7 @@ if (isAdmin) { if (defaultStore.state.showAdminUpdates) { os.api("latest-version").then((res) => { - updateAvailable.value = - compareFirefishVersions(version, res?.latest_version) === 1; + updateAvailable.value = version < res?.latest_version; }); }