Files
urldb/web/server/api/system-config.get.ts

25 lines
782 B
TypeScript
Raw Normal View History

2025-07-20 11:00:17 +08:00
export default defineEventHandler(async (event) => {
const config = useRuntimeConfig()
try {
// 在服务端调用后端 API
const response = await $fetch('/system/config', {
2025-07-21 21:24:50 +08:00
baseURL: String(process.server ? config.public.apiServer : config.public.apiBase),
2025-07-20 11:00:17 +08:00
headers: {
'Content-Type': 'application/json'
}
})
return response
} catch (error) {
console.error('服务端获取系统配置失败:', error)
// 返回默认配置而不是抛出错误
return {
2025-07-21 00:43:07 +08:00
site_title: '老九网盘资源数据库',
2025-07-20 11:00:17 +08:00
site_description: '一个现代化的资源管理系统',
keywords: '网盘资源,资源管理,数据库',
author: '老九',
2025-07-21 00:43:07 +08:00
copyright: '© 2025 老九网盘资源数据库'
2025-07-20 11:00:17 +08:00
}
}
})