Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d0023949b | ||
|
|
9c7c72e3e7 | ||
|
|
e17b78cd19 | ||
|
|
f07cf7a266 |
No files matched your search
@@ -1,5 +1,30 @@
|
|||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
## 2026-11-18 → v1.4.5
|
||||||
|
|
||||||
|
**优化:侧栏文件夹按日期倒序,最新的文件夹排最前**——原先侧栏/仪表盘文件夹顺序来自后端 `SELECT ... ORDER BY path`(名称字典序升序),最旧的文件夹排最前,最新日期沉底。现改为在 `FolderModel.getTree()` 按文件夹名解析出的真实日期倒序排序:
|
||||||
|
|
||||||
|
- 兼容两种命名格式混排:`YYYY-MM-DD` 与 `YYYYMMDD`(原纯字符串倒序会把 `20261016` 压过 `2026-11-18`,日期顺序错乱;`_归档` 还会因首字符 `_` 排到最前)
|
||||||
|
- 无法解析为日期的文件夹(如 `_归档`、`1217`)排在所有日期文件夹之后,组内按名称倒序
|
||||||
|
- 子文件夹同样按日期倒序
|
||||||
|
- 侧栏与仪表盘(Dashboard)共用同一接口数据,同步生效
|
||||||
|
|
||||||
|
## 2026-11-18 → v1.4.4
|
||||||
|
|
||||||
|
**修复:选中视频文件,右侧详情面板仍显示图片信息**——根因是 `RightPanel.jsx` 全组件没有任何视频判定(`fileType === 'video'`),预览区把视频当图片渲染缩略图、底部按钮硬编码「编辑图片 / 复制图片 / 导出图片」,点「编辑图片」还会把视频塞进图片编辑器。修复:
|
||||||
|
|
||||||
|
- **预览区**:视频改为直接播放原文件(`<video controls>`,缩略图作 poster),不再以图片形式展示
|
||||||
|
- **按钮按类型分流**:单选视频显示「编辑视频 / 复制视频 / 导出视频」——「编辑视频」打开视频编辑弹窗(水印/字幕声音),「复制视频」只写应用内剪贴板(视频无法转成图片写系统剪贴板,原先会走失败兜底弹 alert)
|
||||||
|
- **新增时长字段**:视频详情显示「时长: m:ss」(取 `duration` 字段,与瀑布流角标同格式)
|
||||||
|
- **多选文案**:选中集合含视频时,「已选择 N 张图片 / 数量 N 张图片 / 复制图片 / 导出图片」等改为「个文件 / 复制文件 / 导出文件」,计数单位「张」→「个」
|
||||||
|
- **弹窗状态提升**:视频编辑弹窗状态从 `ImageWaterfall` 局部 state 提升到 `useUIStore`,弹窗渲染移到 App 层——原先只挂在 `ImageWaterfall` 内,而该组件在 Dashboard 视图下不渲染,某些页面点编辑视频弹窗不会出现;右侧面板与右键菜单现共用同一入口,不再重复挂载
|
||||||
|
|
||||||
|
## 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
|
## 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 里挂载进容器再重试)`(创建与更新两处)。
|
**修复:添加素材库报 `Path does not exist`(视频目录)**——根因是该目录未挂载进容器(容器里看不到宿主机目录)。`docker-compose.yml` 已补挂载 `/vol2/1000/HD2/发布到平台的图片和视频`,README 使用注意新增排查方法(volumes 加一行同路径挂载后 `docker compose up -d`)。后端报错同步中文化:`素材库路径不存在: <路径>(如为宿主机目录,需先在 docker-compose.yml 的 volumes 里挂载进容器再重试)`(创建与更新两处)。
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ docker run -d --name flypic --restart unless-stopped \
|
|||||||
-e NODE_ENV=production \
|
-e NODE_ENV=production \
|
||||||
-v /vol3/1000/HD3/docker/flypic/config:/root/.flypic \
|
-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/我的文档" \
|
||||||
-v "/vol2/1000/HD2/发布到平台的图片和视频:/vol2/1000/HD2/发布到平台的图片和视频" \
|
-v "/vol2/1000/HD2/发布到平台的图片和视频:/vol2/1000/HD2/发布到平台的图片和视频" \
|
||||||
jpccr.ccs.tencentyun.com/jinghui/flypic:latest
|
jpccr.ccs.tencentyun.com/jinghui/flypic:latest
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -28,9 +28,28 @@ class FolderModel extends BaseModel {
|
|||||||
*/
|
*/
|
||||||
getTree() {
|
getTree() {
|
||||||
const folders = this.findAll();
|
const folders = this.findAll();
|
||||||
|
// 最新文件夹排最前:按文件夹名解析出的日期倒序(兼容 YYYY-MM-DD 与 YYYYMMDD 两种命名),
|
||||||
|
// 无法解析为日期的(如 _归档、纯数字名)排在日期文件夹之后
|
||||||
|
folders.sort((a, b) => {
|
||||||
|
const diff = this._dateKey(b.name) - this._dateKey(a.name);
|
||||||
|
if (diff !== 0) return diff;
|
||||||
|
return String(b.name).localeCompare(String(a.name));
|
||||||
|
});
|
||||||
return this._buildTree(folders);
|
return this._buildTree(folders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将文件夹名解析为日期键(YYYYMMDD 整数),解析不出返回 0
|
||||||
|
*/
|
||||||
|
_dateKey(name) {
|
||||||
|
const m = String(name || '').match(/(\d{4})-?(\d{2})-?(\d{2})/);
|
||||||
|
if (!m) return 0;
|
||||||
|
const month = Number(m[2]);
|
||||||
|
const day = Number(m[3]);
|
||||||
|
if (month < 1 || month > 12 || day < 1 || day > 31) return 0;
|
||||||
|
return Number(m[1] + m[2] + m[3]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入文件夹
|
* 插入文件夹
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const { getSettings } = require('./settings');
|
|||||||
const HUB_URL = (process.env.HUB_URL || 'https://auth.88531.cn/api').replace(/\/+$/, '');
|
const HUB_URL = (process.env.HUB_URL || 'https://auth.88531.cn/api').replace(/\/+$/, '');
|
||||||
const HUB_PROJECT_ID = process.env.HUB_PROJECT_ID || '';
|
const HUB_PROJECT_ID = process.env.HUB_PROJECT_ID || '';
|
||||||
const HUB_API_KEY = process.env.HUB_API_KEY || '';
|
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.5';
|
||||||
const TIMEOUT_MS = 8000;
|
const TIMEOUT_MS = 8000;
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ services:
|
|||||||
- HUB_API_KEY=${HUB_API_KEY:-}
|
- HUB_API_KEY=${HUB_API_KEY:-}
|
||||||
- NEWAPI_KEY=${NEWAPI_KEY:-}
|
- NEWAPI_KEY=${NEWAPI_KEY:-}
|
||||||
# 当前站点版本(与 frontend/package.json、CHANGELOG 保持一致,界面版本徽标来源)
|
# 当前站点版本(与 frontend/package.json、CHANGELOG 保持一致,界面版本徽标来源)
|
||||||
- SITE_VERSION=1.4.2
|
- SITE_VERSION=1.4.5
|
||||||
# 让容器经 host.docker.internal 访问宿主机的 AI 侧车
|
# 让容器经 host.docker.internal 访问宿主机的 AI 侧车
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
|
|||||||
+22
-2
@@ -14,6 +14,7 @@ import Header from './components/Header';
|
|||||||
import LibraryMissingModal from './components/LibraryMissingModal';
|
import LibraryMissingModal from './components/LibraryMissingModal';
|
||||||
import BackToTop from './components/BackToTop';
|
import BackToTop from './components/BackToTop';
|
||||||
import ImageEditor from './components/ImageEditor';
|
import ImageEditor from './components/ImageEditor';
|
||||||
|
import VideoEditModal from './components/VideoEditModal';
|
||||||
import { createLogger } from './utils/logger';
|
import { createLogger } from './utils/logger';
|
||||||
|
|
||||||
const logger = createLogger('App');
|
const logger = createLogger('App');
|
||||||
@@ -22,13 +23,14 @@ function App() {
|
|||||||
// 使用统一的主题管理 Hook
|
// 使用统一的主题管理 Hook
|
||||||
useTheme();
|
useTheme();
|
||||||
|
|
||||||
const { mobileView, setMobileView } = useUIStore();
|
const { mobileView, setMobileView, videoEditFile, setVideoEditFile } = useUIStore();
|
||||||
const {
|
const {
|
||||||
setLibraries,
|
setLibraries,
|
||||||
setCurrentLibrary,
|
setCurrentLibrary,
|
||||||
removeLibrary,
|
removeLibrary,
|
||||||
setShowAddLibraryForm,
|
setShowAddLibraryForm,
|
||||||
triggerExpandLibrarySelector
|
triggerExpandLibrarySelector,
|
||||||
|
currentLibraryId
|
||||||
} = useLibraryStore();
|
} = useLibraryStore();
|
||||||
const { selectedImage } = useImageStore();
|
const { selectedImage } = useImageStore();
|
||||||
const { setScanProgress } = useScanStore();
|
const { setScanProgress } = useScanStore();
|
||||||
@@ -515,6 +517,15 @@ function App() {
|
|||||||
onCreateNew={handleCreateNewLibrary}
|
onCreateNew={handleCreateNewLibrary}
|
||||||
/>
|
/>
|
||||||
<ImageEditor />
|
<ImageEditor />
|
||||||
|
{/* 视频编辑弹窗(store 全局状态,右侧面板/瀑布流均可触发) */}
|
||||||
|
{videoEditFile && (
|
||||||
|
<VideoEditModal
|
||||||
|
file={videoEditFile}
|
||||||
|
libraryId={currentLibraryId}
|
||||||
|
onClose={() => setVideoEditFile(null)}
|
||||||
|
onDone={() => { setVideoEditFile(null); window.location.reload(); }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<div className="flex-1 overflow-hidden relative">
|
<div className="flex-1 overflow-hidden relative">
|
||||||
{/* 侧边栏视图 */}
|
{/* 侧边栏视图 */}
|
||||||
<div className={`absolute inset-0 transition-transform duration-300 ${mobileView === 'sidebar' ? 'translate-x-0' : '-translate-x-full'
|
<div className={`absolute inset-0 transition-transform duration-300 ${mobileView === 'sidebar' ? 'translate-x-0' : '-translate-x-full'
|
||||||
@@ -590,6 +601,15 @@ function App() {
|
|||||||
onCreateNew={handleCreateNewLibrary}
|
onCreateNew={handleCreateNewLibrary}
|
||||||
/>
|
/>
|
||||||
<ImageEditor />
|
<ImageEditor />
|
||||||
|
{/* 视频编辑弹窗(store 全局状态,右侧面板/瀑布流均可触发) */}
|
||||||
|
{videoEditFile && (
|
||||||
|
<VideoEditModal
|
||||||
|
file={videoEditFile}
|
||||||
|
libraryId={currentLibraryId}
|
||||||
|
onClose={() => setVideoEditFile(null)}
|
||||||
|
onDone={() => { setVideoEditFile(null); window.location.reload(); }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<div ref={containerRef} className="flex flex-1 overflow-hidden">
|
<div ref={containerRef} className="flex flex-1 overflow-hidden">
|
||||||
{/* 左侧边栏 */}
|
{/* 左侧边栏 */}
|
||||||
<div id="left-panel" style={{ width: `${leftWidth}px` }} className="flex-shrink-0 h-full bg-white dark:bg-gray-800">
|
<div id="left-panel" style={{ width: `${leftWidth}px` }} className="flex-shrink-0 h-full bg-white dark:bg-gray-800">
|
||||||
|
|||||||
@@ -6,6 +6,14 @@
|
|||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { X, Loader2, Film, CheckCircle2, AlertCircle, KeyRound } from 'lucide-react';
|
import { X, Loader2, Film, CheckCircle2, AlertCircle, KeyRound } from 'lucide-react';
|
||||||
import { imageAPI } from '../api';
|
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 = [
|
const VOICES = [
|
||||||
{ key: 'zh-CN-XiaoxiaoNeural', label: '晓晓(女声·自然)' },
|
{ key: 'zh-CN-XiaoxiaoNeural', label: '晓晓(女声·自然)' },
|
||||||
@@ -51,7 +59,9 @@ function AIVideoModal({ libraryId, images, onClose, onDone }) {
|
|||||||
if (!taskId) return;
|
if (!taskId) return;
|
||||||
timerRef.current = setInterval(async () => {
|
timerRef.current = setInterval(async () => {
|
||||||
try {
|
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;
|
if (!res.ok) return;
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
setTask(data);
|
setTask(data);
|
||||||
@@ -74,7 +84,10 @@ function AIVideoModal({ libraryId, images, onClose, onDone }) {
|
|||||||
try {
|
try {
|
||||||
const res = await fetch('/api/video/aigenerate', {
|
const res = await fetch('/api/video/aigenerate', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: `Bearer ${getToken()}`
|
||||||
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
libraryId,
|
libraryId,
|
||||||
images: list.map((img) => ({ path: img.path })),
|
images: list.map((img) => ({ path: img.path })),
|
||||||
@@ -86,7 +99,7 @@ function AIVideoModal({ libraryId, images, onClose, onDone }) {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
const data = await res.json().catch(() => ({}));
|
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);
|
setTaskId(data.taskId);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setError(e.message || '启动失败');
|
setError(e.message || '启动失败');
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ function Header() {
|
|||||||
// 授权系统 hub:版本 / 公告 / 在线人数
|
// 授权系统 hub:版本 / 公告 / 在线人数
|
||||||
const hub = useHub();
|
const hub = useHub();
|
||||||
const announcements = hub.announcements || [];
|
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.5';
|
||||||
|
|
||||||
// 从全局 store 获取筛选状态
|
// 从全局 store 获取筛选状态
|
||||||
const selectedFormats = filters.formats || [];
|
const selectedFormats = filters.formats || [];
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ import UndoToast from './UndoToast';
|
|||||||
import RatingToast from './RatingToast';
|
import RatingToast from './RatingToast';
|
||||||
import FolderSelector from './FolderSelector';
|
import FolderSelector from './FolderSelector';
|
||||||
import ConflictDialog from './ConflictDialog';
|
import ConflictDialog from './ConflictDialog';
|
||||||
import VideoEditModal from './VideoEditModal';
|
|
||||||
import AIVideoModal from './AIVideoModal';
|
import AIVideoModal from './AIVideoModal';
|
||||||
|
|
||||||
// 虚拟滚动阈值
|
// 虚拟滚动阈值
|
||||||
@@ -58,13 +57,12 @@ function ImageWaterfall() {
|
|||||||
toggleImageSelection, clearSelection, imageLoadingState, selectedFolder,
|
toggleImageSelection, clearSelection, imageLoadingState, selectedFolder,
|
||||||
searchKeywords, filters, folders, setSelectedFolderItem, updateImage
|
searchKeywords, filters, folders, setSelectedFolderItem, updateImage
|
||||||
} = useImageStore();
|
} = useImageStore();
|
||||||
const { setEditingImage, setMergeImages } = useUIStore();
|
const { setEditingImage, setMergeImages, setVideoEditFile } = useUIStore();
|
||||||
|
|
||||||
// 状态
|
// 状态
|
||||||
const [photoIndex, setPhotoIndex] = useState(-1);
|
const [photoIndex, setPhotoIndex] = useState(-1);
|
||||||
const [lastSelectedIndex, setLastSelectedIndex] = useState(null);
|
const [lastSelectedIndex, setLastSelectedIndex] = useState(null);
|
||||||
const [viewerFile, setViewerFile] = useState(null);
|
const [viewerFile, setViewerFile] = useState(null);
|
||||||
const [videoEditFile, setVideoEditFile] = useState(null); // 视频编辑弹窗
|
|
||||||
const [aiVideoOpen, setAiVideoOpen] = useState(false); // AI 生成视频弹窗
|
const [aiVideoOpen, setAiVideoOpen] = useState(false); // AI 生成视频弹窗
|
||||||
const [contextMenu, setContextMenu] = useState({ isOpen: false, position: null, image: null });
|
const [contextMenu, setContextMenu] = useState({ isOpen: false, position: null, image: null });
|
||||||
// 统一图片移动/删除撤销顺序的栈:按操作时间顺序记录 'move' | 'delete'
|
// 统一图片移动/删除撤销顺序的栈:按操作时间顺序记录 'move' | 'delete'
|
||||||
@@ -667,16 +665,6 @@ onToggleFavorite={handleToggleFavorite}
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 视频编辑弹窗 */}
|
|
||||||
{videoEditFile && (
|
|
||||||
<VideoEditModal
|
|
||||||
file={videoEditFile}
|
|
||||||
libraryId={currentLibraryId}
|
|
||||||
onClose={() => setVideoEditFile(null)}
|
|
||||||
onDone={() => { setVideoEditFile(null); window.location.reload(); }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* AI 生成视频弹窗 */}
|
{/* AI 生成视频弹窗 */}
|
||||||
{aiVideoOpen && (
|
{aiVideoOpen && (
|
||||||
<AIVideoModal
|
<AIVideoModal
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ export default function MergeCollage({ image, libraryId, onMerge, setStatus, set
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
Authorization: `*** ${getToken()}`
|
Authorization: `Bearer ${getToken()}`
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
libraryId,
|
libraryId,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const logger = createLogger('RightPanel');
|
|||||||
function RightPanel() {
|
function RightPanel() {
|
||||||
const { currentLibraryId } = useLibraryStore();
|
const { currentLibraryId } = useLibraryStore();
|
||||||
const { selectedImage, selectedImages, selectedFolder, selectedFolderItem, images, setSelectedImage, setSelectedImages, updateImage } = useImageStore();
|
const { selectedImage, selectedImages, selectedFolder, selectedFolderItem, images, setSelectedImage, setSelectedImages, updateImage } = useImageStore();
|
||||||
const { setMobileView, isResizingPanels, resizingSide, setEditingImage } = useUIStore();
|
const { setMobileView, isResizingPanels, resizingSide, setEditingImage, setVideoEditFile } = useUIStore();
|
||||||
const { copyToClipboard } = useClipboardStore();
|
const { copyToClipboard } = useClipboardStore();
|
||||||
const [isMobile, setIsMobile] = useState(false);
|
const [isMobile, setIsMobile] = useState(false);
|
||||||
const [imageUrl, setImageUrl] = useState(''); // 当前显示的图片URL
|
const [imageUrl, setImageUrl] = useState(''); // 当前显示的图片URL
|
||||||
@@ -50,6 +50,8 @@ function RightPanel() {
|
|||||||
// 判断是单选还是多选
|
// 判断是单选还是多选
|
||||||
const isMultiSelect = actualSelectedCount > 1;
|
const isMultiSelect = actualSelectedCount > 1;
|
||||||
const displayImage = selectedImages.length > 0 ? selectedImages[0] : selectedImage;
|
const displayImage = selectedImages.length > 0 ? selectedImages[0] : selectedImage;
|
||||||
|
// 视频文件判定:右侧面板按文件类型展示,视频不再套用图片文案/操作
|
||||||
|
const singleIsVideo = !isMultiSelect && (displayImage?.fileType === 'video');
|
||||||
const { getCurrentLibrary } = useLibraryStore();
|
const { getCurrentLibrary } = useLibraryStore();
|
||||||
const currentLibrary = getCurrentLibrary();
|
const currentLibrary = getCurrentLibrary();
|
||||||
|
|
||||||
@@ -598,6 +600,13 @@ function RightPanel() {
|
|||||||
// 2. 获取原图URL,写入系统剪贴板
|
// 2. 获取原图URL,写入系统剪贴板
|
||||||
const imageUrl = imageAPI.getOriginalUrl(currentLibraryId, selectedImage.path);
|
const imageUrl = imageAPI.getOriginalUrl(currentLibraryId, selectedImage.path);
|
||||||
|
|
||||||
|
// 视频无法转换为图片写入系统剪贴板,仅保留应用内复制(供粘贴移动)
|
||||||
|
if (selectedImage?.fileType === 'video') {
|
||||||
|
setImageCopied(true);
|
||||||
|
setTimeout(() => setImageCopied(false), 2000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 方案1:尝试现代 Clipboard API(需要 HTTPS)
|
// 方案1:尝试现代 Clipboard API(需要 HTTPS)
|
||||||
if (isClipboardApiSupported()) {
|
if (isClipboardApiSupported()) {
|
||||||
try {
|
try {
|
||||||
@@ -770,6 +779,9 @@ function RightPanel() {
|
|||||||
return selectedImage ? [selectedImage] : [];
|
return selectedImage ? [selectedImage] : [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 选中集合是否含视频(决定多选计数单位文案:视频用「个」,图片用「张」)
|
||||||
|
const selectionHasVideo = getImagesToProcess().some(img => img?.fileType === 'video');
|
||||||
|
|
||||||
// 批量复制图片
|
// 批量复制图片
|
||||||
const copyMultipleImages = async () => {
|
const copyMultipleImages = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -1312,7 +1324,16 @@ function RightPanel() {
|
|||||||
}}
|
}}
|
||||||
title="双击查看原文件"
|
title="双击查看原文件"
|
||||||
>
|
>
|
||||||
{imageUrl ? (
|
{singleIsVideo ? (
|
||||||
|
// 视频:直接播放原文件(不再以图片缩略图形式展示)
|
||||||
|
<video
|
||||||
|
src={getOriginalUrl()}
|
||||||
|
poster={imageUrl || undefined}
|
||||||
|
controls
|
||||||
|
preload="metadata"
|
||||||
|
className="w-full h-full object-contain bg-black"
|
||||||
|
/>
|
||||||
|
) : imageUrl ? (
|
||||||
<img
|
<img
|
||||||
src={imageUrl}
|
src={imageUrl}
|
||||||
alt={displayImage.filename}
|
alt={displayImage.filename}
|
||||||
@@ -1346,7 +1367,7 @@ function RightPanel() {
|
|||||||
<div className="flex-1 overflow-y-auto p-4 space-y-4 min-h-0">
|
<div className="flex-1 overflow-y-auto p-4 space-y-4 min-h-0">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2">
|
<h3 className="text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2">
|
||||||
{isMultiSelect ? `已选择 ${actualSelectedCount} 张图片` : '基本信息'}
|
{isMultiSelect ? `已选择 ${actualSelectedCount} ${selectionHasVideo ? '个文件' : '张图片'}` : '基本信息'}
|
||||||
</h3>
|
</h3>
|
||||||
<div className="space-y-2 text-xs">
|
<div className="space-y-2 text-xs">
|
||||||
{isMultiSelect ? (
|
{isMultiSelect ? (
|
||||||
@@ -1359,7 +1380,7 @@ function RightPanel() {
|
|||||||
<>
|
<>
|
||||||
<div>
|
<div>
|
||||||
<span className="text-gray-500 dark:text-gray-400">数量:</span>
|
<span className="text-gray-500 dark:text-gray-400">数量:</span>
|
||||||
<p className="text-gray-900 dark:text-gray-100 text-xs">{stats.count} 张图片</p>
|
<p className="text-gray-900 dark:text-gray-100 text-xs">{stats.count} {selectionHasVideo ? '个文件' : '张图片'}</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span className="text-gray-500 dark:text-gray-400">评分:</span>
|
<span className="text-gray-500 dark:text-gray-400">评分:</span>
|
||||||
@@ -1492,6 +1513,14 @@ function RightPanel() {
|
|||||||
<span className="text-gray-500 dark:text-gray-400">尺寸:</span>
|
<span className="text-gray-500 dark:text-gray-400">尺寸:</span>
|
||||||
<p className="text-gray-900 dark:text-gray-100 text-xs">{selectedImage.width} × {selectedImage.height}</p>
|
<p className="text-gray-900 dark:text-gray-100 text-xs">{selectedImage.width} × {selectedImage.height}</p>
|
||||||
</div>
|
</div>
|
||||||
|
{singleIsVideo && selectedImage.duration > 0 && (
|
||||||
|
<div>
|
||||||
|
<span className="text-gray-500 dark:text-gray-400">时长:</span>
|
||||||
|
<p className="text-gray-900 dark:text-gray-100 text-xs font-mono tabular-nums">
|
||||||
|
{Math.floor(selectedImage.duration / 60)}:{String(Math.floor(selectedImage.duration % 60)).padStart(2, '0')}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<div>
|
<div>
|
||||||
<span className="text-gray-500 dark:text-gray-400">文件大小:</span>
|
<span className="text-gray-500 dark:text-gray-400">文件大小:</span>
|
||||||
<p className="text-gray-900 dark:text-gray-100 text-xs">{formatFileSize(selectedImage.size)}</p>
|
<p className="text-gray-900 dark:text-gray-100 text-xs">{formatFileSize(selectedImage.size)}</p>
|
||||||
@@ -1552,7 +1581,7 @@ function RightPanel() {
|
|||||||
</div>
|
</div>
|
||||||
{isMultiSelect && (
|
{isMultiSelect && (
|
||||||
<p className="text-xs text-gray-400 dark:text-gray-500 mt-1">
|
<p className="text-xs text-gray-400 dark:text-gray-500 mt-1">
|
||||||
已选择 {actualSelectedCount} 张图片的共同父路径
|
已选择 {actualSelectedCount} {selectionHasVideo ? '个文件' : '张图片'}的共同父路径
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -1563,16 +1592,23 @@ function RightPanel() {
|
|||||||
{/* Actions - 仅桌面端显示 */}
|
{/* Actions - 仅桌面端显示 */}
|
||||||
{!isMobile && (
|
{!isMobile && (
|
||||||
<div className="p-4 border-t border-gray-200 dark:border-gray-700 space-y-2 flex-shrink-0">
|
<div className="p-4 border-t border-gray-200 dark:border-gray-700 space-y-2 flex-shrink-0">
|
||||||
{/* 编辑图片(单选时) */}
|
{/* 编辑图片/视频(单选时) */}
|
||||||
{!isMultiSelect && selectedImage && (
|
{!isMultiSelect && selectedImage && (
|
||||||
<button
|
<button
|
||||||
onClick={() => setEditingImage(selectedImage)}
|
onClick={() => {
|
||||||
|
if (singleIsVideo) {
|
||||||
|
// 视频 → 视频编辑弹窗(水印/字幕声音)
|
||||||
|
setVideoEditFile(selectedImage);
|
||||||
|
} else {
|
||||||
|
setEditingImage(selectedImage);
|
||||||
|
}
|
||||||
|
}}
|
||||||
className="w-full flex items-center justify-center gap-2 px-4 py-2 rounded-lg bg-blue-600 text-white hover:bg-blue-700 transition-colors"
|
className="w-full flex items-center justify-center gap-2 px-4 py-2 rounded-lg bg-blue-600 text-white hover:bg-blue-700 transition-colors"
|
||||||
>
|
>
|
||||||
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
|
||||||
</svg>
|
</svg>
|
||||||
编辑图片
|
{singleIsVideo ? '编辑视频' : '编辑图片'}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{/* 复制按钮 */}
|
{/* 复制按钮 */}
|
||||||
@@ -1587,12 +1623,16 @@ function RightPanel() {
|
|||||||
{imageCopied ? (
|
{imageCopied ? (
|
||||||
<>
|
<>
|
||||||
<Check className="w-4 h-4" />
|
<Check className="w-4 h-4" />
|
||||||
<span>已复制{isMultiSelect ? ` ${actualSelectedCount} 张` : ''}</span>
|
<span>已复制{isMultiSelect ? ` ${actualSelectedCount} ${selectionHasVideo ? '个' : '张'}` : ''}</span>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Copy className="w-4 h-4" />
|
<Copy className="w-4 h-4" />
|
||||||
<span>复制图片{isMultiSelect ? ` (${actualSelectedCount})` : ''}</span>
|
<span>
|
||||||
|
{singleIsVideo
|
||||||
|
? '复制视频'
|
||||||
|
: `${selectionHasVideo ? '复制文件' : '复制图片'}${isMultiSelect ? ` (${actualSelectedCount})` : ''}`}
|
||||||
|
</span>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
@@ -1608,7 +1648,7 @@ function RightPanel() {
|
|||||||
<span>
|
<span>
|
||||||
{isExporting
|
{isExporting
|
||||||
? `打包中... ${exportProgress}%`
|
? `打包中... ${exportProgress}%`
|
||||||
: `导出图片${isMultiSelect ? ` (${actualSelectedCount})` : ''}`
|
: `${singleIsVideo ? '导出视频' : selectionHasVideo ? '导出文件' : '导出图片'}${isMultiSelect ? ` (${actualSelectedCount})` : ''}`
|
||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useState, useEffect } from 'react';
|
|||||||
import { X, ScanText, Info, Save, FlaskConical, Github, ExternalLink, Wand2 } from 'lucide-react';
|
import { X, ScanText, Info, Save, FlaskConical, Github, ExternalLink, Wand2 } from 'lucide-react';
|
||||||
import { settingsAPI } from '../api';
|
import { settingsAPI } from '../api';
|
||||||
|
|
||||||
const APP_VERSION = 'v1.4.2';
|
const APP_VERSION = 'v1.4.5';
|
||||||
const REPO_URL = 'https://gitea.88531.cn/jinghui/flypic';
|
const REPO_URL = 'https://gitea.88531.cn/jinghui/flypic';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1718,7 +1718,7 @@ function Sidebar() {
|
|||||||
<div className="w-5 mr-1" />
|
<div className="w-5 mr-1" />
|
||||||
<Folder className="w-4 h-4 mr-2 text-blue-500 flex-shrink-0" />
|
<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 className="text-sm text-gray-700 dark:text-gray-200 font-medium flex-1">
|
||||||
全部图片
|
全部
|
||||||
</span>
|
</span>
|
||||||
<span className="text-xs text-gray-500 dark:text-gray-300 ml-2">
|
<span className="text-xs text-gray-500 dark:text-gray-300 ml-2">
|
||||||
{totalImageCount}
|
{totalImageCount}
|
||||||
|
|||||||
@@ -6,6 +6,14 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { X, Droplets, Eraser, Type, Scissors, Loader2 } from 'lucide-react';
|
import { X, Droplets, Eraser, Type, Scissors, Loader2 } from 'lucide-react';
|
||||||
import { imageAPI } from '../api';
|
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 = [
|
const ACTIONS = [
|
||||||
{ key: 'watermark-add', label: '加水印', icon: Droplets },
|
{ key: 'watermark-add', label: '加水印', icon: Droplets },
|
||||||
@@ -109,11 +117,14 @@ function VideoEditModal({ file, libraryId, onClose, onDone }) {
|
|||||||
try {
|
try {
|
||||||
const res = await fetch('/api/video/edit', {
|
const res = await fetch('/api/video/edit', {
|
||||||
method: 'POST',
|
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 })
|
body: JSON.stringify({ libraryId, path: file.path, action, options, output: outputMode })
|
||||||
});
|
});
|
||||||
const data = await res.json().catch(() => ({}));
|
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);
|
onDone && onDone(data.path);
|
||||||
onClose();
|
onClose();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ export const useUIStore = create((set) => ({
|
|||||||
editingImage: null,
|
editingImage: null,
|
||||||
setEditingImage: (image) => set({ editingImage: image }),
|
setEditingImage: (image) => set({ editingImage: image }),
|
||||||
|
|
||||||
|
// 视频编辑弹窗(打开的视频记录,null=关闭;右侧面板与瀑布流共用)
|
||||||
|
videoEditFile: null,
|
||||||
|
setVideoEditFile: (file) => set({ videoEditFile: file }),
|
||||||
|
|
||||||
// 合拼种子图(多选后点「合拼」带入编辑器,null=无)
|
// 合拼种子图(多选后点「合拼」带入编辑器,null=无)
|
||||||
mergeImages: null,
|
mergeImages: null,
|
||||||
setMergeImages: (images) => set({ mergeImages: images }),
|
setMergeImages: (images) => set({ mergeImages: images }),
|
||||||
|
|||||||
Reference in new issue
Block a user