dsh-gallery 0.10.7 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +122 -0
- package/README.md +35 -9
- package/client.js +86 -159
- package/index.js +136 -50
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,128 @@
|
|
|
2
2
|
|
|
3
3
|
本项目遵循[语义化版本](https://semver.org/lang/zh-CN/)。
|
|
4
4
|
|
|
5
|
+
## [0.11.1] - 2026-11-08
|
|
6
|
+
|
|
7
|
+
**主题:修 README 三处会坑到真实用户的问题(纯文档补丁,无代码改动)。**
|
|
8
|
+
|
|
9
|
+
### 修复
|
|
10
|
+
|
|
11
|
+
1. **「推荐安装」的锁版本命令指向 v0.4.0(严重)**
|
|
12
|
+
README 里写着 `git+https://...#03c05fb324ae...`,那个 commit 是 **11-03 的 v0.4.0**。
|
|
13
|
+
用户照着「推荐」装,装到的是**五天前的初版** —— 没有音视频、没有 Range、没有分类视图。
|
|
14
|
+
已改为当前 `v0.11.0` 的 commit(`a0dfb00`),并补一句「更推荐直接用 npm,
|
|
15
|
+
版本号跟着 latest 走,不用每次手工核对哈希」。
|
|
16
|
+
|
|
17
|
+
2. **安全章节过期,与实际实现不符**
|
|
18
|
+
原文写「单一 `POST /api/dsh-gallery`,不暴露任意文件读取接口」,
|
|
19
|
+
但 v0.11.0 确实新增了一条**独立的 GET/HEAD 媒体路由**。
|
|
20
|
+
新增「媒体路由的安全边界」一节,把三道防护
|
|
21
|
+
(只读 / 跨站拒绝 / 路径白名单)与「不经过网关认证」这个事实写清楚。
|
|
22
|
+
|
|
23
|
+
3. **宣传语跑在能力前面**
|
|
24
|
+
开头说「任务进行中就能校验和干预」,但路线图里「交付物手动 pin」明确标着 ❌ 未实现 ——
|
|
25
|
+
实际只能看 / 隐藏 / 删除 / 预览 / 截帧,**把判断回传给主线这一步还没做**。
|
|
26
|
+
已改为「看到 + 当场校验」,并加「能力边界」提醒,
|
|
27
|
+
区分「实时看见(已能用)」与「回传干预(下一步)」。
|
|
28
|
+
|
|
29
|
+
### 为什么值得单独发版
|
|
30
|
+
|
|
31
|
+
这三条都是**用户照着 README 操作会直接踩坑**的:
|
|
32
|
+
装错版本、对安全边界有错误预期、对功能范围有错误预期。
|
|
33
|
+
文档错误比代码 bug 更难自查 —— 代码有测试,文档没有。
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## [0.11.0] - 2026-11-08
|
|
38
|
+
|
|
39
|
+
**主题:媒体播放换成真 HTTP Range —— 大视频也能拖进度条了。**
|
|
40
|
+
|
|
41
|
+
### 根本改动:路由 API 从 `connection.fetch` 换成 `webServer`
|
|
42
|
+
|
|
43
|
+
之前(0.10.x)的判断是「DSH 的 HTTP 通道不支持 206」,于是退而求其次:
|
|
44
|
+
≤60 MB 用 blob 播放(能拖但占内存)、>60 MB 引导用系统播放器。
|
|
45
|
+
|
|
46
|
+
**那个判断是错的** —— 不是 DSH 不支持 206,是**用错了 API**:
|
|
47
|
+
|
|
48
|
+
| API | 参数 | 206 支持 |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| `ctx.connection.fetch.register` | Web Fetch API(`Request`/`Response`) | ❌ 网关层不透传 |
|
|
51
|
+
| **`ctx.webServer.register`** | **Node 原生 `(req, res)`** | ✅ **完全支持** |
|
|
52
|
+
|
|
53
|
+
探针实测确认(12 项全过):HEAD 200 / `bytes=0-1023` → 206 / 中段 → 206 /
|
|
54
|
+
后缀 `bytes=-1024` → 206。
|
|
55
|
+
|
|
56
|
+
### 结果对比
|
|
57
|
+
|
|
58
|
+
| | 0.10.7 | **0.11.0** |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| 127 MB 视频 | ❌ 只能外部打开 | ✅ **面板内直接播 + 拖进度条** |
|
|
61
|
+
| 拖进度条 | ✅ 仅 ≤60 MB | ✅ **任意大小** |
|
|
62
|
+
| 内存占用 | 等于文件大小(blob) | **恒定几 MB**(流式) |
|
|
63
|
+
| 点开的等待 | 等整个文件载入 | **立即开播**(只拉首段) |
|
|
64
|
+
|
|
65
|
+
### 安全(三道防护)
|
|
66
|
+
|
|
67
|
+
媒体路由独立注册、不经 `/api` 网关认证,所以必须自己防护:
|
|
68
|
+
|
|
69
|
+
1. **只读** —— GET / HEAD,其余 405
|
|
70
|
+
2. **跨站拒绝** —— `sec-fetch-site: cross-site` 或 origin/host 不匹配 → 403
|
|
71
|
+
3. **路径白名单** —— 必须落在扫描 `roots` 内,否则能读任意文件
|
|
72
|
+
4. 附带 `x-content-type-options: nosniff`
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## [0.10.7] - 2026-11-08
|
|
77
|
+
|
|
78
|
+
统一更新音视频说明:`package.json` description、`locale` 中英双语 meta、
|
|
79
|
+
README 新增「音视频画廊」章节、版本 badge 0.7.2 → 0.10.7。
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## [0.10.6] - 2026-11-08
|
|
84
|
+
|
|
85
|
+
### 修复
|
|
86
|
+
|
|
87
|
+
- **媒体文件 404**:`resolveReadable` 用**图片的 64 MB 上限**卡音视频,
|
|
88
|
+
127 MB 视频被判「不可读」→ 前端收到 404,「打开所在文件夹」点了没反应。
|
|
89
|
+
修法:`resolveReadable` 加 `byteCap` 参数,媒体传 `maxMediaBytes`(200 MB)。
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## [0.10.5] - 2026-11-08
|
|
94
|
+
|
|
95
|
+
### 修复
|
|
96
|
+
|
|
97
|
+
- **「打开所在文件夹」点了没反应**:`spawn('explorer.exe', ['/select,<中文路径>'])`
|
|
98
|
+
对**含中文的路径**会静默以退出码 1 失败。实测对比确认后改用
|
|
99
|
+
`cmd /c start "" explorer.exe /select,"<path>"`,退出码 0,正常。
|
|
100
|
+
- 客户端把失败原因**显示出来**(以前是 `.catch(e => console.error(...))` 静默吞掉)。
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## [0.10.4] - 2026-11-08
|
|
105
|
+
|
|
106
|
+
### 新增 / 修复
|
|
107
|
+
|
|
108
|
+
- 大文件提示加「📂 打开所在文件夹」按钮(与「▶ 用系统播放器打开」并列)。
|
|
109
|
+
- 修按钮显示为灰色不可点:原来的 `dg-btn` / `dg-primaryBtn` 在媒体弹层里
|
|
110
|
+
没有对应样式,改成独立定义的 `.dg-mediaActBtn` / `.dg-mediaActPrimary`。
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## [0.10.3] - 2026-11-08
|
|
115
|
+
|
|
116
|
+
### 修复 / 新增
|
|
117
|
+
|
|
118
|
+
- **播放器「浏览器无法解码该格式」**:GET 路由**缺 HEAD 方法** ——
|
|
119
|
+
浏览器加载媒体前会先发 HEAD 探测,只给 GET 就被判为不可解码。
|
|
120
|
+
同时补 `requestBody: 'buffered'`(与官方 `/api/file` 一致)。
|
|
121
|
+
- **Blob 分档播放**:≤60 MB 完整载入内存(能拖进度条),>60 MB 引导外部打开。
|
|
122
|
+
- **截取当前帧**:播放时一键把当前画面存成 PNG,文件名带时间码。
|
|
123
|
+
- 文件名高对比显示(原来用了未定义的 CSS 变量,显示很暗像没渲染)。
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
5
127
|
## [0.10.2] - 2026-11-08
|
|
6
128
|
|
|
7
129
|
**主题:修 v0.10.1 音视频画廊的两个渲染 bug。**
|
package/README.md
CHANGED
|
@@ -6,9 +6,14 @@
|
|
|
6
6
|
>
|
|
7
7
|
> 这个插件把产出目录变成右侧栏里的**实时画廊**:图片生成就可见、文件点开就预览、
|
|
8
8
|
> 视频音频能在面板里直接播放并拖进度条,
|
|
9
|
-
>
|
|
9
|
+
> **让你在任务进行中就能看到产出、当场校验,而不是结束后才发现做错了。**
|
|
10
|
+
>
|
|
11
|
+
> ⚠️ **能力边界**:目前能做的是**看见 + 判断 + 处置**
|
|
12
|
+
> (隐藏 / 删除 / 定位 / 预览 / 截帧);
|
|
13
|
+
> **把「这张是定稿」的结论回传给主线任务,还没有做**(见路线图)。
|
|
14
|
+
> 「实时看见」已经能用;「回传干预」是下一步。
|
|
10
15
|
|
|
11
|
-
[](#)
|
|
12
17
|
[](LICENSE)
|
|
13
18
|
[](#技术说明给想改代码的人)
|
|
14
19
|
[](#兼容性)
|
|
@@ -90,13 +95,15 @@
|
|
|
90
95
|
|---|---|
|
|
91
96
|
| 点整张卡片 | 在面板内弹出播放器 |
|
|
92
97
|
| 视频卡片 | 显示**首帧缩略图**(进入视口才抽帧,避免一次解码几十个视频) |
|
|
93
|
-
|
|
|
98
|
+
| **拖进度条** | ✅ **任意大小的文件都能拖** —— 宿主用 HTTP Range(206)分片下发 |
|
|
99
|
+
| **边下边播** | ✅ 不预先载入整个文件,点开几乎立即开始 |
|
|
94
100
|
| 播放器里「📷 截取当前帧」 | 把当前画面存成 PNG,文件名带时间码(如 `片子_00-12-34.png`) |
|
|
95
|
-
|
|
|
101
|
+
| 浏览器解不了格式 | 显示提示 +「▶ 用系统播放器打开」/「📂 打开所在文件夹」两个按钮 |
|
|
96
102
|
|
|
97
|
-
>
|
|
98
|
-
>
|
|
99
|
-
>
|
|
103
|
+
> **技术说明**:媒体路由用 `ctx.webServer.register` 注册(Node 原生 `req`/`res`),
|
|
104
|
+
> 支持 `Range: bytes=...` 的常规区间、开放区间、后缀区间,以及 416 不可满足。
|
|
105
|
+
> 这样浏览器才能边下边播、任意 seek,**127 MB 的视频也能在面板里直接拖动查看**,
|
|
106
|
+
> 内存占用与文件大小无关(流式下发)。
|
|
100
107
|
>
|
|
101
108
|
> 体积上限默认 200 MB,可用 `maxMediaBytes` 调整。
|
|
102
109
|
|
|
@@ -201,9 +208,12 @@ github:Hope2023Dcr/dsh-gallery
|
|
|
201
208
|
> 想锁定版本(推荐,避免仓库更新导致行为变化):
|
|
202
209
|
>
|
|
203
210
|
> ```
|
|
204
|
-
> git+https://github.com/Hope2023Dcr/dsh-gallery.git#
|
|
211
|
+
> git+https://github.com/Hope2023Dcr/dsh-gallery.git#a0dfb00b12a4972a0cc4ca50888f451cec0e3c5f
|
|
205
212
|
> ```
|
|
206
213
|
|
|
214
|
+
> 上面那个 commit 对应 **v0.11.0**(含音视频画廊、HTTP Range 播放、三栏分类)。
|
|
215
|
+
> **更推荐直接用 npm**(`npm i dsh-gallery`)—— 版本号跟着 `latest` 走,不用每次手工核对哈希。
|
|
216
|
+
|
|
207
217
|
> ⚠️ 这种方式需要**能访问 GitHub**。DSH 的「国内镜像」只代理 npm 包,不代替 GitHub 下载。
|
|
208
218
|
|
|
209
219
|
### 方式一:一键脚本(推荐,可离线)
|
|
@@ -344,10 +354,26 @@ config:
|
|
|
344
354
|
| **不执行任何文件** | 不运行脚本、不打开可执行文件、不解压压缩包。唯一的 `spawn` 是调起资源管理器定位(`explorer.exe /select`) |
|
|
345
355
|
| **删除操作** | 三层保护:前端二次确认 → API 强制 `confirm: true` → 路径越界校验(`isInside(root)`) |
|
|
346
356
|
| **路径穿越防护** | 所有文件操作都经 `isInside(root, absolute)` 校验,只允许在扫描目录内 |
|
|
347
|
-
| **HTTP 路由** |
|
|
357
|
+
| **HTTP 路由** | `POST /api/dsh-gallery`(走 DSH `/api` 网关,需认证)负责列表与操作;另有**一条独立 `GET/HEAD` 媒体路由**专供 `<video>`/`<audio>`(详见下方「媒体路由的安全边界」) |
|
|
348
358
|
|
|
349
359
|
**删文件是唯一不可逆操作**,所以做了三层保护;隐藏只是从列表移除,文件不动。
|
|
350
360
|
|
|
361
|
+
#### 媒体路由的安全边界
|
|
362
|
+
|
|
363
|
+
音视频播放需要浏览器能直接 `GET` 一个 URL(`<video src>` 无法发 POST),
|
|
364
|
+
所以 **v0.11.0 新增了一条独立的媒体路由**。它**不属于 `/api` 网关、不经过 DSH 的网关认证**,
|
|
365
|
+
因此该路由自己做了三道防护:
|
|
366
|
+
|
|
367
|
+
| 防护 | 做法 | 不做的后果 |
|
|
368
|
+
|---|---|---|
|
|
369
|
+
| **① 只读** | 只接受 `GET` / `HEAD`,其余 405 | 可被当作写入跳板 |
|
|
370
|
+
| **② 跨站拒绝** | `Sec-Fetch-Site: cross-site` 或 `Origin` 与 `Host` 不匹配 → 403 | 任意网页都能盗读本机产出 |
|
|
371
|
+
| **③ 路径白名单** | 解析后必须落在扫描的 `roots` 内(`isInside`),`..` 无法越界 | 能读磁盘任意文件 |
|
|
372
|
+
| 附带 | `X-Content-Type-Options: nosniff` | 浏览器可能把内容当 HTML 执行 |
|
|
373
|
+
|
|
374
|
+
> 这三道是**必需的**,因为路由绕过了网关认证。若在代码里看到这条路由却没有校验,
|
|
375
|
+
> 那是缺陷不是设计。
|
|
376
|
+
|
|
351
377
|
---
|
|
352
378
|
|
|
353
379
|
## 隐私
|
package/client.js
CHANGED
|
@@ -19,8 +19,7 @@ window.__ModuleLoader__.load({
|
|
|
19
19
|
const IMAGE_EXTS = ['.png', '.jpg', '.jpeg', '.webp', '.gif', '.bmp']
|
|
20
20
|
/** 视频扩展名(客户端判断 mediaType 兜底用,与 Host 的 VIDEO_EXTS 保持一致)。 */
|
|
21
21
|
const VIDEO_EXTS_CLIENT = new Set(['.mp4', '.webm', '.mov', '.m4v', '.mkv', '.avi', '.ogv'])
|
|
22
|
-
|
|
23
|
-
const BLOB_MAX_BYTES = 60 * 1024 * 1024
|
|
22
|
+
// v0.11.0:媒体走真 Range,不再需要 blob 上限
|
|
24
23
|
/** 判断某条目是否是图片(大小写不敏感)。 */
|
|
25
24
|
function isImageItem(it) {
|
|
26
25
|
const ext = String(it?.extension ?? '').toLowerCase()
|
|
@@ -1882,53 +1881,25 @@ window.__ModuleLoader__.load({
|
|
|
1882
1881
|
*
|
|
1883
1882
|
* 这样「能播 + 能拖」在常规大小的产出上都成立,超大文件也不至于把面板搞崩。
|
|
1884
1883
|
*/
|
|
1884
|
+
/**
|
|
1885
|
+
* 面板内媒体播放器(v0.11.0:真 Range)。
|
|
1886
|
+
*
|
|
1887
|
+
* Host 侧现在用 ctx.webServer.register 注册了支持 206 的路由,
|
|
1888
|
+
* 所以 <video src=URL> 直接就能:
|
|
1889
|
+
* - 拖进度条(浏览器发 Range,宿主按 206 分片回)
|
|
1890
|
+
* - 边下边播(不预先载入整个文件)
|
|
1891
|
+
* - 内存占用恒定(流式,不占文件大小的内存)
|
|
1892
|
+
*
|
|
1893
|
+
* 因此不再需要 blob 方案,也不再需要 60MB 分档 —— 任意大小都能播。
|
|
1894
|
+
*/
|
|
1885
1895
|
function MediaPlayer({ item, t, onClose }) {
|
|
1886
1896
|
const isVideo = item.mediaType === 'video'
|
|
1887
|
-
const
|
|
1888
|
-
// blob 状态:loading / ready / failed
|
|
1889
|
-
const [blobState, setBlobState] = React.useState({ status: tooBig ? 'too-big' : 'loading' })
|
|
1897
|
+
const videoRef = React.useRef(null)
|
|
1890
1898
|
const [failed, setFailed] = React.useState(false)
|
|
1891
1899
|
const [dims, setDims] = React.useState(null)
|
|
1892
|
-
|
|
1893
|
-
const videoRef = React.useRef(null)
|
|
1894
|
-
// 截帧结果提示(成功/失败),2 秒后自动消失
|
|
1900
|
+
// 截帧结果提示(成功/失败),2.5 秒自动消失
|
|
1895
1901
|
const [grabNotice, setGrabNotice] = React.useState(null)
|
|
1896
|
-
|
|
1897
|
-
// 加载完整文件成 blob(≤ 60MB 才做)
|
|
1898
|
-
React.useEffect(() => {
|
|
1899
|
-
if (tooBig) return undefined
|
|
1900
|
-
let alive = true
|
|
1901
|
-
const controller = new AbortController()
|
|
1902
|
-
|
|
1903
|
-
fetchRaw(item.relPath, controller.signal, (loaded, total) => {
|
|
1904
|
-
if (!alive || tooBig) return
|
|
1905
|
-
const pct = total > 0 ? Math.round((loaded / total) * 100) : -1
|
|
1906
|
-
setBlobState((cur) => (cur.status === 'loading' ? { status: 'loading', pct } : cur))
|
|
1907
|
-
})
|
|
1908
|
-
.then((blob) => {
|
|
1909
|
-
if (!alive) return
|
|
1910
|
-
const url = URL.createObjectURL(blob)
|
|
1911
|
-
blobUrlRef.current = url
|
|
1912
|
-
setBlobState({ status: 'ready', url, bytes: blob.size })
|
|
1913
|
-
})
|
|
1914
|
-
.catch((error) => {
|
|
1915
|
-
if (!alive || controller.signal.aborted) return
|
|
1916
|
-
setBlobState({ status: 'failed', message: String(error?.message ?? error) })
|
|
1917
|
-
})
|
|
1918
|
-
|
|
1919
|
-
return () => {
|
|
1920
|
-
alive = false
|
|
1921
|
-
controller.abort()
|
|
1922
|
-
}
|
|
1923
|
-
}, [item.relPath, tooBig])
|
|
1924
|
-
|
|
1925
|
-
// 卸载时释放 blob URL(不释放会一直占内存)
|
|
1926
|
-
React.useEffect(() => () => {
|
|
1927
|
-
if (blobUrlRef.current !== null) {
|
|
1928
|
-
URL.revokeObjectURL(blobUrlRef.current)
|
|
1929
|
-
blobUrlRef.current = null
|
|
1930
|
-
}
|
|
1931
|
-
}, [])
|
|
1902
|
+
const url = mediaUrlOf(item.relPath, item.mtime)
|
|
1932
1903
|
|
|
1933
1904
|
React.useEffect(() => {
|
|
1934
1905
|
const onKey = (event) => {
|
|
@@ -1941,25 +1912,14 @@ window.__ModuleLoader__.load({
|
|
|
1941
1912
|
return () => window.removeEventListener('keydown', onKey)
|
|
1942
1913
|
}, [onClose])
|
|
1943
1914
|
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
* play → cmd start,用文件关联的默认程序打开(媒体文件能直接播)
|
|
1948
|
-
* select → explorer /select,在资源管理器里选中该文件
|
|
1949
|
-
*
|
|
1950
|
-
* 关键:以前是 .catch(e => console.error(...)) 静默吞错,
|
|
1951
|
-
* 用户只看到按钮有动画、什么都没发生。现在把失败原因显示出来。
|
|
1952
|
-
*/
|
|
1953
|
-
const runReveal = React.useCallback((mode) => {
|
|
1954
|
-
setGrabNotice({ kind: 'pending', text: mode === 'play' ? '正在打开…' : '正在定位…' })
|
|
1955
|
-
void callHost('reveal', { path: item.relPath, mode }).then((resp) => {
|
|
1915
|
+
const openExternal = React.useCallback(() => {
|
|
1916
|
+
setGrabNotice({ kind: 'pending', text: '正在打开…' })
|
|
1917
|
+
void callHost('reveal', { path: item.relPath, mode: 'play' }).then((resp) => {
|
|
1956
1918
|
if (resp !== null && resp.ok === false) {
|
|
1957
|
-
const msg = resp.error?.message ?? 'unknown'
|
|
1958
1919
|
setGrabNotice({
|
|
1959
1920
|
kind: 'failed',
|
|
1960
|
-
text: format(t('mediaOpenFailed'), { message:
|
|
1921
|
+
text: format(t('mediaOpenFailed'), { message: resp.error?.code ?? 'unknown' }),
|
|
1961
1922
|
})
|
|
1962
|
-
console.warn('dsh-gallery: reveal 失败', resp)
|
|
1963
1923
|
return
|
|
1964
1924
|
}
|
|
1965
1925
|
setGrabNotice({ kind: 'ok', text: t('mediaOpenOk') })
|
|
@@ -1968,17 +1928,32 @@ window.__ModuleLoader__.load({
|
|
|
1968
1928
|
kind: 'failed',
|
|
1969
1929
|
text: format(t('mediaOpenFailed'), { message: String(error?.message ?? error) }),
|
|
1970
1930
|
})
|
|
1971
|
-
console.error('dsh-gallery: reveal 请求失败', error)
|
|
1972
1931
|
})
|
|
1973
1932
|
}, [item.relPath, t])
|
|
1974
1933
|
|
|
1975
|
-
const
|
|
1976
|
-
|
|
1934
|
+
const openFolder = React.useCallback(() => {
|
|
1935
|
+
setGrabNotice({ kind: 'pending', text: '正在定位…' })
|
|
1936
|
+
void callHost('reveal', { path: item.relPath, mode: 'select' }).then((resp) => {
|
|
1937
|
+
if (resp !== null && resp.ok === false) {
|
|
1938
|
+
setGrabNotice({
|
|
1939
|
+
kind: 'failed',
|
|
1940
|
+
text: format(t('mediaOpenFailed'), { message: resp.error?.code ?? 'unknown' }),
|
|
1941
|
+
})
|
|
1942
|
+
return
|
|
1943
|
+
}
|
|
1944
|
+
setGrabNotice({ kind: 'ok', text: t('mediaOpenOk') })
|
|
1945
|
+
}).catch((error) => {
|
|
1946
|
+
setGrabNotice({
|
|
1947
|
+
kind: 'failed',
|
|
1948
|
+
text: format(t('mediaOpenFailed'), { message: String(error?.message ?? error) }),
|
|
1949
|
+
})
|
|
1950
|
+
})
|
|
1951
|
+
}, [item.relPath, t])
|
|
1977
1952
|
|
|
1978
1953
|
/**
|
|
1979
1954
|
* 截取当前帧存成 PNG。
|
|
1980
|
-
*
|
|
1981
|
-
*
|
|
1955
|
+
* 同一来源(同协议同端口)才能 canvas toBlob,否则 canvas 被 taint。
|
|
1956
|
+
* 我们的媒体路由与页面同源,所以可用。
|
|
1982
1957
|
*/
|
|
1983
1958
|
const grabFrame = React.useCallback(() => {
|
|
1984
1959
|
const v = videoRef.current
|
|
@@ -1997,7 +1972,6 @@ window.__ModuleLoader__.load({
|
|
|
1997
1972
|
if (c2d === null) throw new Error('no 2d context')
|
|
1998
1973
|
c2d.drawImage(v, 0, 0, w, h)
|
|
1999
1974
|
|
|
2000
|
-
// 时间码:00-12-34
|
|
2001
1975
|
const sec = Math.floor(v.currentTime || 0)
|
|
2002
1976
|
const hh = String(Math.floor(sec / 3600)).padStart(2, '0')
|
|
2003
1977
|
const mm = String(Math.floor((sec % 3600) / 60)).padStart(2, '0')
|
|
@@ -2007,18 +1981,17 @@ window.__ModuleLoader__.load({
|
|
|
2007
1981
|
|
|
2008
1982
|
canvas.toBlob((blob) => {
|
|
2009
1983
|
if (blob === null) {
|
|
2010
|
-
setGrabNotice({ kind: 'failed', text: format(t('mediaGrabFrameFailed'), { message: 'toBlob
|
|
1984
|
+
setGrabNotice({ kind: 'failed', text: format(t('mediaGrabFrameFailed'), { message: 'toBlob null' }) })
|
|
2011
1985
|
return
|
|
2012
1986
|
}
|
|
2013
|
-
const
|
|
1987
|
+
const u = URL.createObjectURL(blob)
|
|
2014
1988
|
const a = document.createElement('a')
|
|
2015
|
-
a.href =
|
|
1989
|
+
a.href = u
|
|
2016
1990
|
a.download = fname
|
|
2017
1991
|
document.body.appendChild(a)
|
|
2018
1992
|
a.click()
|
|
2019
1993
|
document.body.removeChild(a)
|
|
2020
|
-
|
|
2021
|
-
setTimeout(() => URL.revokeObjectURL(url), 1000)
|
|
1994
|
+
setTimeout(() => URL.revokeObjectURL(u), 1000)
|
|
2022
1995
|
setGrabNotice({ kind: 'ok', text: format(t('mediaGrabFrameOk'), { name: fname }) })
|
|
2023
1996
|
}, 'image/png')
|
|
2024
1997
|
} catch (error) {
|
|
@@ -2026,15 +1999,12 @@ window.__ModuleLoader__.load({
|
|
|
2026
1999
|
}
|
|
2027
2000
|
}, [item.name, t])
|
|
2028
2001
|
|
|
2029
|
-
// 提示 2.5 秒后自动消失
|
|
2030
2002
|
React.useEffect(() => {
|
|
2031
2003
|
if (grabNotice === null) return undefined
|
|
2032
2004
|
const timer = setTimeout(() => setGrabNotice(null), 2500)
|
|
2033
2005
|
return () => clearTimeout(timer)
|
|
2034
2006
|
}, [grabNotice])
|
|
2035
2007
|
|
|
2036
|
-
const ready = blobState.status === 'ready'
|
|
2037
|
-
|
|
2038
2008
|
return h('div', {
|
|
2039
2009
|
className: 'dg-mediaLayer',
|
|
2040
2010
|
key: 'mediaLayer',
|
|
@@ -2047,8 +2017,7 @@ window.__ModuleLoader__.load({
|
|
|
2047
2017
|
}, [
|
|
2048
2018
|
h('div', { className: 'dg-mediaBar', key: 'bar' }, [
|
|
2049
2019
|
h('span', { className: 'dg-mediaPTitle', key: 'title', title: item.relPath }, item.name),
|
|
2050
|
-
|
|
2051
|
-
isVideo && ready
|
|
2020
|
+
isVideo && !failed
|
|
2052
2021
|
? h('button', {
|
|
2053
2022
|
type: 'button',
|
|
2054
2023
|
className: 'dg-btn dg-mediaGrabBtn',
|
|
@@ -2067,97 +2036,55 @@ window.__ModuleLoader__.load({
|
|
|
2067
2036
|
]),
|
|
2068
2037
|
h('div', { className: 'dg-mediaStage', key: 'stage' }, (
|
|
2069
2038
|
failed
|
|
2070
|
-
? h('div', { className: 'dg-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
h('
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
h('div', { className: 'dg-mediaTooBigIco', key: 'ico' }, '⚠'),
|
|
2112
|
-
h('div', { className: 'dg-mediaTooBigTitle', key: 't1' }, t('mediaLoadFailed')),
|
|
2113
|
-
h('div', { className: 'dg-mediaTooBigHint', key: 't2' }, blobState.message ?? ''),
|
|
2114
|
-
h('div', { className: 'dg-mediaActionRow', key: 'actions' }, [
|
|
2115
|
-
h('button', {
|
|
2116
|
-
type: 'button', className: 'dg-mediaActBtn dg-mediaActPrimary', key: 'ext',
|
|
2117
|
-
'data-gallery-open-external': item.relPath,
|
|
2118
|
-
onClick: (event) => { event.stopPropagation(); openExternal() },
|
|
2119
|
-
}, ['▶ ', t('mediaOpenExternal')]),
|
|
2120
|
-
h('button', {
|
|
2121
|
-
type: 'button', className: 'dg-mediaActBtn', key: 'folder',
|
|
2122
|
-
'data-gallery-open-folder': item.relPath,
|
|
2123
|
-
onClick: (event) => { event.stopPropagation(); openFolder() },
|
|
2124
|
-
}, ['📂 ', t('mediaOpenFolder')]),
|
|
2125
|
-
]),
|
|
2126
|
-
])
|
|
2127
|
-
: isVideo
|
|
2128
|
-
? h('video', {
|
|
2129
|
-
ref: videoRef,
|
|
2130
|
-
src: blobState.url,
|
|
2131
|
-
controls: true,
|
|
2132
|
-
autoPlay: true,
|
|
2133
|
-
preload: 'auto',
|
|
2134
|
-
key: 'v',
|
|
2135
|
-
'data-gallery-video': item.relPath,
|
|
2136
|
-
onError: () => setFailed(true),
|
|
2137
|
-
onLoadedMetadata: (event) => {
|
|
2138
|
-
const v = event.currentTarget
|
|
2139
|
-
if (v.videoWidth > 0) setDims({ w: v.videoWidth, h: v.videoHeight })
|
|
2140
|
-
},
|
|
2141
|
-
})
|
|
2142
|
-
: h('audio', {
|
|
2143
|
-
src: blobState.url,
|
|
2144
|
-
controls: true,
|
|
2145
|
-
autoPlay: true,
|
|
2146
|
-
preload: 'auto',
|
|
2147
|
-
key: 'a',
|
|
2148
|
-
'data-gallery-audio': item.relPath,
|
|
2149
|
-
onError: () => setFailed(true),
|
|
2150
|
-
})
|
|
2039
|
+
? h('div', { className: 'dg-mediaTooBig', key: 'fail' }, [
|
|
2040
|
+
h('div', { className: 'dg-mediaTooBigIco', key: 'ico' }, '⚠'),
|
|
2041
|
+
h('div', { className: 'dg-mediaTooBigTitle', key: 't1' }, t('mediaNoPreview')),
|
|
2042
|
+
h('div', { className: 'dg-mediaTooBigHint', key: 't2' }, t('mediaBinaryHint')),
|
|
2043
|
+
h('div', { className: 'dg-mediaActionRow', key: 'actions' }, [
|
|
2044
|
+
h('button', {
|
|
2045
|
+
type: 'button', className: 'dg-mediaActBtn dg-mediaActPrimary', key: 'ext',
|
|
2046
|
+
'data-gallery-open-external': item.relPath,
|
|
2047
|
+
onClick: (event) => { event.stopPropagation(); openExternal() },
|
|
2048
|
+
}, ['▶ ', t('mediaOpenExternal')]),
|
|
2049
|
+
h('button', {
|
|
2050
|
+
type: 'button', className: 'dg-mediaActBtn', key: 'folder',
|
|
2051
|
+
'data-gallery-open-folder': item.relPath,
|
|
2052
|
+
onClick: (event) => { event.stopPropagation(); openFolder() },
|
|
2053
|
+
}, ['📂 ', t('mediaOpenFolder')]),
|
|
2054
|
+
]),
|
|
2055
|
+
])
|
|
2056
|
+
: isVideo
|
|
2057
|
+
? h('video', {
|
|
2058
|
+
ref: videoRef,
|
|
2059
|
+
src: url,
|
|
2060
|
+
controls: true,
|
|
2061
|
+
autoPlay: true,
|
|
2062
|
+
preload: 'metadata',
|
|
2063
|
+
key: 'v',
|
|
2064
|
+
'data-gallery-video': item.relPath,
|
|
2065
|
+
onError: () => setFailed(true),
|
|
2066
|
+
onLoadedMetadata: (event) => {
|
|
2067
|
+
const v = event.currentTarget
|
|
2068
|
+
if (v.videoWidth > 0) setDims({ w: v.videoWidth, h: v.videoHeight })
|
|
2069
|
+
},
|
|
2070
|
+
})
|
|
2071
|
+
: h('audio', {
|
|
2072
|
+
src: url,
|
|
2073
|
+
controls: true,
|
|
2074
|
+
autoPlay: true,
|
|
2075
|
+
preload: 'metadata',
|
|
2076
|
+
key: 'a',
|
|
2077
|
+
'data-gallery-audio': item.relPath,
|
|
2078
|
+
onError: () => setFailed(true),
|
|
2079
|
+
})
|
|
2151
2080
|
)),
|
|
2152
|
-
// 底栏:文件名 + 大小 + 时间(+ 视频尺寸)
|
|
2153
2081
|
h('div', { className: 'dg-mediaFoot', key: 'foot' }, [
|
|
2154
2082
|
h('span', { className: 'dg-mediaFootName', key: 'name', title: item.relPath }, item.name),
|
|
2155
2083
|
h('span', { className: 'dg-mediaFootMeta', key: 'meta' },
|
|
2156
2084
|
`${formatBytes(item.size)} · ${formatTime(item.mtime)}`
|
|
2157
2085
|
+ (dims !== null ? ` · ${dims.w} × ${dims.h}` : '')
|
|
2158
|
-
+
|
|
2086
|
+
+ ' · 可拖动进度条'),
|
|
2159
2087
|
]),
|
|
2160
|
-
// 截帧结果提示(成功绿、失败红),2.5 秒自动消失
|
|
2161
2088
|
grabNotice === null
|
|
2162
2089
|
? null
|
|
2163
2090
|
: h('div', {
|
package/index.js
CHANGED
|
@@ -1327,6 +1327,74 @@ async function resolveReadable(roots, relPath, opts, byteCap) {
|
|
|
1327
1327
|
return null
|
|
1328
1328
|
}
|
|
1329
1329
|
|
|
1330
|
+
/**
|
|
1331
|
+
* 解析 `Range: bytes=...` 头。
|
|
1332
|
+
* 支持:常规 (0-99)、开放 (100-)、后缀 (-50)、不可满足 (416)。
|
|
1333
|
+
* 多区间取第一个(HTTP 规范允许)。
|
|
1334
|
+
*/
|
|
1335
|
+
function parseMediaRange(raw, size) {
|
|
1336
|
+
if (raw === undefined) return null
|
|
1337
|
+
const m = /^bytes=(.+)$/i.exec(String(raw).trim())
|
|
1338
|
+
if (!m) return null
|
|
1339
|
+
const spec = m[1].split(',')[0].trim()
|
|
1340
|
+
if (spec === '') return null
|
|
1341
|
+
if (spec.startsWith('-')) {
|
|
1342
|
+
const suffix = Number(spec.slice(1))
|
|
1343
|
+
if (!Number.isFinite(suffix) || suffix <= 0) return null
|
|
1344
|
+
if (suffix >= size) return { start: 0, end: size - 1 }
|
|
1345
|
+
return { start: size - suffix, end: size - 1 }
|
|
1346
|
+
}
|
|
1347
|
+
const dash = spec.indexOf('-')
|
|
1348
|
+
if (dash === -1) return null
|
|
1349
|
+
const startText = spec.slice(0, dash)
|
|
1350
|
+
const endText = spec.slice(dash + 1)
|
|
1351
|
+
const start = startText === '' ? 0 : Number(startText)
|
|
1352
|
+
const end = endText === '' ? size - 1 : Number(endText)
|
|
1353
|
+
if (!Number.isInteger(start) || start < 0 || !Number.isInteger(end)) return null
|
|
1354
|
+
if (start >= size) return { unsatisfiable: true }
|
|
1355
|
+
return { start, end: Math.min(end, size - 1) }
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* 用 Node 原生 res 输出一个媒体文件,支持 HTTP Range。
|
|
1360
|
+
* 这是 206 能工作的关键:req/res 直写,不经过 DSH 的 fetch 网关。
|
|
1361
|
+
*/
|
|
1362
|
+
function serveMedia(req, res, filePath, size, type) {
|
|
1363
|
+
const headers = {
|
|
1364
|
+
'content-type': type,
|
|
1365
|
+
'accept-ranges': 'bytes',
|
|
1366
|
+
'cache-control': 'no-cache',
|
|
1367
|
+
'x-content-type-options': 'nosniff',
|
|
1368
|
+
}
|
|
1369
|
+
const range = parseMediaRange(req.headers.range, size)
|
|
1370
|
+
|
|
1371
|
+
if (range !== null && range.unsatisfiable === true) {
|
|
1372
|
+
res.writeHead(416, { ...headers, 'content-range': `bytes */${size}` })
|
|
1373
|
+
res.end()
|
|
1374
|
+
return
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
if (range !== null) {
|
|
1378
|
+
const { start, end } = range
|
|
1379
|
+
res.writeHead(206, {
|
|
1380
|
+
...headers,
|
|
1381
|
+
'content-range': `bytes ${start}-${end}/${size}`,
|
|
1382
|
+
'content-length': String(end - start + 1),
|
|
1383
|
+
})
|
|
1384
|
+
if (req.method === 'HEAD') { res.end(); return }
|
|
1385
|
+
const stream = createReadStream(filePath, { start, end })
|
|
1386
|
+
stream.on('error', () => res.destroy())
|
|
1387
|
+
stream.pipe(res)
|
|
1388
|
+
return
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
res.writeHead(200, { ...headers, 'content-length': String(size) })
|
|
1392
|
+
if (req.method === 'HEAD') { res.end(); return }
|
|
1393
|
+
const stream = createReadStream(filePath)
|
|
1394
|
+
stream.on('error', () => res.destroy())
|
|
1395
|
+
stream.pipe(res)
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1330
1398
|
function contentTypeFor(ext) {
|
|
1331
1399
|
if (ext === '.png') return 'image/png'
|
|
1332
1400
|
if (ext === '.jpg' || ext === '.jpeg') return 'image/jpeg'
|
|
@@ -1359,7 +1427,7 @@ function json(body, status) {
|
|
|
1359
1427
|
/**
|
|
1360
1428
|
* Host 插件入口。仅依赖 connection(exact Fetch 路由);缺失时插件不激活而不是抛错。
|
|
1361
1429
|
*/
|
|
1362
|
-
export const inject = ['connection']
|
|
1430
|
+
export const inject = ['connection', 'webServer']
|
|
1363
1431
|
|
|
1364
1432
|
export function apply(ctx, config) {
|
|
1365
1433
|
/**
|
|
@@ -1368,69 +1436,87 @@ export function apply(ctx, config) {
|
|
|
1368
1436
|
* POST 路由不行(媒体元素不会发 POST),所以这里单独注册一个 GET 路径。
|
|
1369
1437
|
* 支持 Range,浏览器才能拖进度条、边播边下。
|
|
1370
1438
|
*/
|
|
1439
|
+
/**
|
|
1440
|
+
* 媒体直链(v0.11.0):用 ctx.webServer.register 注册 Node 原生路由。
|
|
1441
|
+
*
|
|
1442
|
+
* 为什么从 connection.fetch 换成 webServer?
|
|
1443
|
+
* - fetch 那套是 Web Fetch API(Request/Response),DSH 的网关层不透传 206,
|
|
1444
|
+
* <video src> 拿不到 Range,进度条拖不动(实测确认)。
|
|
1445
|
+
* - webServer 给的是 Node 原生 (req, res),可以 res.writeHead(206) + createReadStream,
|
|
1446
|
+
* 真正的分片流式下发。探针已实证:HEAD 200 / Range 206 / 中段 206 / 后缀 206 全部通过。
|
|
1447
|
+
*
|
|
1448
|
+
* 安全(三道防护,缺一不可):
|
|
1449
|
+
* 1. 路径必须落在扫描 roots 白名单内(isInside)—— 否则能读任意文件
|
|
1450
|
+
* 2. 跨站请求拒绝(sec-fetch-site / origin)
|
|
1451
|
+
* 3. 只允许 GET / HEAD
|
|
1452
|
+
*/
|
|
1371
1453
|
ctx.effect(
|
|
1372
|
-
() =>
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
//
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
relPath = ''
|
|
1454
|
+
() => ctx.webServer.register({
|
|
1455
|
+
kind: 'prefix',
|
|
1456
|
+
path: MEDIA_ROUTE,
|
|
1457
|
+
handler: async (req, res) => {
|
|
1458
|
+
// ---- 防护 3:只读 ----
|
|
1459
|
+
if (req.method !== 'GET' && req.method !== 'HEAD') {
|
|
1460
|
+
res.writeHead(405, { 'content-type': 'text/plain; charset=utf-8' })
|
|
1461
|
+
res.end('method not allowed')
|
|
1462
|
+
return
|
|
1463
|
+
}
|
|
1464
|
+
// ---- 防护 2:拒绝跨站 ----
|
|
1465
|
+
const site = req.headers['sec-fetch-site']
|
|
1466
|
+
if (typeof site === 'string' && site === 'cross-site') {
|
|
1467
|
+
res.writeHead(403, { 'content-type': 'text/plain; charset=utf-8' })
|
|
1468
|
+
res.end('cross-site request refused')
|
|
1469
|
+
return
|
|
1470
|
+
}
|
|
1471
|
+
const origin = req.headers.origin
|
|
1472
|
+
if (typeof origin === 'string' && origin !== '') {
|
|
1473
|
+
let originHost = ''
|
|
1474
|
+
try { originHost = new URL(origin).host } catch { originHost = '' }
|
|
1475
|
+
const host = req.headers.host
|
|
1476
|
+
if (originHost !== '' && typeof host === 'string' && originHost !== host) {
|
|
1477
|
+
res.writeHead(403, { 'content-type': 'text/plain; charset=utf-8' })
|
|
1478
|
+
res.end('origin mismatch')
|
|
1479
|
+
return
|
|
1399
1480
|
}
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
try {
|
|
1484
|
+
const url = new URL(req.url ?? '/', 'http://dsh.internal')
|
|
1485
|
+
const relPath = url.searchParams.get('path') ?? ''
|
|
1400
1486
|
if (relPath === '') {
|
|
1401
|
-
|
|
1487
|
+
res.writeHead(400, { 'content-type': 'text/plain; charset=utf-8' })
|
|
1488
|
+
res.end('missing path')
|
|
1489
|
+
return
|
|
1402
1490
|
}
|
|
1403
|
-
|
|
1491
|
+
const resolved = resolveOptions(config)
|
|
1492
|
+
// ---- 防护 1:路径白名单 ----
|
|
1404
1493
|
const found = await resolveReadable(resolved.roots, relPath, resolved, resolved.maxMediaBytes)
|
|
1405
1494
|
if (found === null) {
|
|
1406
|
-
|
|
1495
|
+
res.writeHead(404, { 'content-type': 'text/plain; charset=utf-8' })
|
|
1496
|
+
res.end('not found')
|
|
1497
|
+
return
|
|
1407
1498
|
}
|
|
1408
1499
|
let stat
|
|
1409
1500
|
try {
|
|
1410
1501
|
stat = await fsp.stat(found.absolute)
|
|
1411
1502
|
} catch (error) {
|
|
1412
|
-
|
|
1503
|
+
res.writeHead(500, { 'content-type': 'text/plain; charset=utf-8' })
|
|
1504
|
+
res.end(String(error?.message ?? error))
|
|
1505
|
+
return
|
|
1413
1506
|
}
|
|
1414
1507
|
const type = contentTypeFor(path.extname(found.absolute).toLowerCase())
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
'content-type':
|
|
1419
|
-
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
return new Response(null, { status: 200, headers })
|
|
1423
|
-
}
|
|
1424
|
-
// 流式返回:createReadStream → Readable.toWeb,内存占用与文件大小无关
|
|
1425
|
-
try {
|
|
1426
|
-
const stream = createReadStream(found.absolute)
|
|
1427
|
-
return new Response(Readable.toWeb(stream), { status: 200, headers })
|
|
1428
|
-
} catch (error) {
|
|
1429
|
-
return new Response(String(error?.message ?? error), { status: 500, headers: baseHeaders })
|
|
1508
|
+
serveMedia(req, res, found.absolute, stat.size, type)
|
|
1509
|
+
} catch (error) {
|
|
1510
|
+
if (!res.headersSent) {
|
|
1511
|
+
res.writeHead(500, { 'content-type': 'text/plain; charset=utf-8' })
|
|
1512
|
+
res.end(String(error?.message ?? error))
|
|
1513
|
+
} else {
|
|
1514
|
+
res.destroy()
|
|
1430
1515
|
}
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1516
|
+
}
|
|
1517
|
+
},
|
|
1518
|
+
}),
|
|
1519
|
+
'dsh-gallery: media range route',
|
|
1434
1520
|
)
|
|
1435
1521
|
|
|
1436
1522
|
ctx.effect(
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Output Gallery",
|
|
4
|
-
"description": "Fixes DSH reporting produced files only after a task ends: watches your output folders live with auto-refreshing image thumbnails, native file preview, and in-panel video/audio playback
|
|
4
|
+
"description": "Fixes DSH reporting produced files only after a task ends: watches your output folders live with auto-refreshing image thumbnails, native file preview, and in-panel video/audio playback over HTTP Range (seeking works at any file size), plus one-click frame capture, so you can verify and intervene mid-task."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "产出画廊",
|
|
4
|
-
"description": "解决 DSH
|
|
4
|
+
"description": "解决 DSH 只在任务结尾才列出产出、过程不可见的问题:实时监控产出目录,图片自动刷新、文件原生预览、音视频面板内直接播放(支持 HTTP Range,任意大小都能拖进度条),还能一键截取视频当前帧,任务进行中就能校验纠正。"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-gallery",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "产出画廊:解决 DSH
|
|
5
|
+
"description": "产出画廊:解决 DSH 只在任务结尾才列出产出、过程不可见的问题。实时监控产出目录,图片自动刷新、文件原生预览、音视频面板内直接播放(支持 HTTP Range,任意大小都能拖进度条),还能一键截取视频当前帧,任务进行中即可校验纠正。",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/Hope2023Dcr/dsh-gallery.git"
|
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
"agent-tools",
|
|
57
57
|
"media-gallery",
|
|
58
58
|
"video-preview",
|
|
59
|
-
"audio-preview"
|
|
59
|
+
"audio-preview",
|
|
60
|
+
"range-seek"
|
|
60
61
|
],
|
|
61
62
|
"publishConfig": {
|
|
62
63
|
"access": "public",
|