2 Commits
Author SHA1 Message Date
jinghui e17b78cd19 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
2026-11-18 17:37:06 +08:00
jinghui f07cf7a266 docs: docker run 示例补齐我的文档目录挂载(与compose三挂载对齐) 2026-11-18 16:25:04 +08:00
10 changed files with 42 additions and 11 deletions

No files matched your search

+6
View File
@@ -1,5 +1,11 @@
# 更新日志
## 2026-11-18 → v1.4.3
**优化**:侧栏首项文案「全部图片」改为「全部」(`Sidebar.jsx`)。
**修复:视频编辑/AI 生成视频点「开始处理」报 `[object Object]`、功能完全不可用**——根因是两处裸 `fetch` 调用没带登录态:`VideoEditModal.jsx`(`/api/video/edit`)与 `AIVideoModal.jsx`(`/api/video/aigenerate`、`/api/video/task/:id`)均未附 `Authorization` 头,而后端 `/api` 全组走认证中间件,一律 401 拒绝;前端又把 `{code, message}` 错误对象直接 `new Error()`,对象转字符串就成了 `[object Object]`。修复:三处请求补 `Authorization: `Bearer ${getToken()}`(与图片编辑器等既有调用一致),错误信息统一经 `errText()` 解析(对象取 `message`,再兜底状态码),不再出现 `[object Object]`。另修复 `MergeCollage.jsx` 拼图找相似接口同样的缺 token 问题(历史遗留)。
## 2026-11-18 → v1.4.2
**修复:添加素材库报 `Path does not exist`(视频目录)**——根因是该目录未挂载进容器(容器里看不到宿主机目录)。`docker-compose.yml` 已补挂载 `/vol2/1000/HD2/发布到平台的图片和视频`,README 使用注意新增排查方法(volumes 加一行同路径挂载后 `docker compose up -d`)。后端报错同步中文化:`素材库路径不存在: <路径>(如为宿主机目录,需先在 docker-compose.yml 的 volumes 里挂载进容器再重试)`(创建与更新两处)。
+1
View File
@@ -143,6 +143,7 @@ docker run -d --name flypic --restart unless-stopped \
-e NODE_ENV=production \
-v /vol3/1000/HD3/docker/flypic/config:/root/.flypic \
-v /vol2/1000/HD2/壁纸:/vol2/1000/HD2/壁纸 \
-v "/vol2/1000/HD2/我的文档:/vol2/1000/HD2/我的文档" \
-v "/vol2/1000/HD2/发布到平台的图片和视频:/vol2/1000/HD2/发布到平台的图片和视频" \
jpccr.ccs.tencentyun.com/jinghui/flypic:latest
```
+1 -1
View File
@@ -16,7 +16,7 @@ const { getSettings } = require('./settings');
const HUB_URL = (process.env.HUB_URL || 'https://auth.88531.cn/api').replace(/\/+$/, '');
const HUB_PROJECT_ID = process.env.HUB_PROJECT_ID || '';
const HUB_API_KEY = process.env.HUB_API_KEY || '';
const SITE_VERSION = process.env.SITE_VERSION || '1.4.2';
const SITE_VERSION = process.env.SITE_VERSION || '1.4.3';
const TIMEOUT_MS = 8000;
const state = {
+1 -1
View File
@@ -28,7 +28,7 @@ services:
- HUB_API_KEY=${HUB_API_KEY:-}
- NEWAPI_KEY=${NEWAPI_KEY:-}
# 当前站点版本(与 frontend/package.json、CHANGELOG 保持一致,界面版本徽标来源)
- SITE_VERSION=1.4.2
- SITE_VERSION=1.4.3
# 让容器经 host.docker.internal 访问宿主机的 AI 侧车
extra_hosts:
- "host.docker.internal:host-gateway"
+16 -3
View File
@@ -6,6 +6,14 @@
import { useEffect, useRef, useState } from 'react';
import { X, Loader2, Film, CheckCircle2, AlertCircle, KeyRound } 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 VOICES = [
{ key: 'zh-CN-XiaoxiaoNeural', label: '晓晓(女声·自然)' },
@@ -51,7 +59,9 @@ function AIVideoModal({ libraryId, images, onClose, onDone }) {
if (!taskId) return;
timerRef.current = setInterval(async () => {
try {
const res = await fetch(`/api/video/task/${taskId}`);
const res = await fetch(`/api/video/task/${taskId}`, {
headers: { Authorization: `Bearer ${getToken()}` }
});
if (!res.ok) return;
const data = await res.json();
setTask(data);
@@ -74,7 +84,10 @@ function AIVideoModal({ libraryId, images, onClose, onDone }) {
try {
const res = await fetch('/api/video/aigenerate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${getToken()}`
},
body: JSON.stringify({
libraryId,
images: list.map((img) => ({ path: img.path })),
@@ -86,7 +99,7 @@ function AIVideoModal({ libraryId, images, onClose, onDone }) {
})
});
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})`));
setTaskId(data.taskId);
} catch (e) {
setError(e.message || '启动失败');
+1 -1
View File
@@ -38,7 +38,7 @@ function Header() {
// 授权系统 hub:版本 / 公告 / 在线人数
const hub = useHub();
const announcements = hub.announcements || [];
const appVersion = hub.version ? `v${String(hub.version).replace(/^v/, '')}` : 'v1.4.2';
const appVersion = hub.version ? `v${String(hub.version).replace(/^v/, '')}` : 'v1.4.3';
// 从全局 store 获取筛选状态
const selectedFormats = filters.formats || [];
+1 -1
View File
@@ -221,7 +221,7 @@ export default function MergeCollage({ image, libraryId, onMerge, setStatus, set
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `*** ${getToken()}`
Authorization: `Bearer ${getToken()}`
},
body: JSON.stringify({
libraryId,
+1 -1
View File
@@ -2,7 +2,7 @@ import { useState, useEffect } from 'react';
import { X, ScanText, Info, Save, FlaskConical, Github, ExternalLink, Wand2 } from 'lucide-react';
import { settingsAPI } from '../api';
const APP_VERSION = 'v1.4.2';
const APP_VERSION = 'v1.4.3';
const REPO_URL = 'https://gitea.88531.cn/jinghui/flypic';
/**
+1 -1
View File
@@ -1718,7 +1718,7 @@ function Sidebar() {
<div className="w-5 mr-1" />
<Folder className="w-4 h-4 mr-2 text-blue-500 flex-shrink-0" />
<span className="text-sm text-gray-700 dark:text-gray-200 font-medium flex-1">
全部图片
全部
</span>
<span className="text-xs text-gray-500 dark:text-gray-300 ml-2">
{totalImageCount}
+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) {