phirepass-widgets 0.0.7 → 0.0.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.
@@ -6,7 +6,7 @@ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
6
6
  const defineCustomElements = async (win, options) => {
7
7
  if (typeof window === 'undefined') return undefined;
8
8
  await appGlobals.globalScripts();
9
- return index.bootstrapLazy([["phirepass-sftp-client.cjs",[[257,"phirepass-sftp-client"]]],["phirepass-terminal.cjs",[[513,"phirepass-terminal",{"terminalOptions":[16],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"]},null,{"nodeId":[{"onNodeIdChange":0}]}]]]], options);
9
+ return index.bootstrapLazy([["phirepass-sftp-client.cjs",[[257,"phirepass-sftp-client"]]],["phirepass-terminal.cjs",[[513,"phirepass-terminal",{"terminalOptions":[16],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"serverId":[1,"server-id"]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]]], options);
10
10
  };
11
11
 
12
12
  exports.setNonce = index.setNonce;
@@ -250,13 +250,16 @@ class Channel {
250
250
  /**
251
251
  * @param {string} endpoint
252
252
  * @param {string} node_id
253
+ * @param {string | null} [server_id]
253
254
  */
254
- constructor(endpoint, node_id) {
255
+ constructor(endpoint, node_id, server_id) {
255
256
  const ptr0 = passStringToWasm0(endpoint, wasm.__wbindgen_export, wasm.__wbindgen_export2);
256
257
  const len0 = WASM_VECTOR_LEN;
257
258
  const ptr1 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
258
259
  const len1 = WASM_VECTOR_LEN;
259
- const ret = wasm.channel_new(ptr0, len0, ptr1, len1);
260
+ var ptr2 = isLikeNone(server_id) ? 0 : passStringToWasm0(server_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
261
+ var len2 = WASM_VECTOR_LEN;
262
+ const ret = wasm.channel_new(ptr0, len0, ptr1, len1, ptr2, len2);
260
263
  this.__wbg_ptr = ret >>> 0;
261
264
  ChannelFinalization.register(this, this.__wbg_ptr, this);
262
265
  return this;
@@ -579,7 +582,7 @@ function __wbg_get_imports() {
579
582
  __wbg_set_onopen_b7b52d519d6c0f11: function(arg0, arg1) {
580
583
  getObject(arg0).onopen = getObject(arg1);
581
584
  },
582
- __wbg_warn_c98fcea8b5580ed2: function(arg0, arg1) {
585
+ __wbg_warn_cc9375c8d95d2b16: function(arg0, arg1) {
583
586
  console.warn(getStringFromWasm0(arg0, arg1));
584
587
  },
585
588
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
@@ -598,8 +601,8 @@ function __wbg_get_imports() {
598
601
  return addHeapObject(ret);
599
602
  },
600
603
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
601
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [], shim_idx: 6, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
602
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_37, __wasm_bindgen_func_elem_42);
604
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [], shim_idx: 5, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
605
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_37, __wasm_bindgen_func_elem_41);
603
606
  return addHeapObject(ret);
604
607
  },
605
608
  __wbindgen_cast_0000000000000005: function(arg0) {
@@ -636,8 +639,8 @@ function __wbg_get_imports() {
636
639
  };
637
640
  }
638
641
 
639
- function __wasm_bindgen_func_elem_42(arg0, arg1) {
640
- wasm.__wasm_bindgen_func_elem_42(arg0, arg1);
642
+ function __wasm_bindgen_func_elem_41(arg0, arg1) {
643
+ wasm.__wasm_bindgen_func_elem_41(arg0, arg1);
641
644
  }
642
645
 
643
646
  function __wasm_bindgen_func_elem_38(arg0, arg1, arg2) {
@@ -1056,6 +1059,10 @@ const PhirepassTerminal = class {
1056
1059
  this.channel.connect();
1057
1060
  }
1058
1061
  }
1062
+ serverId;
1063
+ onServerIdChange(_newValue, _oldValue) {
1064
+ this.onNodeIdChange(this.nodeId, this.nodeId);
1065
+ }
1059
1066
  createWebSocketEndpoint() {
1060
1067
  const protocol = this.allowInsecure ? 'ws' : 'wss';
1061
1068
  if (!this.allowInsecure && this.serverPort === 443) {
@@ -1113,7 +1120,12 @@ const PhirepassTerminal = class {
1113
1120
  }
1114
1121
  }
1115
1122
  open_comms() {
1116
- this.channel = new Channel(`${this.createWebSocketEndpoint()}/api/web/ws`, this.nodeId);
1123
+ if (this.serverId) {
1124
+ this.channel = new Channel(`${this.createWebSocketEndpoint()}/api/web/ws`, this.nodeId, this.serverId);
1125
+ }
1126
+ else {
1127
+ this.channel = new Channel(`${this.createWebSocketEndpoint()}/api/web/ws`, this.nodeId);
1128
+ }
1117
1129
  this.channel.on_connection_open(() => {
1118
1130
  this.channel.start_heartbeat(this.heartbeatInterval <= 15_000 ? 30_000 : this.heartbeatInterval);
1119
1131
  this.channel.open_ssh_tunnel(this.nodeId);
@@ -1339,11 +1351,14 @@ const PhirepassTerminal = class {
1339
1351
  this.usernameBuffer = "";
1340
1352
  }
1341
1353
  render() {
1342
- return (index.h(index.Host, { key: 'f554548d90e01c4a8ce0a326ebb37d53eea1f376' }, index.h("div", { key: 'afcc37241238d79e4781db3a5f5570c219647db5', id: "ccc" })));
1354
+ return (index.h(index.Host, { key: '101e530c574a390d3ffb99988c7f180634d73e4b' }, index.h("div", { key: '354204fab9b5e635a8d145abe19cc165b4458af8', id: "ccc" })));
1343
1355
  }
1344
1356
  static get watchers() { return {
1345
1357
  "nodeId": [{
1346
1358
  "onNodeIdChange": 0
1359
+ }],
1360
+ "serverId": [{
1361
+ "onServerIdChange": 0
1347
1362
  }]
1348
1363
  }; }
1349
1364
  };
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["phirepass-sftp-client.cjs",[[257,"phirepass-sftp-client"]]],["phirepass-terminal.cjs",[[513,"phirepass-terminal",{"terminalOptions":[16],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"]},null,{"nodeId":[{"onNodeIdChange":0}]}]]]], options);
22
+ return index.bootstrapLazy([["phirepass-sftp-client.cjs",[[257,"phirepass-sftp-client"]]],["phirepass-terminal.cjs",[[513,"phirepass-terminal",{"terminalOptions":[16],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"serverId":[1,"server-id"]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -104,6 +104,10 @@ export class PhirepassTerminal {
104
104
  this.channel.connect();
105
105
  }
106
106
  }
107
+ serverId;
108
+ onServerIdChange(_newValue, _oldValue) {
109
+ this.onNodeIdChange(this.nodeId, this.nodeId);
110
+ }
107
111
  createWebSocketEndpoint() {
108
112
  const protocol = this.allowInsecure ? 'ws' : 'wss';
109
113
  if (!this.allowInsecure && this.serverPort === 443) {
@@ -161,7 +165,12 @@ export class PhirepassTerminal {
161
165
  }
162
166
  }
163
167
  open_comms() {
164
- this.channel = new PhirepassChannel(`${this.createWebSocketEndpoint()}/api/web/ws`, this.nodeId);
168
+ if (this.serverId) {
169
+ this.channel = new PhirepassChannel(`${this.createWebSocketEndpoint()}/api/web/ws`, this.nodeId, this.serverId);
170
+ }
171
+ else {
172
+ this.channel = new PhirepassChannel(`${this.createWebSocketEndpoint()}/api/web/ws`, this.nodeId);
173
+ }
165
174
  this.channel.on_connection_open(() => {
166
175
  this.channel.start_heartbeat(this.heartbeatInterval <= 15_000 ? 30_000 : this.heartbeatInterval);
167
176
  this.channel.open_ssh_tunnel(this.nodeId);
@@ -387,7 +396,7 @@ export class PhirepassTerminal {
387
396
  this.usernameBuffer = "";
388
397
  }
389
398
  render() {
390
- return (h(Host, { key: 'f554548d90e01c4a8ce0a326ebb37d53eea1f376' }, h("div", { key: 'afcc37241238d79e4781db3a5f5570c219647db5', id: "ccc" })));
399
+ return (h(Host, { key: '101e530c574a390d3ffb99988c7f180634d73e4b' }, h("div", { key: '354204fab9b5e635a8d145abe19cc165b4458af8', id: "ccc" })));
391
400
  }
392
401
  static get is() { return "phirepass-terminal"; }
393
402
  static get encapsulation() { return "shadow"; }
@@ -519,6 +528,25 @@ export class PhirepassTerminal {
519
528
  "setter": false,
520
529
  "reflect": false,
521
530
  "attribute": "node-id"
531
+ },
532
+ "serverId": {
533
+ "type": "string",
534
+ "mutable": false,
535
+ "complexType": {
536
+ "original": "string",
537
+ "resolved": "string",
538
+ "references": {}
539
+ },
540
+ "required": false,
541
+ "optional": true,
542
+ "docs": {
543
+ "tags": [],
544
+ "text": ""
545
+ },
546
+ "getter": false,
547
+ "setter": false,
548
+ "reflect": false,
549
+ "attribute": "server-id"
522
550
  }
523
551
  };
524
552
  }
@@ -527,6 +555,9 @@ export class PhirepassTerminal {
527
555
  return [{
528
556
  "propName": "nodeId",
529
557
  "methodName": "onNodeIdChange"
558
+ }, {
559
+ "propName": "serverId",
560
+ "methodName": "onServerIdChange"
530
561
  }];
531
562
  }
532
563
  }