feat: show admin dashboard version

This commit is contained in:
Lan
2026-06-03 12:21:44 +08:00
parent 04a0e68675
commit 58c930123a
7 changed files with 89 additions and 21 deletions
+15 -1
View File
@@ -1,6 +1,6 @@
import { defineStore } from 'pinia'
import { computed, ref } from 'vue'
import type { ConfigState } from '@/types'
import type { ConfigState, PublicConfigMeta } from '@/types'
import {
DEFAULT_PUBLIC_CONFIG,
readNotifyKey,
@@ -16,8 +16,10 @@ export const useConfigStore = defineStore('config', () => {
...DEFAULT_PUBLIC_CONFIG,
...toPublicConfig(readStoredConfig<Partial<ConfigState>>())
})
const publicMeta = ref<PublicConfigMeta>({})
const uploadSizeLimit = computed(() => config.value.uploadSize)
const appVersion = computed(() => publicMeta.value.version || '')
const updateConfig = (nextConfig: Partial<ConfigState>) => {
config.value = {
@@ -45,6 +47,15 @@ export const useConfigStore = defineStore('config', () => {
return `${notifyTitle}: ${notifyContent}`
}
const applyPublicMeta = (nextMeta: PublicConfigMeta | undefined) => {
if (!nextMeta) return
publicMeta.value = {
...publicMeta.value,
...nextMeta
}
}
const reloadStoredConfig = () => {
config.value = {
...DEFAULT_PUBLIC_CONFIG,
@@ -53,8 +64,11 @@ export const useConfigStore = defineStore('config', () => {
}
return {
appVersion,
config,
publicMeta,
uploadSizeLimit,
applyPublicMeta,
applyRemoteConfig,
updateConfig,
reloadStoredConfig