skystream-cli 1.2.8 → 1.3.0
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/index.js +54 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const program = new Command();
|
|
|
9
9
|
program
|
|
10
10
|
.name('skystream')
|
|
11
11
|
.description('SkyStream Plugin Development Kit CLI (Sky Gen 2)')
|
|
12
|
-
.version('1.
|
|
12
|
+
.version('1.3.0');
|
|
13
13
|
// Schemas
|
|
14
14
|
const pluginSchema = z.object({
|
|
15
15
|
packageName: z.string().min(5).regex(/^[a-z0-9._-]+$/),
|
|
@@ -436,7 +436,59 @@ program.command('test')
|
|
|
436
436
|
atob: (s) => Buffer.from(s, 'base64').toString('utf8'),
|
|
437
437
|
globalThis: {},
|
|
438
438
|
};
|
|
439
|
-
const
|
|
439
|
+
const entityDefs = `
|
|
440
|
+
class MultimediaItem {
|
|
441
|
+
constructor({ title, url, posterUrl, type, bannerUrl, description, episodes, headers, provider }) {
|
|
442
|
+
this.title = title;
|
|
443
|
+
this.url = url;
|
|
444
|
+
this.posterUrl = posterUrl;
|
|
445
|
+
this.type = type || 'movie';
|
|
446
|
+
this.bannerUrl = bannerUrl;
|
|
447
|
+
this.description = description;
|
|
448
|
+
this.episodes = episodes;
|
|
449
|
+
this.headers = headers;
|
|
450
|
+
this.provider = provider;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
class Episode {
|
|
455
|
+
constructor({ name, url, season, episode, description, posterUrl, headers }) {
|
|
456
|
+
this.name = name;
|
|
457
|
+
this.url = url;
|
|
458
|
+
this.season = season || 0;
|
|
459
|
+
this.episode = episode || 0;
|
|
460
|
+
this.description = description;
|
|
461
|
+
this.posterUrl = posterUrl;
|
|
462
|
+
this.headers = headers;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
class StreamResult {
|
|
467
|
+
constructor({ url, quality, headers, subtitles, drmKid, drmKey, licenseUrl }) {
|
|
468
|
+
this.url = url;
|
|
469
|
+
this.quality = quality || 'Auto';
|
|
470
|
+
this.headers = headers;
|
|
471
|
+
this.subtitles = subtitles;
|
|
472
|
+
this.drmKid = drmKid;
|
|
473
|
+
this.drmKey = drmKey;
|
|
474
|
+
this.licenseUrl = licenseUrl;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
globalThis.MultimediaItem = MultimediaItem;
|
|
479
|
+
globalThis.Episode = Episode;
|
|
480
|
+
globalThis.StreamResult = StreamResult;
|
|
481
|
+
`;
|
|
482
|
+
// Wrap the plugin code and classes in a combined block to ensure scope visibility
|
|
483
|
+
const combinedScript = `
|
|
484
|
+
${entityDefs}
|
|
485
|
+
try {
|
|
486
|
+
${jsContent}
|
|
487
|
+
} catch (e) {
|
|
488
|
+
console.error("Critical Runtime Error: " + e.stack);
|
|
489
|
+
}
|
|
490
|
+
`;
|
|
491
|
+
const runtime = new Function('manifest', 'console', 'http_get', 'http_post', '_fetch', 'fetch', 'btoa', 'atob', 'globalThis', combinedScript);
|
|
440
492
|
runtime(context.manifest, context.console, context.http_get, context.http_post, context._fetch, context.fetch, context.btoa, context.atob, context.globalThis);
|
|
441
493
|
const fn = context.globalThis[options.function];
|
|
442
494
|
if (typeof fn !== 'function') {
|