@patch-adams/core 1.4.6 → 1.4.7
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/dist/cli.cjs +119 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +119 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +119 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +119 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1986,7 +1986,12 @@ function generateLrsBridgeCode(options) {
|
|
|
1986
1986
|
callback(null);
|
|
1987
1987
|
}
|
|
1988
1988
|
} else {
|
|
1989
|
-
|
|
1989
|
+
// 401/403 is expected - API requires auth that may not be available from iframe
|
|
1990
|
+
if (xhr.status === 401 || xhr.status === 403) {
|
|
1991
|
+
log('Shared link API requires auth (expected), will use fallback');
|
|
1992
|
+
} else {
|
|
1993
|
+
log('Shared link fetch failed. Status:', xhr.status);
|
|
1994
|
+
}
|
|
1990
1995
|
callback(null);
|
|
1991
1996
|
}
|
|
1992
1997
|
}
|
|
@@ -2061,7 +2066,12 @@ function generateLrsBridgeCode(options) {
|
|
|
2061
2066
|
callback(null);
|
|
2062
2067
|
}
|
|
2063
2068
|
} else {
|
|
2064
|
-
|
|
2069
|
+
// 401/403 is expected - API requires auth that may not be available from iframe
|
|
2070
|
+
if (xhr.status === 401 || xhr.status === 403) {
|
|
2071
|
+
log('Document API requires auth (expected), will use fallback');
|
|
2072
|
+
} else {
|
|
2073
|
+
log('Document metadata fetch failed. Status:', xhr.status);
|
|
2074
|
+
}
|
|
2065
2075
|
callback(null);
|
|
2066
2076
|
}
|
|
2067
2077
|
}
|
|
@@ -2224,6 +2234,95 @@ function generateLrsBridgeCode(options) {
|
|
|
2224
2234
|
return null;
|
|
2225
2235
|
}
|
|
2226
2236
|
|
|
2237
|
+
/**
|
|
2238
|
+
* Try to extract document data from Xyleme Cloud Player's internal state
|
|
2239
|
+
* The Cloud Player stores this after fetching /api/shared/{token}/documents
|
|
2240
|
+
*/
|
|
2241
|
+
function extractFromXylemeCloudPlayer() {
|
|
2242
|
+
try {
|
|
2243
|
+
var win = window;
|
|
2244
|
+
for (var level = 0; level < 10; level++) {
|
|
2245
|
+
try {
|
|
2246
|
+
// Check for Xyleme Cloud Player's document data in various locations
|
|
2247
|
+
// The player stores data in multiple places depending on version
|
|
2248
|
+
|
|
2249
|
+
// Check for CdsDataService data
|
|
2250
|
+
if (win._cdsDataService && win._cdsDataService.documentData) {
|
|
2251
|
+
var docData = win._cdsDataService.documentData;
|
|
2252
|
+
log('Found document data in _cdsDataService at level', level);
|
|
2253
|
+
return extractGuidsFromDocumentData(docData);
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
// Check for window.documentData
|
|
2257
|
+
if (win.documentData && win.documentData.guid) {
|
|
2258
|
+
log('Found document data in window.documentData at level', level);
|
|
2259
|
+
return extractGuidsFromDocumentData(win.documentData);
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
// Check for PlayerIntegration's internal data
|
|
2263
|
+
if (win.playerIntegration && win.playerIntegration._documentData) {
|
|
2264
|
+
log('Found document data in playerIntegration at level', level);
|
|
2265
|
+
return extractGuidsFromDocumentData(win.playerIntegration._documentData);
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2268
|
+
// Check for __xyleme_data
|
|
2269
|
+
if (win.__xyleme_data && win.__xyleme_data.document) {
|
|
2270
|
+
log('Found document data in __xyleme_data at level', level);
|
|
2271
|
+
return extractGuidsFromDocumentData(win.__xyleme_data.document);
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
// Check for documentVersionData which has the versionGuid
|
|
2275
|
+
if (win.documentVersionData) {
|
|
2276
|
+
log('Found documentVersionData at level', level);
|
|
2277
|
+
return {
|
|
2278
|
+
versionGuid: win.documentVersionData.guid || win.documentVersionData.versionGuid,
|
|
2279
|
+
documentId: win.documentVersionData.documentId
|
|
2280
|
+
};
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
} catch (e) {}
|
|
2284
|
+
|
|
2285
|
+
if (win.parent && win.parent !== win) {
|
|
2286
|
+
win = win.parent;
|
|
2287
|
+
} else {
|
|
2288
|
+
break;
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
} catch (e) {}
|
|
2292
|
+
return null;
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
function extractGuidsFromDocumentData(data) {
|
|
2296
|
+
if (!data) return null;
|
|
2297
|
+
|
|
2298
|
+
var result = {};
|
|
2299
|
+
|
|
2300
|
+
// Document GUID
|
|
2301
|
+
if (data.guid) result.guid = data.guid;
|
|
2302
|
+
if (data.documentGuid) result.guid = data.documentGuid;
|
|
2303
|
+
|
|
2304
|
+
// Version GUID - usually in latestVersion or currentVersion
|
|
2305
|
+
if (data.latestVersion && data.latestVersion.guid) {
|
|
2306
|
+
result.versionGuid = data.latestVersion.guid;
|
|
2307
|
+
}
|
|
2308
|
+
if (data.currentVersion && data.currentVersion.guid) {
|
|
2309
|
+
result.versionGuid = data.currentVersion.guid;
|
|
2310
|
+
}
|
|
2311
|
+
if (data.versionGuid) result.versionGuid = data.versionGuid;
|
|
2312
|
+
|
|
2313
|
+
// Numeric IDs
|
|
2314
|
+
if (data.id) result.documentId = data.id;
|
|
2315
|
+
if (data.documentId) result.documentId = data.documentId;
|
|
2316
|
+
if (data.cdsId) result.documentId = data.cdsId;
|
|
2317
|
+
|
|
2318
|
+
// Title
|
|
2319
|
+
if (data.name) result.title = data.name;
|
|
2320
|
+
if (data.title) result.title = data.title;
|
|
2321
|
+
|
|
2322
|
+
log('Extracted GUIDs from Cloud Player:', result);
|
|
2323
|
+
return Object.keys(result).length > 0 ? result : null;
|
|
2324
|
+
}
|
|
2325
|
+
|
|
2227
2326
|
function extractCourseInfo() {
|
|
2228
2327
|
var info = {
|
|
2229
2328
|
// Xyleme IRI format: http://xyleme.com/bravais/document/{guid}
|
|
@@ -2279,6 +2378,23 @@ function generateLrsBridgeCode(options) {
|
|
|
2279
2378
|
info.sharedLinkName = launchInfo.sharedLinkName || info.sharedLinkName;
|
|
2280
2379
|
}
|
|
2281
2380
|
|
|
2381
|
+
// 3b. Try to extract GUIDs from Xyleme Cloud Player's internal data
|
|
2382
|
+
// This is more reliable than API calls which may fail with 401
|
|
2383
|
+
if (!info.guid || !info.versionGuid) {
|
|
2384
|
+
var cloudPlayerData = extractFromXylemeCloudPlayer();
|
|
2385
|
+
if (cloudPlayerData) {
|
|
2386
|
+
info.guid = cloudPlayerData.guid || info.guid;
|
|
2387
|
+
info.versionGuid = cloudPlayerData.versionGuid || info.versionGuid;
|
|
2388
|
+
info.documentId = cloudPlayerData.documentId || info.documentId;
|
|
2389
|
+
info.title = cloudPlayerData.title || info.title;
|
|
2390
|
+
log('Updated course info from Cloud Player:', {
|
|
2391
|
+
guid: info.guid,
|
|
2392
|
+
versionGuid: info.versionGuid,
|
|
2393
|
+
documentId: info.documentId
|
|
2394
|
+
});
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2282
2398
|
// 4. Try getCourseTitle() from preloadIntegrity.js
|
|
2283
2399
|
var preloadTitle = extractCourseTitleFromPreload();
|
|
2284
2400
|
if (preloadTitle) {
|
|
@@ -3784,7 +3900,7 @@ function generateLrsBridgeCode(options) {
|
|
|
3784
3900
|
// ========================================================================
|
|
3785
3901
|
|
|
3786
3902
|
function init() {
|
|
3787
|
-
log('Initializing LRS bridge v2.
|
|
3903
|
+
log('Initializing LRS bridge v2.6.0...');
|
|
3788
3904
|
|
|
3789
3905
|
// Extract course info early
|
|
3790
3906
|
extractCourseInfo();
|