tsonglew/dsh-media-preview 预览 preview

tsonglew/dsh-media-preview

dsh-better-sidebar 的音频/视频预览查看器:支持原生播放,并带 Range-seeking 流式路由。

项目介绍Project Overview

dsh-media-preview 是 DeepSeek Harness 的 Web 界面插件,为 dsh-better-sidebar 注册一个 FileViewer,实现在侧边栏文件树中直接内联播放音频与视频。它通过专属的流式路由 /media-preview/file 提供 HTTP Range(206 响应)与分块读取,支持 mp4、webm、mkv、mp3、flac、wav 等格式,并可基于魔数嗅探无扩展名文件。适用于在 dsh 会话中浏览并即时预览媒体文件。注意:默认 2 GiB 单文件上限,且依赖 dsh-better-sidebar ≥ 0.4.0。

dsh-media-preview is a DSH web-UI plugin that registers a FileViewer with dsh-better-sidebar, enabling inline audio and video playback directly in the sidebar file tree. It exposes a dedicated streaming route (/media-preview/file) with HTTP Range (206) support and chunked reads via fs.createReadStream, covering formats like mp4, webm, mkv, mp3, flac, and wav, plus magic-byte sniffing for extension-less files. Use it to browse and preview media without leaving a dsh session. Note the default 2 GiB per-file cap and the dsh-better-sidebar ≥ 0.4.0 requirement.

或使用命令行安装(适合开发者)Or use CLI install (for developers)

命令行安装CLI Install

dsh plugin --profile web add github:tsonglew/dsh-media-preview

tsonglew/dsh-media-preview 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-media-preview

Awesome DSH Plugin

Audio and video preview for the DeepSeek Harness (dsh) web GUI, registered as a FileViewer inside dsh-better-sidebar. Open an .mp4/.webm/.mkv/.mov/… or .mp3/.flac/.wav/… file in the sidebar file tree and it plays inline with native controls.

Video Audio
image image

Why a dedicated route

better-sidebar's built-in /sidebar/file media route reads whole files into memory, has no HTTP Range support, and caps at an image-oriented size limit. This package serves media through its own streaming route (/media-preview/file) with:

  • HTTP Range (206) seeking — the browser can jump anywhere in a long video
  • Streamed responses (fs.createReadStream) — no whole-file buffering
  • Whole-filesystem scope behind the same browser trust fence the built-in /api documents (loopback Host + same-origin markers), matching the official directory-picker browse backend — the sidebar explorer browses outside the session cwd (e.g. a music folder in ~/Documents), and media files must play wherever the explorer can open them

Supported extensions

Video: mp4 webm mov m4v mkv avi ogv ts 3gp flv Audio: mp3 wav ogg oga m4a aac flac opus weba wma

Extension-less media is still claimed via magic-byte sniffing (ftyp, EBML, OggS, fLaC, RIFF/WAVE, RIFF/AVI, ID3, MP3 frames).

Install

dsh plugin --profile web add github:tsonglew/dsh-media-preview

(Requires dsh-better-sidebar ≥ 0.4.0, which exposes ctx.betterSidebar.registerFileViewer.)

Configuration

All fields optional (profile patch layer):

- id: media-preview
  config:
    maxMediaBytes: 2147483648  # hard cap on one served file (default 2 GiB)
    trustedHosts: []           # extra non-loopback authorities

License

MIT

上一个 Prev dsh-wps-plugings 下一个 Next dsh-Kimi-WebBridge