phirepass-widgets 0.0.7 → 0.0.8

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.
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-DQuL1Twl.js';
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["phirepass-sftp-client",[[257,"phirepass-sftp-client"]]],["phirepass-terminal",[[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);
8
+ return bootstrapLazy([["phirepass-sftp-client",[[257,"phirepass-sftp-client"]]],["phirepass-terminal",[[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);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -247,13 +247,16 @@ class Channel {
247
247
  /**
248
248
  * @param {string} endpoint
249
249
  * @param {string} node_id
250
+ * @param {string | null} [server_id]
250
251
  */
251
- constructor(endpoint, node_id) {
252
+ constructor(endpoint, node_id, server_id) {
252
253
  const ptr0 = passStringToWasm0(endpoint, wasm.__wbindgen_export, wasm.__wbindgen_export2);
253
254
  const len0 = WASM_VECTOR_LEN;
254
255
  const ptr1 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
255
256
  const len1 = WASM_VECTOR_LEN;
256
- const ret = wasm.channel_new(ptr0, len0, ptr1, len1);
257
+ var ptr2 = isLikeNone(server_id) ? 0 : passStringToWasm0(server_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
258
+ var len2 = WASM_VECTOR_LEN;
259
+ const ret = wasm.channel_new(ptr0, len0, ptr1, len1, ptr2, len2);
257
260
  this.__wbg_ptr = ret >>> 0;
258
261
  ChannelFinalization.register(this, this.__wbg_ptr, this);
259
262
  return this;
@@ -576,27 +579,27 @@ function __wbg_get_imports() {
576
579
  __wbg_set_onopen_b7b52d519d6c0f11: function(arg0, arg1) {
577
580
  getObject(arg0).onopen = getObject(arg1);
578
581
  },
579
- __wbg_warn_c98fcea8b5580ed2: function(arg0, arg1) {
582
+ __wbg_warn_3c04f620e87dffa8: function(arg0, arg1) {
580
583
  console.warn(getStringFromWasm0(arg0, arg1));
581
584
  },
582
585
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
583
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 2, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
584
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_37, __wasm_bindgen_func_elem_38);
586
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
587
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_37, __wasm_bindgen_func_elem_40);
585
588
  return addHeapObject(ret);
586
589
  },
587
590
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
588
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 2, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
589
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_37, __wasm_bindgen_func_elem_38);
591
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
592
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_37, __wasm_bindgen_func_elem_40);
590
593
  return addHeapObject(ret);
591
594
  },
592
595
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
593
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 2, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
594
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_37, __wasm_bindgen_func_elem_38);
596
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
597
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_37, __wasm_bindgen_func_elem_40);
595
598
  return addHeapObject(ret);
596
599
  },
597
600
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
598
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [], shim_idx: 6, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
599
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_37, __wasm_bindgen_func_elem_42);
601
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [], shim_idx: 2, 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_38);
600
603
  return addHeapObject(ret);
601
604
  },
602
605
  __wbindgen_cast_0000000000000005: function(arg0) {
@@ -633,12 +636,12 @@ function __wbg_get_imports() {
633
636
  };
634
637
  }
635
638
 
636
- function __wasm_bindgen_func_elem_42(arg0, arg1) {
637
- wasm.__wasm_bindgen_func_elem_42(arg0, arg1);
639
+ function __wasm_bindgen_func_elem_38(arg0, arg1) {
640
+ wasm.__wasm_bindgen_func_elem_38(arg0, arg1);
638
641
  }
639
642
 
640
- function __wasm_bindgen_func_elem_38(arg0, arg1, arg2) {
641
- wasm.__wasm_bindgen_func_elem_38(arg0, arg1, addHeapObject(arg2));
643
+ function __wasm_bindgen_func_elem_40(arg0, arg1, arg2) {
644
+ wasm.__wasm_bindgen_func_elem_40(arg0, arg1, addHeapObject(arg2));
642
645
  }
643
646
 
644
647
 
@@ -1053,6 +1056,10 @@ const PhirepassTerminal = class {
1053
1056
  this.channel.connect();
1054
1057
  }
1055
1058
  }
1059
+ serverId;
1060
+ onServerIdChange(_newValue, _oldValue) {
1061
+ this.onNodeIdChange(this.nodeId, this.nodeId);
1062
+ }
1056
1063
  createWebSocketEndpoint() {
1057
1064
  const protocol = this.allowInsecure ? 'ws' : 'wss';
1058
1065
  if (!this.allowInsecure && this.serverPort === 443) {
@@ -1110,7 +1117,12 @@ const PhirepassTerminal = class {
1110
1117
  }
1111
1118
  }
1112
1119
  open_comms() {
1113
- this.channel = new Channel(`${this.createWebSocketEndpoint()}/api/web/ws`, this.nodeId);
1120
+ if (this.serverId) {
1121
+ this.channel = new Channel(`${this.createWebSocketEndpoint()}/api/web/ws`, this.nodeId, this.serverId);
1122
+ }
1123
+ else {
1124
+ this.channel = new Channel(`${this.createWebSocketEndpoint()}/api/web/ws`, this.nodeId);
1125
+ }
1114
1126
  this.channel.on_connection_open(() => {
1115
1127
  this.channel.start_heartbeat(this.heartbeatInterval <= 15_000 ? 30_000 : this.heartbeatInterval);
1116
1128
  this.channel.open_ssh_tunnel(this.nodeId);
@@ -1336,11 +1348,14 @@ const PhirepassTerminal = class {
1336
1348
  this.usernameBuffer = "";
1337
1349
  }
1338
1350
  render() {
1339
- return (h$1(Host, { key: 'f554548d90e01c4a8ce0a326ebb37d53eea1f376' }, h$1("div", { key: 'afcc37241238d79e4781db3a5f5570c219647db5', id: "ccc" })));
1351
+ return (h$1(Host, { key: '101e530c574a390d3ffb99988c7f180634d73e4b' }, h$1("div", { key: '354204fab9b5e635a8d145abe19cc165b4458af8', id: "ccc" })));
1340
1352
  }
1341
1353
  static get watchers() { return {
1342
1354
  "nodeId": [{
1343
1355
  "onNodeIdChange": 0
1356
+ }],
1357
+ "serverId": [{
1358
+ "onServerIdChange": 0
1344
1359
  }]
1345
1360
  }; }
1346
1361
  };
@@ -17,5 +17,5 @@ var patchBrowser = () => {
17
17
 
18
18
  patchBrowser().then(async (options) => {
19
19
  await globalScripts();
20
- return bootstrapLazy([["phirepass-sftp-client",[[257,"phirepass-sftp-client"]]],["phirepass-terminal",[[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);
20
+ return bootstrapLazy([["phirepass-sftp-client",[[257,"phirepass-sftp-client"]]],["phirepass-terminal",[[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);
21
21
  });