This commit is contained in:
oneao committed 2025-09-30 17:26:30 +08:00
1 parent 92fbbf7c6d
commit b03e2c1e69
149 files changed
+925 -14628

No files matched your search

@@ -0,0 +1,28 @@
export function getServerBaseUrl(): string {
const origin = window.location.origin
const publicBase = import.meta.env.VITE_APP_PUBLIC_BASE || '/'
// 拼接时去掉 publicBase 开头和结尾的斜杠(只保留中间路径)
const cleanBase = publicBase.replace(/^\/+|\/+$/g, '')
return cleanBase ? `${origin}/${cleanBase}` : origin
}
export async function getDbConfigs(): Promise<Record<string, any> | null> {
const serverBaseUrl = getServerBaseUrl()
try {
const response = await fetch(`${serverBaseUrl}/static/db.json`)
if (!response.ok) {
console.error('Failed to fetch db.json:', response.status)
return null
}
const data: Record<string, any> = await response.json()
return data
}
catch (error) {
console.error('Error fetching db.json:', error)
return null
}
}