Universal File Preview (DSH Plugin)

Introduction

The right-hand panel “File Preview” in DeepSeek Harness (DSH) natively supports only strict UTF-8 text. When encountering legacy encodings such as GBK, GB18030, or UTF-16, the file-reading layer fails, and the UI uniformly displays “This file format cannot be previewed”—which appears to be a “format not supported” issue but is actually an encoding problem. Additionally, the built-in preview directly marks files with extensions for video, archives, executables, and similar types as unpreviewable. To inspect such files, users typically have to open a separate application (e.g., a text editor, hex viewer, or font browser) to confirm the content.

What It Is

“Universal File Preview” (dsh-plugin-universal-preview) is a plugin that extends DSH’s right-hand panel “File Preview” with support for three categories of files that the built-in renderer cannot open: legacy-encoded text, arbitrary binary files (read-only hex view), and fonts (proof rendering). All views are strictly read-only and never modify the underlying files. The plugin is maintained by lovcoxin and is categorized under “Workflow.”

Core Features

The plugin provides three view types covering different file categories:

  • Text (legacy encoding compatible): Covers extensions cmd bat ps1 psm1 psd1 reg ini cfg conf properties inf. The decoding pipeline is: strict UTF-8 → detect UTF-16 via BOM → GB18030; the view displays the actual encoding, line count, and byte size.
  • Hex: Covers extensions including audio/video, archives, executables, disk images/databases, PSD/AI/TIFF/HEIC, and odt/ods/odp/pages/numbers. A read-only hex view (offset + hex + ASCII) with progressive expansion at 4 KiB → 32 KiB → 256 KiB tiers.
  • Font preview: Covers extensions ttf otf woff woff2. After loading via FontFace, it renders Chinese and English proof samples at 5 font-size tiers.

Built-in renderers (Markdown, images, PDF, Office, Excel, etc.) are unaffected. The text family is registered at the extension tier because it must override the built-in code highlighter (which inevitably fails on GBK); when syntax highlighting is needed, you can switch back to “Code” in the “Open with” menu.

Installation and Activation

Install from GitCode (primary source) or the GitHub mirror, pinned to a version tag:

dsh plugin add git+https://gitcode.com/lovcoxin/dsh-plugin-universal-preview.git#v0.1.0
# or
dsh plugin add git+https://github.com/lovcoxin/dsh-plugin-universal-preview.git#v0.1.0

After installation, refresh the page. To uninstall, run dsh plugin remove @local/dsh-universal-preview, or disable it under “Settings → Plugins.”

Configuration

“Settings → Universal File Preview” provides six configuration options:

  • Toggles for the three view families (a page refresh is required after saving).
  • Text display upper limit.
  • Hex initial window size.
  • Hex maximum window size.

Preferences are stored in the browser’s localStorage and do not write to the profile configuration.

Typical Usage

  • Open a GBK-encoded .bat or .ini file; the right-hand panel automatically uses the “Text (legacy encoding compatible)” view, displaying the actual encoding, line count, and byte size.
  • Open a video file; the right-hand panel uses the “Hex” view with progressive expansion at 4 KiB → 32 KiB → 256 KiB tiers.
  • Open a .ttf font file; the right-hand panel uses the “Font Preview” view, rendering Chinese and English proof samples at 5 font-size tiers.

Use Cases and Notes

  • Suited for developers and ops personnel who need to inspect legacy-encoded text, binary files, or font proof samples without leaving DSH.
  • The plugin runs with the privileges of the current DSH process; verify the source code and license (MIT) before installing.
  • Video/audio files are displayed as hex only—no playback; archives do not list their directory contents; font files do not parse font names or licensing information.
  • Encoding detection is heuristic: GB18030 decodes the vast majority of GBK byte sequences; very short files or non-Chinese ANSI text may be misidentified.
  • View text strings are currently hardcoded in Chinese and are not wired to the client’s locale service.

In Closing

This plugin extends DSH’s right-hand panel “File Preview” capability, enabling legacy-encoded text, binary files, and fonts to be viewed directly within DSH. For more details, visit the catalog page and the GitHub repository: https://www.skillhub.cn/plugins/lovcoxin/dsh-plugin-universal-preview; https://github.com/lovcoxin/dsh-plugin-universal-preview

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye