skystream-cli 1.4.8 → 1.5.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.
Files changed (2) hide show
  1. package/dist/index.js +19 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ const program = new Command();
12
12
  program
13
13
  .name('skystream')
14
14
  .description('SkyStream Plugin Development Kit CLI (Sky Gen 2)')
15
- .version('1.4.8');
15
+ .version('1.5.0');
16
16
  // Schemas
17
17
  const pluginSchema = z.object({
18
18
  packageName: z.string().min(5).regex(/^[a-z0-9._-]+$/),
@@ -95,10 +95,9 @@ const JS_TEMPLATE = `(function() {
95
95
  /**
96
96
  * Searches for media items.
97
97
  * @param {string} query
98
- * @param {number} page
99
98
  * @param {(res: Response) => void} cb
100
99
  */
101
- async function search(query, page, cb) {
100
+ async function search(query, cb) {
102
101
  try {
103
102
  // Standard: Return a List of items
104
103
  // Samples show both a movie and a series
@@ -465,44 +464,38 @@ program.command('test')
465
464
  if (!Object.keys(finalHeaders).some(k => k.toLowerCase() === 'user-agent')) {
466
465
  finalHeaders['User-Agent'] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36";
467
466
  }
468
- const res = await axios.get(url, { headers: finalHeaders });
467
+ const res = await axios.get(url, { headers: finalHeaders, method: 'GET' });
469
468
  const body = typeof res.data === 'string' ? res.data : JSON.stringify(res.data);
470
469
  const response = { status: res.status, statusCode: res.status, body, headers: res.headers };
471
470
  if (cb)
472
471
  cb(response);
473
- return response.body;
472
+ return response;
474
473
  }
475
474
  catch (e) {
476
- const res = { status: e.response?.status || 500, statusCode: e.response?.status || 500, body: e.response?.data || e.message, headers: e.response?.headers || {} };
475
+ const response = { status: e.response?.status || 500, statusCode: e.response?.status || 500, body: e.response?.data || e.message, headers: e.response?.headers || {} };
477
476
  if (cb)
478
- cb(res);
479
- return res.body;
477
+ cb(response);
478
+ return response;
480
479
  }
481
480
  },
482
- http_post: async (url, headers_or_options, body_arg, cb) => {
481
+ http_post: async (url, headers, body, cb) => {
483
482
  try {
484
- let headers = headers_or_options;
485
- let body = body_arg;
486
- if (typeof headers_or_options === 'object' && headers_or_options !== null && !body_arg && (headers_or_options.body || headers_or_options.headers)) {
487
- body = headers_or_options.body;
488
- headers = headers_or_options.headers;
489
- }
490
483
  const finalHeaders = { ...(headers || {}) };
491
484
  if (!Object.keys(finalHeaders).some(k => k.toLowerCase() === 'user-agent')) {
492
485
  finalHeaders['User-Agent'] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36";
493
486
  }
494
- const res = await axios.post(url, body, { headers: finalHeaders });
487
+ const res = await axios.post(url, body, { headers: finalHeaders, method: 'POST' });
495
488
  const resBody = typeof res.data === 'string' ? res.data : JSON.stringify(res.data);
496
489
  const response = { status: res.status, statusCode: res.status, body: resBody, headers: res.headers };
497
490
  if (cb)
498
491
  cb(response);
499
- return response.body;
492
+ return response;
500
493
  }
501
494
  catch (e) {
502
- const res = { status: e.response?.status || 500, statusCode: e.response?.status || 500, body: e.response?.data || e.message, headers: e.response?.headers || {} };
495
+ const response = { status: e.response?.status || 500, statusCode: e.response?.status || 500, body: e.response?.data || e.message, headers: e.response?.headers || {} };
503
496
  if (cb)
504
- cb(res);
505
- return res.body;
497
+ cb(response);
498
+ return response;
506
499
  }
507
500
  },
508
501
  registerSettings: (schema) => {
@@ -563,6 +556,11 @@ program.command('test')
563
556
  }
564
557
  return '';
565
558
  },
559
+ crypto: {
560
+ decryptAES: async (data, key, iv) => {
561
+ return context.sendMessage('crypto_decrypt_aes', JSON.stringify({ data, key, iv }));
562
+ }
563
+ },
566
564
  globalThis: {},
567
565
  };
568
566
  context.globalThis = context;
@@ -678,7 +676,7 @@ program.command('test')
678
676
  if (options.function === 'getHome')
679
677
  await fn(callback);
680
678
  else if (options.function === 'search')
681
- await fn(options.query, 1, callback);
679
+ await fn(options.query, callback);
682
680
  else if (!options.query || options.query.trim() === "") {
683
681
  console.warn('\x1b[33mWarning: Function \'' + options.function + '\' usually requires a query/URL (-q), but none was provided.\x1b[0m');
684
682
  await fn(options.query, callback);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skystream-cli",
3
- "version": "1.4.8",
3
+ "version": "1.5.0",
4
4
  "type": "module",
5
5
  "description": "SkyStream Plugin Development Kit & Repository Manager",
6
6
  "main": "dist/index.js",