release: prepare v0.1.131
This commit is contained in:
@@ -2,6 +2,7 @@ import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import { adminAPI } from '@/api'
|
||||
import type { CustomMenuItem } from '@/types'
|
||||
import { normalizeCustomMenuItems } from '@/utils/custom-menu'
|
||||
|
||||
export const useAdminSettingsStore = defineStore('adminSettings', () => {
|
||||
const loaded = ref(false)
|
||||
@@ -70,7 +71,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', () => {
|
||||
opsQueryModeDefault.value = settings.ops_query_mode_default || 'auto'
|
||||
writeCachedString('ops_query_mode_default_cached', opsQueryModeDefault.value)
|
||||
|
||||
customMenuItems.value = Array.isArray(settings.custom_menu_items) ? settings.custom_menu_items : []
|
||||
customMenuItems.value = normalizeCustomMenuItems(settings.custom_menu_items)
|
||||
|
||||
paymentEnabled.value = paymentConfigResp.data?.enabled ?? false
|
||||
writeCachedBool('payment_enabled_cached', paymentEnabled.value)
|
||||
|
||||
@@ -7,6 +7,7 @@ import { defineStore } from 'pinia'
|
||||
import { ref, computed } from 'vue'
|
||||
import type { Toast, ToastType, PublicSettings } from '@/types'
|
||||
import { i18n } from '@/i18n'
|
||||
import { normalizeCustomMenuItems } from '@/utils/custom-menu'
|
||||
import {
|
||||
checkUpdates as checkUpdatesAPI,
|
||||
type VersionInfo,
|
||||
@@ -288,16 +289,20 @@ export const useAppStore = defineStore('app', () => {
|
||||
* Apply settings to store state (internal helper to avoid code duplication)
|
||||
*/
|
||||
function applySettings(config: PublicSettings): void {
|
||||
if (typeof window !== 'undefined') {
|
||||
window.__APP_CONFIG__ = { ...config }
|
||||
const normalizedConfig: PublicSettings = {
|
||||
...config,
|
||||
custom_menu_items: normalizeCustomMenuItems(config.custom_menu_items)
|
||||
}
|
||||
cachedPublicSettings.value = config
|
||||
siteName.value = config.site_name || 'Sub2API'
|
||||
siteLogo.value = config.site_logo || ''
|
||||
siteVersion.value = config.version || ''
|
||||
contactInfo.value = config.contact_info || ''
|
||||
apiBaseUrl.value = config.api_base_url || ''
|
||||
docUrl.value = config.doc_url || ''
|
||||
if (typeof window !== 'undefined') {
|
||||
window.__APP_CONFIG__ = { ...normalizedConfig }
|
||||
}
|
||||
cachedPublicSettings.value = normalizedConfig
|
||||
siteName.value = normalizedConfig.site_name || 'Sub2API'
|
||||
siteLogo.value = normalizedConfig.site_logo || ''
|
||||
siteVersion.value = normalizedConfig.version || ''
|
||||
contactInfo.value = normalizedConfig.contact_info || ''
|
||||
apiBaseUrl.value = normalizedConfig.api_base_url || ''
|
||||
docUrl.value = normalizedConfig.doc_url || ''
|
||||
publicSettingsLoaded.value = true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user