@scrypted/server 0.79.0 → 0.81.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.
@@ -142,6 +142,14 @@ async function start(mainFilename, options) {
142
142
  certSetting._id = 'certificate';
143
143
  certSetting.value = keyPair;
144
144
  certSetting = await db.upsert(certSetting);
145
+ let hasLogin = await db.getCount(db_types_1.ScryptedUser) > 0;
146
+ if (process_1.default.env.SCRYPTED_ADMIN_USERNAME) {
147
+ let user = await db.tryGet(db_types_1.ScryptedUser, process_1.default.env.SCRYPTED_ADMIN_USERNAME);
148
+ if (!user) {
149
+ user = await users_1.UsersService.addUserToDatabase(db, process_1.default.env.SCRYPTED_ADMIN_USERNAME, crypto_1.default.randomBytes(8).toString('hex'), undefined);
150
+ hasLogin = true;
151
+ }
152
+ }
145
153
  const basicAuth = http_auth_1.default.basic({
146
154
  realm: 'Scrypted',
147
155
  }, async (username, password, callback) => {
@@ -186,6 +194,23 @@ async function start(mainFilename, options) {
186
194
  },
187
195
  };
188
196
  };
197
+ const getDefaultAuthentication = (req) => {
198
+ const defaultAuthentication = !req.query.disableDefaultAuthentication && process_1.default.env.SCRYPTED_DEFAULT_AUTHENTICATION;
199
+ if (defaultAuthentication) {
200
+ const referer = req.headers.referer;
201
+ if (referer) {
202
+ try {
203
+ const u = new URL(referer);
204
+ if (u.searchParams.has('disableDefaultAuthentication'))
205
+ return;
206
+ }
207
+ catch (e) {
208
+ // no/invalid referer, allow the default auth
209
+ }
210
+ }
211
+ return scrypted.usersService.users.get(defaultAuthentication);
212
+ }
213
+ };
189
214
  app.use(async (req, res, next) => {
190
215
  const defaultAuthentication = getDefaultAuthentication(req);
191
216
  if (defaultAuthentication) {
@@ -292,25 +317,6 @@ async function start(mainFilename, options) {
292
317
  const scrypted = new runtime_1.ScryptedRuntime(mainFilename, db, insecure, secure, app);
293
318
  await options?.onRuntimeCreated?.(scrypted);
294
319
  await scrypted.start();
295
- await listenServerPort('SCRYPTED_SECURE_PORT', server_settings_1.SCRYPTED_SECURE_PORT, secure);
296
- await listenServerPort('SCRYPTED_INSECURE_PORT', server_settings_1.SCRYPTED_INSECURE_PORT, insecure);
297
- console.log('#######################################################');
298
- console.log(`Scrypted Volume : ${volumeDir}`);
299
- console.log(`Scrypted Server (Local) : https://localhost:${server_settings_1.SCRYPTED_SECURE_PORT}/`);
300
- for (const address of (0, server_settings_1.getHostAddresses)(true, true)) {
301
- console.log(`Scrypted Server (Remote) : https://${address}:${server_settings_1.SCRYPTED_SECURE_PORT}/`);
302
- }
303
- console.log(`Version: : ${await scrypted.info.getVersion()}`);
304
- console.log('#######################################################');
305
- console.log('Scrypted insecure http service port:', server_settings_1.SCRYPTED_INSECURE_PORT);
306
- console.log('Ports can be changed with environment variables.');
307
- console.log('https: $SCRYPTED_SECURE_PORT');
308
- console.log('http : $SCRYPTED_INSECURE_PORT');
309
- console.log('Certificate can be modified via tls.createSecureContext options in');
310
- console.log('JSON file located at SCRYPTED_HTTPS_OPTIONS_FILE environment variable:');
311
- console.log('export SCRYPTED_HTTPS_OPTIONS_FILE=/path/to/options.json');
312
- console.log('https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions');
313
- console.log('#######################################################');
314
320
  app.get(['/web/component/script/npm/:pkg', '/web/component/script/npm/@:owner/:pkg'], async (req, res) => {
315
321
  const { owner, pkg } = req.params;
316
322
  let endpoint = pkg;
@@ -422,14 +428,6 @@ async function start(mainFilename, options) {
422
428
  res.redirect('./endpoint/@scrypted/core/public/');
423
429
  }
424
430
  });
425
- let hasLogin = await db.getCount(db_types_1.ScryptedUser) > 0;
426
- if (process_1.default.env.SCRYPTED_ADMIN_USERNAME) {
427
- let user = await db.tryGet(db_types_1.ScryptedUser, process_1.default.env.SCRYPTED_ADMIN_USERNAME);
428
- if (!user) {
429
- user = await scrypted.usersService.addUserInternal(process_1.default.env.SCRYPTED_ADMIN_USERNAME, crypto_1.default.randomBytes(8).toString('hex'), undefined);
430
- hasLogin = true;
431
- }
432
- }
433
431
  app.options('/login', (req, res) => {
434
432
  res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
435
433
  res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With');
@@ -529,23 +527,6 @@ async function start(mainFilename, options) {
529
527
  catch (e) {
530
528
  }
531
529
  }
532
- const getDefaultAuthentication = (req) => {
533
- const defaultAuthentication = !req.query.disableDefaultAuthentication && process_1.default.env.SCRYPTED_DEFAULT_AUTHENTICATION;
534
- if (defaultAuthentication) {
535
- const referer = req.headers.referer;
536
- if (referer) {
537
- try {
538
- const u = new URL(referer);
539
- if (u.searchParams.has('disableDefaultAuthentication'))
540
- return;
541
- }
542
- catch (e) {
543
- // no/invalid referer, allow the default auth
544
- }
545
- }
546
- return scrypted.usersService.users.get(defaultAuthentication);
547
- }
548
- };
549
530
  app.get('/login', async (req, res) => {
550
531
  await checkResetLogin();
551
532
  const hostname = os_1.default.hostname()?.split('.')?.[0];
@@ -627,6 +608,25 @@ async function start(mainFilename, options) {
627
608
  }
628
609
  });
629
610
  app.get('/', (_req, res) => res.redirect('./endpoint/@scrypted/core/public/'));
611
+ await listenServerPort('SCRYPTED_SECURE_PORT', server_settings_1.SCRYPTED_SECURE_PORT, secure);
612
+ await listenServerPort('SCRYPTED_INSECURE_PORT', server_settings_1.SCRYPTED_INSECURE_PORT, insecure);
613
+ console.log('#######################################################');
614
+ console.log(`Scrypted Volume : ${volumeDir}`);
615
+ console.log(`Scrypted Server (Local) : https://localhost:${server_settings_1.SCRYPTED_SECURE_PORT}/`);
616
+ for (const address of (0, server_settings_1.getHostAddresses)(true, true)) {
617
+ console.log(`Scrypted Server (Remote) : https://${address}:${server_settings_1.SCRYPTED_SECURE_PORT}/`);
618
+ }
619
+ console.log(`Version: : ${await scrypted.info.getVersion()}`);
620
+ console.log('#######################################################');
621
+ console.log('Scrypted insecure http service port:', server_settings_1.SCRYPTED_INSECURE_PORT);
622
+ console.log('Ports can be changed with environment variables.');
623
+ console.log('https: $SCRYPTED_SECURE_PORT');
624
+ console.log('http : $SCRYPTED_INSECURE_PORT');
625
+ console.log('Certificate can be modified via tls.createSecureContext options in');
626
+ console.log('JSON file located at SCRYPTED_HTTPS_OPTIONS_FILE environment variable:');
627
+ console.log('export SCRYPTED_HTTPS_OPTIONS_FILE=/path/to/options.json');
628
+ console.log('https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions');
629
+ console.log('#######################################################');
630
630
  return scrypted;
631
631
  }
632
632
  exports.default = start;
@@ -1 +1 @@
1
- {"version":3,"file":"scrypted-server-main.js","sourceRoot":"","sources":["../src/scrypted-server-main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAqC;AACrC,kEAAyC;AACzC,oDAA4B;AAC5B,mCAA8B;AAC9B,sDAA2C;AAC3C,4CAAoB;AACpB,gDAAwB;AACxB,0DAAiC;AACjC,kDAA0B;AAC1B,yCAAoC;AACpC,8CAAsB;AACtB,4CAAoB;AACpB,gDAAwB;AACxB,sDAA8B;AAC9B,oDAA4B;AAC5B,2DAAwE;AACxE,iCAA8F;AAC9F,yCAA4D;AAC5D,6DAAyD;AACzD,oDAA4B;AAC5B,wDAAoD;AACpD,0DAA2D;AAC3D,+BAAuC;AACvC,uCAA4C;AAC5C,uDAAwH;AACxH,4CAA2D;AAC3D,mCAAgC;AAChC,2CAA8D;AAI9D,IAAI,CAAC,gBAAM,CAAC,GAAG,CAAC,iBAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;IACzC,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAA;AACvF,CAAC;AAED,iBAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,KAAK,CAAC,EAAE;IACrC,IAAI,KAAK,EAAE,WAAW,KAAK,oBAAc,IAAI,KAAK,EAAE,WAAW,KAAK,0BAAW,EAAE,CAAC;QAC9E,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAA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A;IACjF,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;IACtF,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;IACxE,OAAO,CAAC,GAAG,CAAC,+DAA+D,CAAC,CAAA;IAC5E,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;IAEvE,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,kBAAe,KAAK,CAAC"}
@@ -25,7 +25,8 @@ class ServiceControl {
25
25
  const webhookUpdate = process.env.SCRYPTED_WEBHOOK_UPDATE;
26
26
  if (webhookUpdate) {
27
27
  const webhookUpdateAuthorization = process.env.SCRYPTED_WEBHOOK_UPDATE_AUTHORIZATION;
28
- await (0, http_fetch_helpers_1.fetchJSON)(webhookUpdate, {
28
+ await (0, http_fetch_helpers_1.httpFetch)({
29
+ url: webhookUpdate,
29
30
  headers: {
30
31
  Authorization: webhookUpdateAuthorization,
31
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"service-control.js","sourceRoot":"","sources":["../../src/services/service-control.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,8DAAkD;AAGlD,MAAa,cAAc;IACJ;IAAnB,YAAmB,QAAyB;QAAzB,aAAQ,GAAR,QAAQ,CAAiB;IAC5C,CAAC;IAED,KAAK,CAAC,IAAI;QACN,YAAE,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC9B,IAAI,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,OAAO;QACT,OAAO,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,kBAAkB;QACpB,MAAM,IAAI,KAAK,CAAC,6FAA6F,CAAC,CAAC;IACnH,CAAC;IAED,KAAK,CAAC,MAAM;QACR,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;QAC1D,IAAI,aAAa,EAAE,CAAC;YAChB,MAAM,0BAA0B,GAAG,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC;YACrF,MAAM,IAAA,8BAAS,EAAC,aAAa,EAAE;gBAC3B,OAAO,EAAE;oBACL,aAAa,EAAE,0BAA0B;iBAC5C;aACJ,CAAC,CAAC;QACP,CAAC;aACI,CAAC;YACF,YAAE,CAAC,aAAa,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;YAChC,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;IACL,CAAC;CACJ;AAhCD,wCAgCC"}
1
+ {"version":3,"file":"service-control.js","sourceRoot":"","sources":["../../src/services/service-control.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,8DAAkD;AAGlD,MAAa,cAAc;IACJ;IAAnB,YAAmB,QAAyB;QAAzB,aAAQ,GAAR,QAAQ,CAAiB;IAC5C,CAAC;IAED,KAAK,CAAC,IAAI;QACN,YAAE,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC9B,IAAI,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,OAAO;QACT,OAAO,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,kBAAkB;QACpB,MAAM,IAAI,KAAK,CAAC,6FAA6F,CAAC,CAAC;IACnH,CAAC;IAED,KAAK,CAAC,MAAM;QACR,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;QAC1D,IAAI,aAAa,EAAE,CAAC;YAChB,MAAM,0BAA0B,GAAG,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC;YACrF,MAAM,IAAA,8BAAS,EAAC;gBACZ,GAAG,EAAE,aAAa;gBAClB,OAAO,EAAE;oBACL,aAAa,EAAE,0BAA0B;iBAC5C;aACJ,CAAC,CAAC;QACP,CAAC;aACI,CAAC;YACF,YAAE,CAAC,aAAa,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;YAChC,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;IACL,CAAC;CACJ;AAjCD,wCAiCC"}
@@ -1,9 +1,11 @@
1
1
  import { ScryptedUser } from "../db-types";
2
+ import WrappedLevel from "../level";
2
3
  import { ScryptedRuntime } from "../runtime";
3
4
  export declare class UsersService {
4
5
  scrypted: ScryptedRuntime;
5
6
  users: Map<string, ScryptedUser>;
6
7
  usersPromise: Promise<ScryptedUser[]>;
8
+ static addUserToDatabase(db: WrappedLevel, username: string, password: string, aclId: string): Promise<ScryptedUser>;
7
9
  constructor(scrypted: ScryptedRuntime);
8
10
  private ensureUsersPromise;
9
11
  private updateUsersPromise;
@@ -10,6 +10,15 @@ class UsersService {
10
10
  scrypted;
11
11
  users = new Map();
12
12
  usersPromise;
13
+ static async addUserToDatabase(db, username, password, aclId) {
14
+ const user = new db_types_1.ScryptedUser();
15
+ user._id = username;
16
+ user.aclId = aclId;
17
+ user.token = crypto_1.default.randomBytes(16).toString('hex');
18
+ setScryptedUserPassword(user, password, Date.now());
19
+ await db.upsert(user);
20
+ return user;
21
+ }
13
22
  constructor(scrypted) {
14
23
  this.scrypted = scrypted;
15
24
  }
@@ -50,12 +59,7 @@ class UsersService {
50
59
  }
51
60
  async addUserInternal(username, password, aclId) {
52
61
  await this.ensureUsersPromise();
53
- const user = new db_types_1.ScryptedUser();
54
- user._id = username;
55
- user.aclId = aclId;
56
- user.token = crypto_1.default.randomBytes(16).toString('hex');
57
- setScryptedUserPassword(user, password, Date.now());
58
- await this.scrypted.datastore.upsert(user);
62
+ const user = await UsersService.addUserToDatabase(this.scrypted.datastore, username, password, aclId);
59
63
  this.users.set(username, user);
60
64
  this.updateUsersPromise();
61
65
  return user;
@@ -1 +1 @@
1
- {"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/services/users.ts"],"names":[],"mappings":";;;;;;AAAA,0CAA2C;AAE3C,oDAA4B;AAE5B,MAAa,YAAY;IAIF;IAHnB,KAAK,GAAG,IAAI,GAAG,EAAwB,CAAC;IACxC,YAAY,CAA0B;IAEtC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CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtG,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;IAC9B,IAAI,CAAC,KAAK,GAAG,gBAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AALD,0DAKC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrypted/server",
3
- "version": "0.79.0",
3
+ "version": "0.81.0",
4
4
  "description": "",
5
5
  "dependencies": {
6
6
  "@mapbox/node-pre-gyp": "^1.0.11",
@@ -1,61 +1,213 @@
1
1
  import { once } from 'events';
2
2
  import { http, https } from 'follow-redirects';
3
- import { RequestOptions, IncomingMessage } from 'http';
3
+ import { IncomingMessage } from 'http';
4
+ import type { Readable } from 'stream';
5
+
6
+ export type HttpFetchResponseType = 'json' | 'text' | 'buffer' | 'readable';
7
+ export interface HttpFetchOptions<T extends HttpFetchResponseType> {
8
+ url: string | URL;
9
+ family?: 4 | 6;
10
+ method?: string;
11
+ headers?: HeadersInit;
12
+ timeout?: number;
13
+ rejectUnauthorized?: boolean;
14
+ ignoreStatusCode?: boolean;
15
+ body?: Readable;
16
+ responseType?: T;
17
+ }
18
+
19
+ export interface HttpFetchJsonOptions extends HttpFetchOptions<'json'> {
20
+ }
21
+
22
+ export interface HttpFetchBufferOptions extends HttpFetchOptions<'buffer'> {
23
+ }
24
+
25
+ export interface HttpFetchTextOptions extends HttpFetchOptions<'text'> {
26
+ }
27
+ export interface HttpFetchReadableOptions extends HttpFetchOptions<'readable'> {
28
+ }
29
+
30
+ async function readMessageBuffer(response: IncomingMessage) {
31
+ const buffers: Buffer[] = [];
32
+ response.on('data', buffer => buffers.push(buffer));
33
+ await once(response, 'end');
34
+ return Buffer.concat(buffers);
35
+ }
36
+
37
+ export interface FetchParser<T> {
38
+ accept: string;
39
+ parse(message: IncomingMessage): Promise<T>;
40
+ }
41
+
42
+ const TextParser: FetchParser<string> = {
43
+ accept: 'text/plain',
44
+ async parse(message: IncomingMessage) {
45
+ return (await readMessageBuffer(message)).toString();
46
+ }
47
+ }
48
+ const JSONParser: FetchParser<any> = {
49
+ accept: 'application/json',
50
+ async parse(message: IncomingMessage) {
51
+ return JSON.parse((await readMessageBuffer(message)).toString());
52
+ }
53
+ }
54
+
55
+ const BufferParser: FetchParser<Buffer> = {
56
+ accept: undefined as string,
57
+ async parse(message: IncomingMessage) {
58
+ return readMessageBuffer(message);
59
+ }
60
+ }
61
+
62
+ const StreamParser: FetchParser<IncomingMessage> = {
63
+ accept: undefined as string,
64
+ async parse(message: IncomingMessage) {
65
+ return message;
66
+ }
67
+ }
4
68
 
5
69
  export async function getNpmPackageInfo(pkg: string) {
6
- const { json } = await fetchJSON(`https://registry.npmjs.org/${pkg}`, {
70
+ const { body } = await httpFetch({
71
+ url: `https://registry.npmjs.org/${pkg}`,
7
72
  // force ipv4 in case of busted ipv6.
8
73
  family: 4,
74
+ responseType: 'json',
9
75
  });
10
- return json;
76
+ return body;
11
77
  }
12
78
 
13
- export async function fetchJSON(url: string, init?: RequestOptions) {
14
- init ||= {};
15
- init.headers = {
16
- ...init.headers,
17
- Accept: 'application/json',
18
- };
19
- const { body, headers } = await fetchBuffer(url, init);
20
- return {
21
- json: JSON.parse(body.toString()),
22
- headers,
23
- }
79
+ export function getHttpFetchAccept(responseType: HttpFetchResponseType) {
80
+ const { accept } = getHttpFetchParser(responseType);
81
+ return accept;
24
82
  }
25
83
 
26
- export async function fetchPostJSON(url: string, postBody: any, init?: RequestOptions) {
27
- init ||= {};
28
- init.method = 'POST';
29
- init.headers = {
30
- ...init.headers,
31
- Accept: 'application/json',
32
- 'Content-Type': 'application/json',
33
- };
84
+ export function setDefaultHttpFetchAccept(headers: Headers, responseType: HttpFetchResponseType) {
85
+ if (headers.has('Accept'))
86
+ return;
87
+ const { accept } = getHttpFetchParser(responseType);
88
+ if (accept)
89
+ headers.set('Accept', accept);
90
+ }
34
91
 
35
- const { body, headers } = await fetchBuffer(url, init, Buffer.from(JSON.stringify(postBody)));
36
- return {
37
- json: JSON.parse(body.toString()),
38
- headers,
92
+ export function fetchStatusCodeOk(statusCode: number) {
93
+ return statusCode >= 200 && statusCode <= 299;
94
+ }
95
+
96
+ export function checkStatus(statusCode: number) {
97
+ if (!fetchStatusCodeOk(statusCode))
98
+ throw new Error(`http response statusCode ${statusCode}`);
99
+ }
100
+
101
+ export interface HttpFetchResponse<T> {
102
+ statusCode: number;
103
+ headers: Headers;
104
+ body: T;
105
+ }
106
+
107
+ export function getHttpFetchParser(responseType: HttpFetchResponseType) {
108
+ switch (responseType) {
109
+ case 'json':
110
+ return JSONParser;
111
+ case 'text':
112
+ return TextParser;
113
+ case 'readable':
114
+ return StreamParser;
39
115
  }
116
+ return BufferParser;
117
+ }
118
+
119
+ export function parseResponseType(readable: IncomingMessage, responseType: HttpFetchResponseType) {
120
+ return getHttpFetchParser(responseType).parse(readable);
40
121
  }
41
122
 
42
- export async function fetchBuffer(url: string, init?: RequestOptions, body?: Buffer) {
43
- const proto = url.startsWith('https:') ? https : http;
123
+ export async function httpFetch<T extends HttpFetchOptions<HttpFetchResponseType>>(options: T): Promise<HttpFetchResponse<
124
+ // first one serves as default.
125
+ T extends HttpFetchBufferOptions ? Buffer
126
+ : T extends HttpFetchTextOptions ? string
127
+ : T extends HttpFetchReadableOptions ? IncomingMessage
128
+ : T extends HttpFetchJsonOptions ? any : Buffer
129
+ >> {
130
+ const headers = new Headers(options.headers);
131
+ setDefaultHttpFetchAccept(headers, options.responseType);
132
+
133
+ const parser = getHttpFetchParser(options.responseType);
134
+
135
+ const { url } = options;
136
+ const isSecure = url.toString().startsWith('https:');
137
+ const proto = isSecure ? https : http;
138
+
139
+ const nodeHeaders: Record<string, string[]> = {};
140
+ for (const [k, v] of headers) {
141
+ if (nodeHeaders[k]) {
142
+ nodeHeaders[k].push(v);
143
+ }
144
+ else {
145
+ nodeHeaders[k] = [v];
146
+ }
147
+ }
44
148
 
45
149
  const request = proto.request(url, {
46
- ...init,
150
+ method: options.method,
151
+ rejectUnauthorized: options.rejectUnauthorized,
152
+ family: options.family,
153
+ headers: nodeHeaders,
154
+ timeout: options.timeout,
47
155
  });
48
- if (body)
49
- request.write(body);
50
- request.end();
51
- const [response] = await once(request, 'response') as IncomingMessage[];
156
+ if (options.body)
157
+ options.body.pipe(request);
158
+ else
159
+ request.end();
160
+ const [response] = await once(request, 'response') as [IncomingMessage];
52
161
 
53
- const buffers: Buffer[] = [];
54
- response.on('data', buffer => buffers.push(buffer));
55
- await once(response, 'end');
162
+ if (!options?.ignoreStatusCode) {
163
+ try {
164
+ checkStatus(response.statusCode);
165
+ }
166
+ catch (e) {
167
+ readMessageBuffer(response).catch(() => { });
168
+ throw e;
169
+ }
170
+ }
171
+
172
+ const incomingHeaders = new Headers();
173
+ for (const [k, v] of Object.entries(response.headers)) {
174
+ for (const vv of (typeof v === 'string' ? [v] : v)) {
175
+ incomingHeaders.append(k, vv)
176
+ }
177
+ }
56
178
 
57
179
  return {
58
- headers: response.headers,
59
- body: Buffer.concat(buffers),
180
+ statusCode: response.statusCode,
181
+ headers: incomingHeaders,
182
+ body: await parser.parse(response),
60
183
  };
61
184
  }
185
+
186
+ function ensureType<T>(v: T) {
187
+ }
188
+
189
+ async function test() {
190
+ const a = await httpFetch({
191
+ url: 'http://example.com',
192
+ });
193
+
194
+ ensureType<Buffer>(a.body);
195
+
196
+ const b = await httpFetch({
197
+ url: 'http://example.com',
198
+ responseType: 'json',
199
+ });
200
+ ensureType<any>(b.body);
201
+
202
+ const c = await httpFetch({
203
+ url: 'http://example.com',
204
+ responseType: 'readable',
205
+ });
206
+ ensureType<IncomingMessage>(c.body);
207
+
208
+ const d = await httpFetch({
209
+ url: 'http://example.com',
210
+ responseType: 'buffer',
211
+ });
212
+ ensureType<Buffer>(d.body);
213
+ }
@@ -31,6 +31,7 @@ export async function safeKillFFmpeg(cp: ChildProcess) {
31
31
  catch (e) {
32
32
  }
33
33
  }
34
+ cp.kill();
34
35
  await sleep(2000);
35
36
  cp.kill('SIGKILL');
36
37
  });
@@ -1,16 +1,16 @@
1
1
  import { ScryptedStatic, SystemManager } from '@scrypted/types';
2
2
  import AdmZip from 'adm-zip';
3
- import crypto from 'crypto';
4
3
  import { once } from 'events';
5
4
  import fs from 'fs';
6
5
  import { Volume } from 'memfs';
7
6
  import net from 'net';
8
7
  import path from 'path';
9
8
  import { install as installSourceMapSupport } from 'source-map-support';
9
+ import { computeClusterObjectHash } from '../cluster/cluster-hash';
10
+ import { ClusterObject, ConnectRPCObject } from '../cluster/connect-rpc-object';
10
11
  import { listenZero } from '../listen-zero';
11
12
  import { RpcMessage, RpcPeer } from '../rpc';
12
13
  import { createDuplexRpcPeer } from '../rpc-serializer';
13
- import { ClusterObject, ConnectRPCObject } from '../cluster/connect-rpc-object';
14
14
  import { MediaManagerImpl } from './media';
15
15
  import { PluginAPI, PluginAPIProxy, PluginRemote, PluginRemoteLoadZipOptions } from './plugin-api';
16
16
  import { prepareConsoles } from './plugin-console';
@@ -19,7 +19,6 @@ import { DeviceManagerImpl, PluginReader, attachPluginRemote, setupPluginRemote
19
19
  import { PluginStats, startStatsUpdater } from './plugin-remote-stats';
20
20
  import { createREPLServer } from './plugin-repl';
21
21
  import { NodeThreadWorker } from './runtime/node-thread-worker';
22
- import { computeClusterObjectHash } from '../cluster/cluster-hash';
23
22
  const { link } = require('linkfs');
24
23
 
25
24
  const serverVersion = require('../../package.json').version;
@@ -243,6 +242,15 @@ export function startPluginRemote(mainFilename: string, pluginId: string, peerSe
243
242
  return require('fs');
244
243
  }
245
244
  try {
245
+ if (name.startsWith('.') && zipOptions?.unzippedPath) {
246
+ try {
247
+ const c = path.join(zipOptions.unzippedPath, name);
248
+ const module = require(c);
249
+ return module;
250
+ }
251
+ catch (e) {
252
+ }
253
+ }
246
254
  const module = require(name);
247
255
  return module;
248
256
  }