@xiboplayer/cache 0.5.3 → 0.5.5
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 +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiboplayer/cache",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Offline caching and download management with parallel chunk downloads",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"spark-md5": "^3.0.2",
|
|
15
|
-
"@xiboplayer/utils": "0.5.
|
|
15
|
+
"@xiboplayer/utils": "0.5.5"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"vitest": "^2.0.0",
|
package/src/download-manager.js
CHANGED
|
@@ -100,12 +100,12 @@ export function isUrlExpired(url, graceSeconds = 30) {
|
|
|
100
100
|
/**
|
|
101
101
|
* Rewrite an absolute CMS URL through the local proxy when running behind
|
|
102
102
|
* the proxy server (Chromium kiosk or Electron).
|
|
103
|
-
* Detection: SW/window on localhost
|
|
103
|
+
* Detection: SW/window on localhost (any port) = proxy mode.
|
|
104
104
|
*/
|
|
105
105
|
export function rewriteUrlForProxy(url) {
|
|
106
106
|
if (!url.startsWith('http')) return url;
|
|
107
107
|
const loc = typeof self !== 'undefined' ? self.location : undefined;
|
|
108
|
-
if (!loc || loc.hostname !== 'localhost'
|
|
108
|
+
if (!loc || loc.hostname !== 'localhost') return url;
|
|
109
109
|
const parsed = new URL(url);
|
|
110
110
|
const cmsOrigin = parsed.origin;
|
|
111
111
|
return `/file-proxy?cms=${encodeURIComponent(cmsOrigin)}&url=${encodeURIComponent(parsed.pathname + parsed.search)}`;
|