@xiboplayer/cache 0.6.1 → 0.6.2
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/package.json +2 -2
- package/src/download-manager.js +4 -2
- package/src/widget-html.js +1 -1
- package/src/widget-html.test.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiboplayer/cache",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Offline caching and download management with parallel chunk downloads",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"spark-md5": "^3.0.2",
|
|
19
|
-
"@xiboplayer/utils": "0.6.
|
|
19
|
+
"@xiboplayer/utils": "0.6.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"vitest": "^2.0.0",
|
package/src/download-manager.js
CHANGED
|
@@ -708,13 +708,15 @@ export class DownloadQueue {
|
|
|
708
708
|
|
|
709
709
|
let boosted = 0;
|
|
710
710
|
for (const t of this.queue) {
|
|
711
|
-
|
|
711
|
+
const matchValue = t._parentFile?.fileInfo.saveAs || String(t._parentFile?.fileInfo.id);
|
|
712
|
+
if (idSet.has(matchValue) && t._priority < priority) {
|
|
712
713
|
t._priority = priority;
|
|
713
714
|
boosted++;
|
|
714
715
|
}
|
|
715
716
|
}
|
|
716
717
|
for (const t of this._activeTasks) {
|
|
717
|
-
|
|
718
|
+
const matchValue = t._parentFile?.fileInfo.saveAs || String(t._parentFile?.fileInfo.id);
|
|
719
|
+
if (idSet.has(matchValue) && t._priority < priority) {
|
|
718
720
|
t._priority = priority;
|
|
719
721
|
}
|
|
720
722
|
}
|
package/src/widget-html.js
CHANGED
|
@@ -38,7 +38,7 @@ export async function cacheWidgetHtml(layoutId, regionId, mediaId, html) {
|
|
|
38
38
|
const cacheKey = `${PLAYER_API}/widgets/${layoutId}/${regionId}/${mediaId}`;
|
|
39
39
|
|
|
40
40
|
// Inject <base> tag — resolves relative media refs (e.g. "42") to mirror route
|
|
41
|
-
const baseTag = `<base href="${PLAYER_API}/media/">`;
|
|
41
|
+
const baseTag = `<base href="${PLAYER_API}/media/file/">`;
|
|
42
42
|
let modifiedHtml = html;
|
|
43
43
|
|
|
44
44
|
// Insert base tag after <head> opening tag (skip if already present)
|
package/src/widget-html.test.js
CHANGED
|
@@ -101,7 +101,7 @@ describe('cacheWidgetHtml', () => {
|
|
|
101
101
|
await cacheWidgetHtml('472', '223', '193', html);
|
|
102
102
|
|
|
103
103
|
const stored = getStoredWidget();
|
|
104
|
-
expect(stored).toContain('<base href="/api/v2/player/media/">');
|
|
104
|
+
expect(stored).toContain('<base href="/api/v2/player/media/file/">');
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
it('injects <base> tag when no <head> tag exists', async () => {
|
|
@@ -109,7 +109,7 @@ describe('cacheWidgetHtml', () => {
|
|
|
109
109
|
await cacheWidgetHtml('472', '223', '193', html);
|
|
110
110
|
|
|
111
111
|
const stored = getStoredWidget();
|
|
112
|
-
expect(stored).toContain('<base href="/api/v2/player/media/">');
|
|
112
|
+
expect(stored).toContain('<base href="/api/v2/player/media/file/">');
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
115
|
|