skystream-cli 1.2.7 → 1.2.9
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/README.md +16 -1
- package/dist/index.js +70 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,7 +82,22 @@ skystream test [options]
|
|
|
82
82
|
**Options:**
|
|
83
83
|
- `-p, --path <path>`: Path to plugin folder (Default: `.`).
|
|
84
84
|
- `-f, --function <name>`: Function to test (Default: `getHome`).
|
|
85
|
-
- `-q, --query <query>`: Query string for
|
|
85
|
+
- `-q, --query <query>`: Query string (URLs for `load`/`loadStreams`, keywords for `search`).
|
|
86
|
+
|
|
87
|
+
**Examples:**
|
|
88
|
+
```bash
|
|
89
|
+
# Test dashboard categories
|
|
90
|
+
skystream test -f getHome
|
|
91
|
+
|
|
92
|
+
# Test search with a keyword
|
|
93
|
+
skystream test -f search -q "avatar"
|
|
94
|
+
|
|
95
|
+
# Test full details for a movie/series
|
|
96
|
+
skystream test -f load -q "https://site.com/movie/123"
|
|
97
|
+
|
|
98
|
+
# Test stream links extraction
|
|
99
|
+
skystream test -f loadStreams -q "https://site.com/movie/123"
|
|
100
|
+
```
|
|
86
101
|
|
|
87
102
|
---
|
|
88
103
|
|
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.2.
|
|
12
|
+
.version('1.2.9');
|
|
13
13
|
// Schemas
|
|
14
14
|
const pluginSchema = z.object({
|
|
15
15
|
packageName: z.string().min(5).regex(/^[a-z0-9._-]+$/),
|
|
@@ -436,7 +436,50 @@ 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
|
+
const runtime = new Function('manifest', 'console', 'http_get', 'http_post', '_fetch', 'fetch', 'btoa', 'atob', 'globalThis', entityDefs + jsContent);
|
|
440
483
|
runtime(context.manifest, context.console, context.http_get, context.http_post, context._fetch, context.fetch, context.btoa, context.atob, context.globalThis);
|
|
441
484
|
const fn = context.globalThis[options.function];
|
|
442
485
|
if (typeof fn !== 'function') {
|
|
@@ -445,12 +488,33 @@ program.command('test')
|
|
|
445
488
|
}
|
|
446
489
|
const callback = (res) => {
|
|
447
490
|
console.log('\n--- Result ---');
|
|
491
|
+
if (res && res.success === false) {
|
|
492
|
+
console.log(`\x1b[31mStatus: FAILED\x1b[0m`);
|
|
493
|
+
console.log(`\x1b[31mError Code: ${res.errorCode || 'UNKNOWN'}\x1b[0m`);
|
|
494
|
+
if (res.message)
|
|
495
|
+
console.log(`\x1b[31mMessage: ${res.message}\x1b[0m`);
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
console.log(`\x1b[32mStatus: SUCCESS\x1b[0m`);
|
|
499
|
+
}
|
|
448
500
|
console.log(JSON.stringify(res, null, 2));
|
|
449
501
|
};
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
502
|
+
try {
|
|
503
|
+
if (options.function === 'getHome')
|
|
504
|
+
await fn(callback);
|
|
505
|
+
else if (!options.query || options.query.trim() === "") {
|
|
506
|
+
console.warn(`\x1b[33mWarning: Function '${options.function}' usually requires a query/URL (-q), but none was provided.\x1b[0m`);
|
|
507
|
+
await fn(options.query, callback);
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
await fn(options.query, callback);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
catch (e) {
|
|
514
|
+
console.error(`\n\x1b[31m--- CRITICAL ERROR DURING EXECUTION ---\x1b[0m`);
|
|
515
|
+
console.error(`\x1b[31m${e.stack || e.message}\x1b[0m\n`);
|
|
516
|
+
process.exit(2);
|
|
517
|
+
}
|
|
454
518
|
});
|
|
455
519
|
program.command('deploy')
|
|
456
520
|
.description('Deploy all plugins and repository index')
|