fix: 修复S3备份下载URL生成逻辑并导出API基础URL函数

- 导出`getApiBaseUrl`函数以便复用
- 修改`downloadS3BackupUrl`函数,使其使用正确的API基础URL
- 重构S3备份下载处理,使用fetch API并添加授权头,支持blob下载
This commit is contained in:
anghunk
2026-02-12 16:30:15 +08:00
parent 3cfa5f1f6a
commit ca58ae7caf
3 changed files with 35 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
const rawEnvApiBaseUrl = (import.meta.env.VITE_API_BASE_URL || '').trim();
function getApiBaseUrl(): string {
export function getApiBaseUrl(): string {
const stored = (localStorage.getItem('cwd_admin_api_base_url') || '').trim();
const source = stored || rawEnvApiBaseUrl;
const apiBaseUrl = source.replace(/\/+$/, '');