diff --git a/electron/services/imageDecryptService.ts b/electron/services/imageDecryptService.ts index ca02312..0618f58 100644 --- a/electron/services/imageDecryptService.ts +++ b/electron/services/imageDecryptService.ts @@ -11,7 +11,16 @@ import { wcdbService } from './wcdbService' // 获取 ffmpeg-static 的路径 function getStaticFfmpegPath(): string | null { try { - // 方法1: 直接 require ffmpeg-static + // 优先处理打包后的路径 + if (app.isPackaged) { + const resourcesPath = process.resourcesPath + const packedPath = join(resourcesPath, 'app.asar.unpacked', 'node_modules', 'ffmpeg-static', 'ffmpeg.exe') + if (existsSync(packedPath)) { + return packedPath + } + } + + // 方法1: 直接 require ffmpeg-static(开发环境) // eslint-disable-next-line @typescript-eslint/no-var-requires const ffmpegStatic = require('ffmpeg-static') @@ -19,21 +28,12 @@ function getStaticFfmpegPath(): string | null { return ffmpegStatic } - // 方法2: 手动构建路径(开发环境) + // 方法2: 手动构建路径(开发环境备用) const devPath = join(process.cwd(), 'node_modules', 'ffmpeg-static', 'ffmpeg.exe') if (existsSync(devPath)) { return devPath } - // 方法3: 打包后的路径 - if (app.isPackaged) { - const resourcesPath = process.resourcesPath - const packedPath = join(resourcesPath, 'app.asar.unpacked', 'node_modules', 'ffmpeg-static', 'ffmpeg.exe') - if (existsSync(packedPath)) { - return packedPath - } - } - return null } catch { return null diff --git a/package-lock.json b/package-lock.json index 921d2c5..ec2c90a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "weflow", - "version": "1.5.0", + "version": "1.5.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "weflow", - "version": "1.5.0", + "version": "1.5.2", "hasInstallScript": true, "dependencies": { "better-sqlite3": "^12.5.0", diff --git a/package.json b/package.json index b966d69..ec17f15 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "weflow", - "version": "1.5.0", + "version": "1.5.2", "description": "WeFlow", "main": "dist-electron/main.js", "author": "cc", @@ -115,7 +115,8 @@ ], "asarUnpack": [ "node_modules/silk-wasm/**/*", - "node_modules/sherpa-onnx-node/**/*" + "node_modules/sherpa-onnx-node/**/*", + "node_modules/ffmpeg-static/**/*" ], "extraFiles": [ { diff --git a/src/pages/ChatPage.tsx b/src/pages/ChatPage.tsx index ec80405..8d2ed72 100644 --- a/src/pages/ChatPage.tsx +++ b/src/pages/ChatPage.tsx @@ -1604,7 +1604,7 @@ function MessageBubble({ message, session, showTime, myAvatarUrl, isGroupChat, o // 视频相关状态 const [videoLoading, setVideoLoading] = useState(false) const [videoInfo, setVideoInfo] = useState<{ videoUrl?: string; coverUrl?: string; thumbUrl?: string; exists: boolean } | null>(null) - const videoContainerRef = useRef(null) + const videoContainerRef = useRef(null) const [isVideoVisible, setIsVideoVisible] = useState(false) const [videoMd5, setVideoMd5] = useState(null) @@ -2359,7 +2359,7 @@ function MessageBubble({ message, session, showTime, myAvatarUrl, isGroupChat, o // 未进入可视区域时显示占位符 if (!isVideoVisible) { return ( -
+
}> @@ -2371,7 +2371,7 @@ function MessageBubble({ message, session, showTime, myAvatarUrl, isGroupChat, o // 加载中 if (videoLoading) { return ( -
+
}>
) @@ -2382,7 +2382,7 @@ function MessageBubble({ message, session, showTime, myAvatarUrl, isGroupChat, o return (