bdy 1.17.8-dev → 1.17.9-dev

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.17.8-dev",
4
+ "version": "1.17.9-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -68,7 +68,7 @@ class Agent extends events_1.default {
68
68
  else {
69
69
  logger_1.default.debug('Socket fetch tunnel after sync push');
70
70
  if (this.socket) {
71
- this.socket.fetch(!this.disabled, null, null, false, []);
71
+ this.socket.fetch(!this.disabled, null, null, false, [], false, 1000);
72
72
  }
73
73
  }
74
74
  }
@@ -99,7 +99,7 @@ class Agent extends events_1.default {
99
99
  }
100
100
  }
101
101
  if (shouldFetch && this.socket) {
102
- this.socket.fetch(!this.disabled, null, null, false, []);
102
+ this.socket.fetch(!this.disabled, null, null, false, [], false, 1000);
103
103
  }
104
104
  }
105
105
  }
@@ -115,7 +115,8 @@ class Agent extends events_1.default {
115
115
  try {
116
116
  if (data.agent.action)
117
117
  await this.makeAction(data.agent.action);
118
- this.refreshTunnels(data.tunnels || []);
118
+ const filtered = (data.tunnels || []).filter((t) => !!t.domain);
119
+ this.refreshTunnels(filtered);
119
120
  }
120
121
  catch (err) {
121
122
  logger_1.default.error('Fetch error');
@@ -224,47 +225,39 @@ class Agent extends events_1.default {
224
225
  if (this.tunnelsUpdating)
225
226
  return;
226
227
  this.tunnelsUpdating = true;
227
- let hasTunnels = false;
228
- let haveTunnels = false;
229
228
  try {
230
229
  const tt = [...this.tunnels];
231
- hasTunnels = tt.length > 0;
232
- haveTunnels = tunnels.length > 0;
233
- if (hasTunnels) {
234
- tt.forEach((tunnel) => {
235
- if (!tunnels.find((t) => t.id === tunnel.id)) {
236
- this.destroyTunnel(tunnel.id);
237
- }
238
- });
239
- }
240
- if (haveTunnels) {
241
- tunnels.forEach((data) => {
242
- let sshHostKey;
243
- if (this.manager)
244
- sshHostKey = this.manager.sshHostKey;
245
- const tunnel = tt.find((tunnel) => data.id === tunnel.id);
246
- if (!tunnel) {
247
- this.addTunnel(new tunnel_1.default({
248
- ...data,
249
- sshHostKey,
250
- agent: {
251
- id: this.id,
252
- host: this.host,
253
- token: this.token,
254
- },
255
- }));
256
- }
257
- else if (tunnel.hasChanged(data)) {
258
- tunnel.recreate(data);
259
- }
260
- });
261
- }
230
+ tt.forEach((tunnel) => {
231
+ if (!tunnels.find((t) => t.id === tunnel.id)) {
232
+ this.destroyTunnel(tunnel.id);
233
+ }
234
+ });
235
+ tunnels.forEach((data) => {
236
+ let sshHostKey;
237
+ if (this.manager)
238
+ sshHostKey = this.manager.sshHostKey;
239
+ const tunnel = tt.find((tunnel) => data.id === tunnel.id);
240
+ if (!tunnel) {
241
+ this.addTunnel(new tunnel_1.default({
242
+ ...data,
243
+ sshHostKey,
244
+ agent: {
245
+ id: this.id,
246
+ host: this.host,
247
+ token: this.token,
248
+ },
249
+ }));
250
+ }
251
+ else if (tunnel.hasChanged(data)) {
252
+ tunnel.recreate(data);
253
+ }
254
+ });
262
255
  }
263
256
  catch {
264
257
  // do nothing
265
258
  }
266
259
  this.tunnelsUpdating = false;
267
- if (!this.service && hasTunnels && !haveTunnels) {
260
+ if (!this.service && !tunnels.length) {
268
261
  output_1.default.exitError(texts_1.ERR_TUNNEL_REMOVED);
269
262
  }
270
263
  }
@@ -29,19 +29,21 @@ class AgentSocketClient extends events_1.default {
29
29
  logger_1.default.debug(data);
30
30
  this.socket.emit(msg, data);
31
31
  }
32
- fetch(activate = true, action = null, disabled = null, resetFirstHeard = false, tunnels, forceThrough = false) {
33
- this.socketEmit('fetchTunnelAgent', {
34
- id: this.id,
35
- token: this.token,
36
- hostname: this.hostname,
37
- platform: this.platform,
38
- version: this.version,
39
- activate,
40
- action,
41
- disabled,
42
- resetFirstHeard,
43
- tunnels,
44
- }, forceThrough);
32
+ fetch(activate = true, action = null, disabled = null, resetFirstHeard = false, tunnels, forceThrough = false, timeout = 0) {
33
+ setTimeout(() => {
34
+ this.socketEmit('fetchTunnelAgent', {
35
+ id: this.id,
36
+ token: this.token,
37
+ hostname: this.hostname,
38
+ platform: this.platform,
39
+ version: this.version,
40
+ activate,
41
+ action,
42
+ disabled,
43
+ resetFirstHeard,
44
+ tunnels,
45
+ }, forceThrough);
46
+ }, timeout);
45
47
  }
46
48
  update(activate, tunnels, force = false) {
47
49
  const now = Date.now();
@@ -21,7 +21,7 @@ commandSandboxList.action(async (options) => {
21
21
  output_1.default.exitNormal('No sandboxes found');
22
22
  }
23
23
  const data = [
24
- ['NAME', 'STATUS', 'SETUP STATUS', 'ID', 'IDENTIFIER', 'URL'],
24
+ ['NAME', 'STATUS', 'SETUP_STATUS', 'ID', 'IDENTIFIER', 'URL'],
25
25
  ];
26
26
  for (const sandbox of sandboxes) {
27
27
  data.push([
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.17.8-dev",
4
+ "version": "1.17.9-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {