mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
fix(web): normalize about version display
Prevent the About page from rendering duplicate `v` prefixes when the server already returns tags like `v0.7.0`. Reuse the same normalization for release checks so the displayed version and update comparison stay consistent.
This commit is contained in:
@@ -14,10 +14,10 @@
|
||||
</p>
|
||||
<div class="flex items-center gap-2 mt-0.5">
|
||||
<Badge
|
||||
v-if="serverVersion"
|
||||
v-if="normalizedServerVersion"
|
||||
variant="secondary"
|
||||
>
|
||||
{{ $t('settings.versionTag', { version: serverVersion }) }}
|
||||
{{ $t('settings.versionTag', { version: normalizedServerVersion }) }}
|
||||
</Badge>
|
||||
<Badge
|
||||
v-if="commitHash"
|
||||
@@ -147,6 +147,8 @@ const { t } = useI18n()
|
||||
|
||||
const capabilitiesStore = useCapabilitiesStore()
|
||||
const { serverVersion, commitHash } = storeToRefs(capabilitiesStore)
|
||||
const normalizeVersion = (version?: string | null) => (version ?? '').replace(/^v/i, '')
|
||||
const normalizedServerVersion = computed(() => normalizeVersion(serverVersion.value))
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
const isDark = computed(() => settingsStore.theme === 'dark')
|
||||
@@ -168,8 +170,8 @@ async function checkForUpdates() {
|
||||
const data = await res.json()
|
||||
|
||||
const tagName: string = data.tag_name ?? ''
|
||||
const latestVersion = tagName.replace(/^v/, '')
|
||||
const currentVersion = (serverVersion.value ?? '').replace(/^v/, '')
|
||||
const latestVersion = normalizeVersion(tagName)
|
||||
const currentVersion = normalizeVersion(serverVersion.value)
|
||||
|
||||
checkResult.value = {
|
||||
isUpToDate: latestVersion === currentVersion,
|
||||
|
||||
Reference in New Issue
Block a user