fix: YAML查看器按钮文案 '清理并编辑' → '编辑',统一简洁命名

This commit is contained in:
attacker committed 2026-06-23 01:23:27 +00:00
1 parent a8b4af4409
commit 4bd9fa629b
14 files changed
+2146 -400

No files matched your search

+18
View File
@@ -97,6 +97,24 @@ export const http = {
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
return resp.json();
},
// 二进制下载(blob)— 用于 tar.gz / 文件下载
download: async (url: string, filename?: string) => {
const tk = useUserStore.getState().token;
const baseUrl = import.meta.env.VITE_API_BASE_URL || '';
const resp = await fetch(`${baseUrl}/api/v1${url}`, {
headers: { Authorization: `Bearer ${tk}` },
});
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
const blob = await resp.blob();
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = filename || resp.headers.get('Content-Disposition')?.match(/filename="?(.+?)"?$/)?.[1] || 'download';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(a.href);
},
};
export default http;