@xiboplayer/xmds 0.6.11 → 0.6.13
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/xmds-client.js +19 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiboplayer/xmds",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13",
|
|
4
4
|
"description": "XMDS SOAP client for Xibo CMS communication",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"./schedule-parser": "./src/schedule-parser.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@xiboplayer/utils": "0.6.
|
|
15
|
+
"@xiboplayer/utils": "0.6.13"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"vitest": "^2.0.0"
|
package/src/xmds-client.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Protocol: https://github.com/linuxnow/xibo_players_docs
|
|
10
10
|
*/
|
|
11
|
-
import { createLogger, fetchWithRetry } from '@xiboplayer/utils';
|
|
11
|
+
import { createLogger, fetchWithRetry, PLAYER_API } from '@xiboplayer/utils';
|
|
12
12
|
import { parseScheduleResponse } from './schedule-parser.js';
|
|
13
13
|
|
|
14
14
|
const log = createLogger('XMDS');
|
|
@@ -256,7 +256,7 @@ export class XmdsClient {
|
|
|
256
256
|
|
|
257
257
|
const files = [];
|
|
258
258
|
for (const fileEl of doc.querySelectorAll('file')) {
|
|
259
|
-
|
|
259
|
+
const file = {
|
|
260
260
|
type: fileEl.getAttribute('type'),
|
|
261
261
|
id: fileEl.getAttribute('id'),
|
|
262
262
|
size: parseInt(fileEl.getAttribute('size') || '0'),
|
|
@@ -269,7 +269,23 @@ export class XmdsClient {
|
|
|
269
269
|
layoutid: fileEl.getAttribute('layoutid'),
|
|
270
270
|
regionid: fileEl.getAttribute('regionid'),
|
|
271
271
|
mediaid: fileEl.getAttribute('mediaid')
|
|
272
|
-
}
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
// Rewrite XMDS download URLs to local proxy cache-through paths.
|
|
275
|
+
// Store the original CMS URL so the proxy can fetch on cache miss.
|
|
276
|
+
if (file.path && file.path.includes('xmds.php')) {
|
|
277
|
+
file.cmsDownloadUrl = file.path;
|
|
278
|
+
const xmdsType = file.fileType; // L=layout, M=media, P=resource
|
|
279
|
+
if (xmdsType === 'L' || file.type === 'layout') {
|
|
280
|
+
file.path = `${PLAYER_API}/layouts/${file.id}`;
|
|
281
|
+
} else if (xmdsType === 'P') {
|
|
282
|
+
file.path = `${PLAYER_API}/dependencies/${file.saveAs || file.id}`;
|
|
283
|
+
} else {
|
|
284
|
+
file.path = `${PLAYER_API}/media/file/${file.saveAs || file.id}`;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
files.push(file);
|
|
273
289
|
}
|
|
274
290
|
|
|
275
291
|
// Parse purge block — files CMS wants the player to delete
|