fix(v1.4.3): 视频编辑/AI视频补鉴权头修复[object Object] + 侧栏「全部图片」改「全部」

- VideoEditModal /api/video/edit、AIVideoModal /api/video/aigenerate+task轮询均裸fetch未带Authorization,后端/api全组401 → 补token头
- 错误信息经errText()解析(对象取message兜底状态码),不再显示[object Object]
- MergeCollage拼图找相似接口同样缺token,一并修复
- Sidebar首项文案「全部图片」→「全部」
- 版本4处升v1.4.3
This commit is contained in:
jinghui committed 2026-11-18 17:37:06 +08:00
1 parent f07cf7a266
commit e17b78cd19
9 files changed
+41 -11

No files matched your search

+13 -2
View File
@@ -6,6 +6,14 @@
import { useState } from 'react';
import { X, Droplets, Eraser, Type, Scissors, Loader2 } from 'lucide-react';
import { imageAPI } from '../api';
import { getToken } from '../api/client';
// 后端错误可能为字符串或 {code,message} 对象,统一取可读文本
const errText = (e, fallback) => {
if (!e) return fallback;
if (typeof e === 'string') return e;
return e.message || JSON.stringify(e);
};
const ACTIONS = [
{ key: 'watermark-add', label: '加水印', icon: Droplets },
@@ -109,11 +117,14 @@ function VideoEditModal({ file, libraryId, onClose, onDone }) {
try {
const res = await fetch('/api/video/edit', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${getToken()}`
},
body: JSON.stringify({ libraryId, path: file.path, action, options, output: outputMode })
});
const data = await res.json().catch(() => ({}));
if (!res.ok || data.error) throw new Error(data.error || `处理失败 (${res.status})`);
if (!res.ok || data.error) throw new Error(errText(data.error, `处理失败 (${res.status})`));
onDone && onDone(data.path);
onClose();
} catch (e) {