@xiboplayer/xmds 0.5.2 → 0.5.4
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/rest-client.js +1 -1
- package/src/xmds-client.js +5 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiboplayer/xmds",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "XMDS SOAP client for Xibo CMS communication",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"./xmds": "./src/xmds.js"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@xiboplayer/utils": "0.5.
|
|
12
|
+
"@xiboplayer/utils": "0.5.4"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"vitest": "^2.0.0"
|
package/src/rest-client.js
CHANGED
|
@@ -41,7 +41,7 @@ export class RestClient {
|
|
|
41
41
|
_isProxyMode() {
|
|
42
42
|
return typeof window !== 'undefined' &&
|
|
43
43
|
(window.electronAPI?.isElectron ||
|
|
44
|
-
|
|
44
|
+
window.location.hostname === 'localhost');
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
package/src/xmds-client.js
CHANGED
|
@@ -52,15 +52,16 @@ export class XmdsClient {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
|
-
* Rewrite XMDS URL for
|
|
56
|
-
* If running inside
|
|
55
|
+
* Rewrite XMDS URL for local proxy.
|
|
56
|
+
* If running inside a local wrapper (Electron, Chromium kiosk), use the
|
|
57
|
+
* local proxy to avoid CORS.
|
|
57
58
|
* Detection: preload.js exposes window.electronAPI.isElectron = true,
|
|
58
|
-
* or fallback to checking localhost
|
|
59
|
+
* or fallback to checking localhost (any local wrapper port).
|
|
59
60
|
*/
|
|
60
61
|
rewriteXmdsUrl(cmsUrl) {
|
|
61
62
|
if (typeof window !== 'undefined' &&
|
|
62
63
|
(window.electronAPI?.isElectron ||
|
|
63
|
-
|
|
64
|
+
window.location.hostname === 'localhost')) {
|
|
64
65
|
const encodedCmsUrl = encodeURIComponent(cmsUrl);
|
|
65
66
|
return `/xmds-proxy?cms=${encodedCmsUrl}`;
|
|
66
67
|
}
|