@qilin-agent/host-preview-media 3.1.4 → 3.1.6
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/lib/index.js +5 -4
- package/package.json +6 -6
package/lib/index.js
CHANGED
|
@@ -22,8 +22,9 @@ function parseRange(raw, size) {
|
|
|
22
22
|
if (size <= 0) return { unsatisfiable: true };
|
|
23
23
|
const match = /^bytes=(.+)$/i.exec(raw.trim());
|
|
24
24
|
if (match === null) return null;
|
|
25
|
-
const
|
|
26
|
-
const
|
|
25
|
+
const specs = match[1];
|
|
26
|
+
const comma = specs.indexOf(",");
|
|
27
|
+
const spec = (comma === -1 ? specs : specs.slice(0, comma)).trim();
|
|
27
28
|
if (spec === "") return null;
|
|
28
29
|
if (spec.startsWith("-")) {
|
|
29
30
|
const suffix = Number(spec.slice(1));
|
|
@@ -41,7 +42,7 @@ function parseRange(raw, size) {
|
|
|
41
42
|
if (dash === -1) return null;
|
|
42
43
|
const startText = spec.slice(0, dash);
|
|
43
44
|
const endText = spec.slice(dash + 1);
|
|
44
|
-
const start =
|
|
45
|
+
const start = Number(startText);
|
|
45
46
|
const end = endText === "" ? size - 1 : Number(endText);
|
|
46
47
|
if (!Number.isInteger(start) || start < 0 || !Number.isInteger(end)) return null;
|
|
47
48
|
if (start >= size) return { unsatisfiable: true };
|
|
@@ -190,7 +191,7 @@ function apply(ctx, config) {
|
|
|
190
191
|
const type = mediaTypeOf(path);
|
|
191
192
|
const range = info.size === void 0 ? null : parseRange(req.headers.range, info.size);
|
|
192
193
|
if (range !== null && "unsatisfiable" in range) {
|
|
193
|
-
const size = info.size
|
|
194
|
+
const size = info.size;
|
|
194
195
|
res.writeHead(416, {
|
|
195
196
|
...mediaHeaders(type),
|
|
196
197
|
"content-range": `bytes */${size}`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qilin-agent/host-preview-media",
|
|
3
3
|
"description": "Host half of preview media: the /sidebar/media route serving session-workspace files to inline previews, with HTTP Range windows for seeking video",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.6",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
],
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@qilin-agent/schemastery": "~3.18.
|
|
33
|
+
"@qilin-agent/schemastery": "~3.18.5"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@qilin-agent/kylin": "~4.0.
|
|
36
|
+
"@qilin-agent/kylin": "~4.0.5"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@qilin-agent/kylin": "~4.0.
|
|
40
|
-
"@qilin-agent/kylin-plugin-loader": "~1.0.
|
|
41
|
-
"@qilin-agent/host-webserver": "3.1.
|
|
39
|
+
"@qilin-agent/kylin": "~4.0.5",
|
|
40
|
+
"@qilin-agent/kylin-plugin-loader": "~1.0.6",
|
|
41
|
+
"@qilin-agent/host-webserver": "3.1.6"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"bundle": "tsdown",
|