You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(web): preview videos in the file sidebar - #1292
sequenceDiagram
participant VideoPreview as 视频预览
participant VideoElement as 视频元素
participant VideoRoute as 视频路由
participant WorkspaceFile as 工作区视频文件
VideoPreview->>VideoElement: 设置视频流地址
VideoElement->>VideoRoute: GET 视频地址,可选 Range
VideoRoute->>WorkspaceFile: 按会话和路径读取视频
WorkspaceFile-->>VideoRoute: 返回文件内容
VideoRoute-->>VideoElement: 返回视频流及响应头
Loading
Suggested reviewers:bytepioneer-ai
Merge Risk: Minimal · up to 3975d
This adds video playback to the file sidebar through an authenticated streaming endpoint. No concrete merge-blocking risk was found; browser and codec support for playback is limited, but the download fallback remains available.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
标题“feat(web): preview videos in the file sidebar”与变更内容一致。变更新增侧栏视频预览器(VideoPreview.tsx、locales、文档)以及视频流路由 /api/workspace-file/video(workspace-video.ts、main.ts 及测试),标题准确概括了主要功能。
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
Applicability reference: AGENTS.md: # Repository Guidelines `npm start` / `npm start web` rebuild and relaunch the user's Desktop / Web and may restart the shared Host; `npm stop` stops all local codexhost services across worktrees.
感谢贡献!已完成独立 Web 隔离实测(MP4/WebM 播放、206 Range 拖拽、切换文件资源释放、损坏文件重试与下载、401/415/416 边界校验全部通过,零页面错误),已合入 main。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
点击聊天中的 MP4 等视频文件后,右侧栏此前只显示“该格式文件暂时无法预览”。现在可在原位置播放,使用浏览器原生播放、进度、音量和全屏控件,默认不自动播放。
GET/HEAD /api/workspace-file/video,沿用本地会话及工作区草稿的文件访问范围,流式发送且支持单段 Range(206 / 416);视频不经过 32 MiB 的完整文档读取限制。nosniff与禁止缓存,不复用下载票据。原文件下载行为不变。Related issues
N/A。独立于 #1287 的拖放上传修复;本 PR 处理文件已经存在后的侧栏播放。
UI Demo
隔离 Web 使用合成会话和合成媒体,截图已检查,无真实聊天、凭据或私人素材。
390px 窄屏
Test plan
node --import tsx --test packages/web-server/test/workspace-video.test.ts packages/web-server/test/workspace-file-actions.test.ts:5 项通过。覆盖认证、完整读取、HEAD、固定/开放/后缀 Range、越界 416、非法及多段 Range 回退、条件 Range、空文件、未知会话、目录、非视频文件和绝对路径;原有下载与下载票据测试同时通过。e06c3c6fa上实际失败(视频接口返回 404,预期 200),添加实现后通过。npx tsc -b packages/web-server通过;Web UI 完整构建用于建立基线,最终修改的ui-codexhost浏览器包定向构建通过。Merge Danger
Door: two-way。无数据迁移,可撤回注册与路由。
Blast Radius: Web。新增视频预览器与专用文件读取路由,沿用原有权限和下载入口。