phirepass-widgets 0.0.78 → 0.0.79
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.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/phirepass-sftp-client.cjs.entry.js +1 -1
- package/dist/cjs/phirepass-terminal.cjs.entry.js +1 -1
- package/dist/cjs/phirepass-vnc.cjs.entry.js +336 -0
- package/dist/cjs/phirepass-widgets.cjs.js +1 -1
- package/dist/cjs/{protocol-D5iIwePe.js → protocol-DC4eLkqJ.js} +32 -3
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/common/channel-socket.js +89 -0
- package/dist/collection/components/phirepass-vnc/phirepass-vnc.css +73 -0
- package/dist/collection/components/phirepass-vnc/phirepass-vnc.js +481 -0
- package/dist/collection/phirepass-channel_bg.wasm +0 -0
- package/dist/components/p-BR2c80mW.js +1 -0
- package/dist/components/phirepass-sftp-client.js +1 -1
- package/dist/components/phirepass-terminal.js +1 -1
- package/dist/components/phirepass-vnc.d.ts +11 -0
- package/dist/components/phirepass-vnc.js +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/phirepass-sftp-client.entry.js +1 -1
- package/dist/esm/phirepass-terminal.entry.js +1 -1
- package/dist/esm/phirepass-vnc.entry.js +334 -0
- package/dist/esm/phirepass-widgets.js +1 -1
- package/dist/esm/{protocol-DV8elohf.js → protocol-BR2c80mW.js} +31 -2
- package/dist/phirepass-widgets/{p-e6c56b50.entry.js → p-14c7611f.entry.js} +1 -1
- package/dist/phirepass-widgets/p-19e2a30c.entry.js +1 -0
- package/dist/phirepass-widgets/{p-7227a0f6.entry.js → p-339cd54e.entry.js} +1 -1
- package/dist/phirepass-widgets/p-BR2c80mW.js +1 -0
- package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
- package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
- package/dist/types/common/channel-socket.d.ts +47 -0
- package/dist/types/common/novnc.d.ts +53 -0
- package/dist/types/components/phirepass-vnc/phirepass-vnc.d.ts +52 -0
- package/dist/types/components.d.ts +101 -0
- package/package.json +3 -2
- package/dist/components/p-DV8elohf.js +0 -1
- package/dist/phirepass-widgets/p-DV8elohf.js +0 -1
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import init, { Channel as PhirepassChannel } from "phirepass-channel";
|
|
3
|
+
import { ChannelSocket } from "../../common/channel-socket";
|
|
4
|
+
import { ConnectionState, ProtocolMessageType } from "../../common/protocol";
|
|
5
|
+
export class PhirepassVnc {
|
|
6
|
+
channel;
|
|
7
|
+
containerEl;
|
|
8
|
+
socket;
|
|
9
|
+
rfb;
|
|
10
|
+
domReady = false;
|
|
11
|
+
runtimeReady = false;
|
|
12
|
+
connected = false;
|
|
13
|
+
session_id;
|
|
14
|
+
passwordPrompt = false;
|
|
15
|
+
statusMessage;
|
|
16
|
+
passwordBuffer = '';
|
|
17
|
+
el;
|
|
18
|
+
serverHost = "phirepass.com";
|
|
19
|
+
serverPort = 443;
|
|
20
|
+
allowInsecure = false;
|
|
21
|
+
heartbeatInterval = 30_000;
|
|
22
|
+
nodeId;
|
|
23
|
+
serviceId;
|
|
24
|
+
token;
|
|
25
|
+
/** Scales the remote desktop to fit the widget instead of showing scrollbars. */
|
|
26
|
+
scaleViewport = true;
|
|
27
|
+
/** Asks the VNC server to match its resolution to the widget size. */
|
|
28
|
+
resizeSession = true;
|
|
29
|
+
onNodeIdChange(newValue, _oldValue) {
|
|
30
|
+
this.reset_session_state();
|
|
31
|
+
if (this.channel && this.channel.is_connected()) {
|
|
32
|
+
this.close_comms();
|
|
33
|
+
}
|
|
34
|
+
if (newValue) {
|
|
35
|
+
this.open_comms();
|
|
36
|
+
this.channel.connect();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
serverId;
|
|
40
|
+
onServerIdChange(_newValue, _oldValue) {
|
|
41
|
+
this.onNodeIdChange(this.nodeId, this.nodeId);
|
|
42
|
+
}
|
|
43
|
+
connectionStateChanged;
|
|
44
|
+
create_web_socket_endpoint() {
|
|
45
|
+
const protocol = this.allowInsecure ? 'ws' : 'wss';
|
|
46
|
+
if (!this.allowInsecure && this.serverPort === 443) {
|
|
47
|
+
return `${protocol}://${this.serverHost}`;
|
|
48
|
+
}
|
|
49
|
+
if (this.allowInsecure && this.serverPort === 80) {
|
|
50
|
+
return `${protocol}://${this.serverHost}`;
|
|
51
|
+
}
|
|
52
|
+
return `${protocol}://${this.serverHost}:${this.serverPort}`;
|
|
53
|
+
}
|
|
54
|
+
async connectedCallback() {
|
|
55
|
+
await init();
|
|
56
|
+
this.open_comms();
|
|
57
|
+
this.runtimeReady = true;
|
|
58
|
+
if (!this.nodeId) {
|
|
59
|
+
console.warn('Prop node_id is not set. Cannot connect to VNC.');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this.try_connect();
|
|
63
|
+
}
|
|
64
|
+
componentDidLoad() {
|
|
65
|
+
this.domReady = true;
|
|
66
|
+
this.try_connect();
|
|
67
|
+
}
|
|
68
|
+
async disconnectedCallback() {
|
|
69
|
+
this.connected = false;
|
|
70
|
+
this.domReady = false;
|
|
71
|
+
this.runtimeReady = false;
|
|
72
|
+
this.close_comms();
|
|
73
|
+
}
|
|
74
|
+
try_connect() {
|
|
75
|
+
if (this.connected || !this.domReady || !this.runtimeReady) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (!this.containerEl || !this.channel) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.connect();
|
|
82
|
+
}
|
|
83
|
+
connect() {
|
|
84
|
+
this.connected = true;
|
|
85
|
+
this.channel.connect();
|
|
86
|
+
}
|
|
87
|
+
open_comms() {
|
|
88
|
+
if (this.serverId) {
|
|
89
|
+
this.channel = new PhirepassChannel(`${this.create_web_socket_endpoint()}/api/web/ws`, this.nodeId, this.serverId);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
this.channel = new PhirepassChannel(`${this.create_web_socket_endpoint()}/api/web/ws`, this.nodeId);
|
|
93
|
+
}
|
|
94
|
+
this.channel.on_connection_open(() => {
|
|
95
|
+
this.connectionStateChanged.emit([ConnectionState.Connected]);
|
|
96
|
+
this.channel.authenticate(this.token, this.nodeId);
|
|
97
|
+
});
|
|
98
|
+
this.channel.on_connection_close(() => {
|
|
99
|
+
this.connectionStateChanged.emit([ConnectionState.Disconnected]);
|
|
100
|
+
this.teardown_rfb();
|
|
101
|
+
});
|
|
102
|
+
this.channel.on_connection_error((err) => {
|
|
103
|
+
this.connectionStateChanged.emit([ConnectionState.Error, err]);
|
|
104
|
+
this.socket?.failed(err);
|
|
105
|
+
});
|
|
106
|
+
this.channel.on_connection_message((_raw_) => {
|
|
107
|
+
// raw frames are handled by on_protocol_message below
|
|
108
|
+
});
|
|
109
|
+
this.channel.on_protocol_message((msg) => {
|
|
110
|
+
const { web } = msg.data;
|
|
111
|
+
switch (web.type) {
|
|
112
|
+
case ProtocolMessageType.Error:
|
|
113
|
+
this.handle_error(web);
|
|
114
|
+
break;
|
|
115
|
+
case ProtocolMessageType.AuthSuccess:
|
|
116
|
+
this.handle_auth_success(web);
|
|
117
|
+
break;
|
|
118
|
+
case ProtocolMessageType.TunnelOpened:
|
|
119
|
+
this.handle_tunnel_opened(web);
|
|
120
|
+
break;
|
|
121
|
+
case ProtocolMessageType.TunnelClosed:
|
|
122
|
+
this.handle_tunnel_closed(web);
|
|
123
|
+
break;
|
|
124
|
+
case ProtocolMessageType.TunnelData:
|
|
125
|
+
this.handle_tunnel_data(web);
|
|
126
|
+
break;
|
|
127
|
+
default:
|
|
128
|
+
console.warn('Unknown protocol message type:', web);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
close_comms() {
|
|
133
|
+
this.teardown_rfb();
|
|
134
|
+
if (this.channel) {
|
|
135
|
+
this.channel.stop_heartbeat();
|
|
136
|
+
this.channel.disconnect();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
reset_session_state() {
|
|
140
|
+
this.session_id = undefined;
|
|
141
|
+
this.passwordPrompt = false;
|
|
142
|
+
this.passwordBuffer = '';
|
|
143
|
+
this.statusMessage = undefined;
|
|
144
|
+
}
|
|
145
|
+
handle_auth_success(_auth_) {
|
|
146
|
+
this.channel.start_heartbeat(this.heartbeatInterval <= 15_000 ? 30_000 : this.heartbeatInterval);
|
|
147
|
+
this.channel.open_vnc_tunnel(this.nodeId, this.serviceId);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* The tunnel is a byte pipe from here on: noVNC drives the RFB handshake,
|
|
151
|
+
* including authentication, over the socket adapter.
|
|
152
|
+
*/
|
|
153
|
+
async handle_tunnel_opened(web) {
|
|
154
|
+
this.session_id = web.sid;
|
|
155
|
+
this.statusMessage = undefined;
|
|
156
|
+
const socket = new ChannelSocket((data) => {
|
|
157
|
+
if (this.session_id === undefined) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
this.channel.send_vnc_tunnel_data(this.nodeId, this.session_id, data);
|
|
161
|
+
}, () => this.close_comms());
|
|
162
|
+
this.socket = socket;
|
|
163
|
+
// Loaded on demand so consumers embedding only the terminal or the SFTP
|
|
164
|
+
// client never download the RFB client.
|
|
165
|
+
const { default: RFBClient } = await import('@novnc/novnc');
|
|
166
|
+
// The element may have gone away while the module was loading.
|
|
167
|
+
if (!this.containerEl || this.socket !== socket) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const rfb = new RFBClient(this.containerEl, socket);
|
|
171
|
+
rfb.scaleViewport = this.scaleViewport;
|
|
172
|
+
rfb.resizeSession = this.resizeSession;
|
|
173
|
+
rfb.addEventListener('credentialsrequired', () => {
|
|
174
|
+
this.passwordPrompt = true;
|
|
175
|
+
});
|
|
176
|
+
rfb.addEventListener('securityfailure', (event) => {
|
|
177
|
+
const detail = event.detail;
|
|
178
|
+
this.statusMessage = detail?.reason ?? 'Authentication failed.';
|
|
179
|
+
this.connectionStateChanged.emit([ConnectionState.Error, detail]);
|
|
180
|
+
});
|
|
181
|
+
rfb.addEventListener('disconnect', () => {
|
|
182
|
+
this.statusMessage = this.statusMessage ?? 'Connection closed.';
|
|
183
|
+
});
|
|
184
|
+
this.rfb = rfb;
|
|
185
|
+
// Only now can noVNC start reading: it attaches on construction.
|
|
186
|
+
socket.open();
|
|
187
|
+
}
|
|
188
|
+
handle_tunnel_data(web) {
|
|
189
|
+
this.socket?.receive(new Uint8Array(web.data));
|
|
190
|
+
}
|
|
191
|
+
handle_tunnel_closed(_web_) {
|
|
192
|
+
this.session_id = undefined;
|
|
193
|
+
this.statusMessage = 'Connection closed.';
|
|
194
|
+
this.teardown_rfb();
|
|
195
|
+
this.close_comms();
|
|
196
|
+
}
|
|
197
|
+
handle_error(error) {
|
|
198
|
+
this.statusMessage = error.message;
|
|
199
|
+
this.connectionStateChanged.emit([ConnectionState.Error, error]);
|
|
200
|
+
this.socket?.failed(error);
|
|
201
|
+
}
|
|
202
|
+
teardown_rfb() {
|
|
203
|
+
if (this.rfb) {
|
|
204
|
+
try {
|
|
205
|
+
this.rfb.disconnect();
|
|
206
|
+
}
|
|
207
|
+
catch (err) {
|
|
208
|
+
console.warn('Failed to disconnect RFB cleanly:', err);
|
|
209
|
+
}
|
|
210
|
+
this.rfb = undefined;
|
|
211
|
+
}
|
|
212
|
+
if (this.socket) {
|
|
213
|
+
this.socket.closed();
|
|
214
|
+
this.socket = undefined;
|
|
215
|
+
}
|
|
216
|
+
this.passwordPrompt = false;
|
|
217
|
+
this.passwordBuffer = '';
|
|
218
|
+
}
|
|
219
|
+
submit_password(event) {
|
|
220
|
+
event.preventDefault();
|
|
221
|
+
this.passwordPrompt = false;
|
|
222
|
+
this.rfb?.sendCredentials({ password: this.passwordBuffer });
|
|
223
|
+
this.passwordBuffer = '';
|
|
224
|
+
}
|
|
225
|
+
render() {
|
|
226
|
+
return (h(Host, { key: '5daf583edea28d1592827dd7b96aff27bf3fd857' }, h("div", { key: '4a5f3d8b64084c3929fc16fdda7eba0de300c188', class: "screen", ref: (el) => (this.containerEl = el) }), this.passwordPrompt && (h("form", { key: 'cadd7db5b5985f332156a93eae953fadd377af54', class: "prompt", onSubmit: (event) => this.submit_password(event) }, h("label", { key: '2c1702e048c5d932e3384bacf65c4a5393aecc79', htmlFor: "vnc-password" }, "VNC password"), h("input", { key: '0e2c947e15bdbf0cd76b6414bc0d22896914af0d', id: "vnc-password", type: "password", autofocus: true, onInput: (event) => (this.passwordBuffer = event.target.value) }), h("button", { key: 'eb5b346b830f449454bb2476d12f08e5fb61a4a5', type: "submit" }, "Connect"))), this.statusMessage && !this.passwordPrompt && (h("div", { key: '28f55f457ae33e774c6914b7f6f9761bdb95b804', class: "status" }, this.statusMessage))));
|
|
227
|
+
}
|
|
228
|
+
static get is() { return "phirepass-vnc"; }
|
|
229
|
+
static get encapsulation() { return "shadow"; }
|
|
230
|
+
static get originalStyleUrls() {
|
|
231
|
+
return {
|
|
232
|
+
"$": ["phirepass-vnc.css"]
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
static get styleUrls() {
|
|
236
|
+
return {
|
|
237
|
+
"$": ["phirepass-vnc.css"]
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
static get properties() {
|
|
241
|
+
return {
|
|
242
|
+
"serverHost": {
|
|
243
|
+
"type": "string",
|
|
244
|
+
"mutable": false,
|
|
245
|
+
"complexType": {
|
|
246
|
+
"original": "string",
|
|
247
|
+
"resolved": "string",
|
|
248
|
+
"references": {}
|
|
249
|
+
},
|
|
250
|
+
"required": false,
|
|
251
|
+
"optional": false,
|
|
252
|
+
"docs": {
|
|
253
|
+
"tags": [],
|
|
254
|
+
"text": ""
|
|
255
|
+
},
|
|
256
|
+
"getter": false,
|
|
257
|
+
"setter": false,
|
|
258
|
+
"reflect": false,
|
|
259
|
+
"attribute": "server-host",
|
|
260
|
+
"defaultValue": "\"phirepass.com\""
|
|
261
|
+
},
|
|
262
|
+
"serverPort": {
|
|
263
|
+
"type": "number",
|
|
264
|
+
"mutable": false,
|
|
265
|
+
"complexType": {
|
|
266
|
+
"original": "number",
|
|
267
|
+
"resolved": "number",
|
|
268
|
+
"references": {}
|
|
269
|
+
},
|
|
270
|
+
"required": false,
|
|
271
|
+
"optional": false,
|
|
272
|
+
"docs": {
|
|
273
|
+
"tags": [],
|
|
274
|
+
"text": ""
|
|
275
|
+
},
|
|
276
|
+
"getter": false,
|
|
277
|
+
"setter": false,
|
|
278
|
+
"reflect": false,
|
|
279
|
+
"attribute": "server-port",
|
|
280
|
+
"defaultValue": "443"
|
|
281
|
+
},
|
|
282
|
+
"allowInsecure": {
|
|
283
|
+
"type": "boolean",
|
|
284
|
+
"mutable": false,
|
|
285
|
+
"complexType": {
|
|
286
|
+
"original": "boolean",
|
|
287
|
+
"resolved": "boolean",
|
|
288
|
+
"references": {}
|
|
289
|
+
},
|
|
290
|
+
"required": false,
|
|
291
|
+
"optional": false,
|
|
292
|
+
"docs": {
|
|
293
|
+
"tags": [],
|
|
294
|
+
"text": ""
|
|
295
|
+
},
|
|
296
|
+
"getter": false,
|
|
297
|
+
"setter": false,
|
|
298
|
+
"reflect": false,
|
|
299
|
+
"attribute": "allow-insecure",
|
|
300
|
+
"defaultValue": "false"
|
|
301
|
+
},
|
|
302
|
+
"heartbeatInterval": {
|
|
303
|
+
"type": "number",
|
|
304
|
+
"mutable": false,
|
|
305
|
+
"complexType": {
|
|
306
|
+
"original": "number",
|
|
307
|
+
"resolved": "number",
|
|
308
|
+
"references": {}
|
|
309
|
+
},
|
|
310
|
+
"required": false,
|
|
311
|
+
"optional": false,
|
|
312
|
+
"docs": {
|
|
313
|
+
"tags": [],
|
|
314
|
+
"text": ""
|
|
315
|
+
},
|
|
316
|
+
"getter": false,
|
|
317
|
+
"setter": false,
|
|
318
|
+
"reflect": false,
|
|
319
|
+
"attribute": "heartbeat-interval",
|
|
320
|
+
"defaultValue": "30_000"
|
|
321
|
+
},
|
|
322
|
+
"nodeId": {
|
|
323
|
+
"type": "string",
|
|
324
|
+
"mutable": false,
|
|
325
|
+
"complexType": {
|
|
326
|
+
"original": "string",
|
|
327
|
+
"resolved": "string",
|
|
328
|
+
"references": {}
|
|
329
|
+
},
|
|
330
|
+
"required": true,
|
|
331
|
+
"optional": false,
|
|
332
|
+
"docs": {
|
|
333
|
+
"tags": [],
|
|
334
|
+
"text": ""
|
|
335
|
+
},
|
|
336
|
+
"getter": false,
|
|
337
|
+
"setter": false,
|
|
338
|
+
"reflect": false,
|
|
339
|
+
"attribute": "node-id"
|
|
340
|
+
},
|
|
341
|
+
"serviceId": {
|
|
342
|
+
"type": "string",
|
|
343
|
+
"mutable": false,
|
|
344
|
+
"complexType": {
|
|
345
|
+
"original": "string",
|
|
346
|
+
"resolved": "string",
|
|
347
|
+
"references": {}
|
|
348
|
+
},
|
|
349
|
+
"required": true,
|
|
350
|
+
"optional": false,
|
|
351
|
+
"docs": {
|
|
352
|
+
"tags": [],
|
|
353
|
+
"text": ""
|
|
354
|
+
},
|
|
355
|
+
"getter": false,
|
|
356
|
+
"setter": false,
|
|
357
|
+
"reflect": false,
|
|
358
|
+
"attribute": "service-id"
|
|
359
|
+
},
|
|
360
|
+
"token": {
|
|
361
|
+
"type": "string",
|
|
362
|
+
"mutable": false,
|
|
363
|
+
"complexType": {
|
|
364
|
+
"original": "string",
|
|
365
|
+
"resolved": "string",
|
|
366
|
+
"references": {}
|
|
367
|
+
},
|
|
368
|
+
"required": true,
|
|
369
|
+
"optional": false,
|
|
370
|
+
"docs": {
|
|
371
|
+
"tags": [],
|
|
372
|
+
"text": ""
|
|
373
|
+
},
|
|
374
|
+
"getter": false,
|
|
375
|
+
"setter": false,
|
|
376
|
+
"reflect": false,
|
|
377
|
+
"attribute": "token"
|
|
378
|
+
},
|
|
379
|
+
"scaleViewport": {
|
|
380
|
+
"type": "boolean",
|
|
381
|
+
"mutable": false,
|
|
382
|
+
"complexType": {
|
|
383
|
+
"original": "boolean",
|
|
384
|
+
"resolved": "boolean",
|
|
385
|
+
"references": {}
|
|
386
|
+
},
|
|
387
|
+
"required": false,
|
|
388
|
+
"optional": false,
|
|
389
|
+
"docs": {
|
|
390
|
+
"tags": [],
|
|
391
|
+
"text": "Scales the remote desktop to fit the widget instead of showing scrollbars."
|
|
392
|
+
},
|
|
393
|
+
"getter": false,
|
|
394
|
+
"setter": false,
|
|
395
|
+
"reflect": false,
|
|
396
|
+
"attribute": "scale-viewport",
|
|
397
|
+
"defaultValue": "true"
|
|
398
|
+
},
|
|
399
|
+
"resizeSession": {
|
|
400
|
+
"type": "boolean",
|
|
401
|
+
"mutable": false,
|
|
402
|
+
"complexType": {
|
|
403
|
+
"original": "boolean",
|
|
404
|
+
"resolved": "boolean",
|
|
405
|
+
"references": {}
|
|
406
|
+
},
|
|
407
|
+
"required": false,
|
|
408
|
+
"optional": false,
|
|
409
|
+
"docs": {
|
|
410
|
+
"tags": [],
|
|
411
|
+
"text": "Asks the VNC server to match its resolution to the widget size."
|
|
412
|
+
},
|
|
413
|
+
"getter": false,
|
|
414
|
+
"setter": false,
|
|
415
|
+
"reflect": false,
|
|
416
|
+
"attribute": "resize-session",
|
|
417
|
+
"defaultValue": "true"
|
|
418
|
+
},
|
|
419
|
+
"serverId": {
|
|
420
|
+
"type": "string",
|
|
421
|
+
"mutable": false,
|
|
422
|
+
"complexType": {
|
|
423
|
+
"original": "string",
|
|
424
|
+
"resolved": "string",
|
|
425
|
+
"references": {}
|
|
426
|
+
},
|
|
427
|
+
"required": false,
|
|
428
|
+
"optional": true,
|
|
429
|
+
"docs": {
|
|
430
|
+
"tags": [],
|
|
431
|
+
"text": ""
|
|
432
|
+
},
|
|
433
|
+
"getter": false,
|
|
434
|
+
"setter": false,
|
|
435
|
+
"reflect": false,
|
|
436
|
+
"attribute": "server-id"
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
static get states() {
|
|
441
|
+
return {
|
|
442
|
+
"passwordPrompt": {},
|
|
443
|
+
"statusMessage": {}
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
static get events() {
|
|
447
|
+
return [{
|
|
448
|
+
"method": "connectionStateChanged",
|
|
449
|
+
"name": "connectionStateChanged",
|
|
450
|
+
"bubbles": true,
|
|
451
|
+
"cancelable": true,
|
|
452
|
+
"composed": true,
|
|
453
|
+
"docs": {
|
|
454
|
+
"tags": [],
|
|
455
|
+
"text": ""
|
|
456
|
+
},
|
|
457
|
+
"complexType": {
|
|
458
|
+
"original": "[ConnectionState, unknown?]",
|
|
459
|
+
"resolved": "[ConnectionState, unknown?]",
|
|
460
|
+
"references": {
|
|
461
|
+
"ConnectionState": {
|
|
462
|
+
"location": "import",
|
|
463
|
+
"path": "../../common/protocol",
|
|
464
|
+
"id": "src/common/protocol.ts::ConnectionState",
|
|
465
|
+
"referenceLocation": "ConnectionState"
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}];
|
|
470
|
+
}
|
|
471
|
+
static get elementRef() { return "el"; }
|
|
472
|
+
static get watchers() {
|
|
473
|
+
return [{
|
|
474
|
+
"propName": "nodeId",
|
|
475
|
+
"methodName": "onNodeIdChange"
|
|
476
|
+
}, {
|
|
477
|
+
"propName": "serverId",
|
|
478
|
+
"methodName": "onServerIdChange"
|
|
479
|
+
}];
|
|
480
|
+
}
|
|
481
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class n{__destroy_into_raw(){const n=this.__wbg_ptr;return this.__wbg_ptr=0,_.unregister(this),n}free(){const n=this.__destroy_into_raw();P.__wbg_channel_free(n,0)}authenticate(n,t,e){const r=N(n,P.__wbindgen_export,P.__wbindgen_export2),o=k,c=N(t,P.__wbindgen_export,P.__wbindgen_export2);P.channel_authenticate(this.__wbg_ptr,r,o,c,k,R(e)?Number.MAX_SAFE_INTEGER:e>>>0)}connect(){P.channel_connect(this.__wbg_ptr)}create_service(n,t,e,r,o,c,i,s,_,u){const a=N(n,P.__wbindgen_export,P.__wbindgen_export2),f=k,b=N(t,P.__wbindgen_export,P.__wbindgen_export2),l=k;var d=R(e)?0:N(e,P.__wbindgen_export,P.__wbindgen_export2),w=k;const g=N(r,P.__wbindgen_export,P.__wbindgen_export2),h=k;var p=R(c)?0:N(c,P.__wbindgen_export,P.__wbindgen_export2),y=k,m=R(i)?0:N(i,P.__wbindgen_export,P.__wbindgen_export2),v=k,A=R(s)?0:N(s,P.__wbindgen_export,P.__wbindgen_export2),S=k,T=R(_)?0:N(_,P.__wbindgen_export,P.__wbindgen_export2);P.channel_create_service(this.__wbg_ptr,a,f,b,l,d,w,g,h,o,p,y,m,v,A,S,T,k,R(u)?Number.MAX_SAFE_INTEGER:u>>>0)}delete_service(n,t,e){const r=N(n,P.__wbindgen_export,P.__wbindgen_export2),o=k,c=N(t,P.__wbindgen_export,P.__wbindgen_export2);P.channel_delete_service(this.__wbg_ptr,r,o,c,k,R(e)?Number.MAX_SAFE_INTEGER:e>>>0)}disconnect(){P.channel_disconnect(this.__wbg_ptr)}is_connected(){return 0!==P.channel_is_connected(this.__wbg_ptr)}is_disconnected(){return 0!==P.channel_is_disconnected(this.__wbg_ptr)}constructor(n,t,e){const r=N(n,P.__wbindgen_export,P.__wbindgen_export2),o=k,c=N(t,P.__wbindgen_export,P.__wbindgen_export2),i=k;var s=R(e)?0:N(e,P.__wbindgen_export,P.__wbindgen_export2);const u=P.channel_new(r,o,c,i,s,k);return this.__wbg_ptr=u,_.register(this,this.__wbg_ptr,this),this}on_connection_close(n){P.channel_on_connection_close(this.__wbg_ptr,R(n)?0:u(n))}on_connection_error(n){P.channel_on_connection_error(this.__wbg_ptr,R(n)?0:u(n))}on_connection_message(n){P.channel_on_connection_message(this.__wbg_ptr,R(n)?0:u(n))}on_connection_open(n){P.channel_on_connection_open(this.__wbg_ptr,R(n)?0:u(n))}on_protocol_message(n){P.channel_on_protocol_message(this.__wbg_ptr,R(n)?0:u(n))}on_protocol_message_type(n,t){const e=N(n,P.__wbindgen_export,P.__wbindgen_export2);P.channel_on_protocol_message_type(this.__wbg_ptr,e,k,R(t)?0:u(t))}open_sftp_tunnel(n,t,e,r,o){const c=N(n,P.__wbindgen_export,P.__wbindgen_export2),i=k,s=N(t,P.__wbindgen_export,P.__wbindgen_export2),_=k;var u=R(e)?0:N(e,P.__wbindgen_export,P.__wbindgen_export2),a=k,f=R(r)?0:N(r,P.__wbindgen_export,P.__wbindgen_export2);P.channel_open_sftp_tunnel(this.__wbg_ptr,c,i,s,_,u,a,f,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}open_ssh_tunnel(n,t,e,r,o){const c=N(n,P.__wbindgen_export,P.__wbindgen_export2),i=k,s=N(t,P.__wbindgen_export,P.__wbindgen_export2),_=k;var u=R(e)?0:N(e,P.__wbindgen_export,P.__wbindgen_export2),a=k,f=R(r)?0:N(r,P.__wbindgen_export,P.__wbindgen_export2);P.channel_open_ssh_tunnel(this.__wbg_ptr,c,i,s,_,u,a,f,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}open_vnc_tunnel(n,t,e){const r=N(n,P.__wbindgen_export,P.__wbindgen_export2),o=k,c=N(t,P.__wbindgen_export,P.__wbindgen_export2);P.channel_open_vnc_tunnel(this.__wbg_ptr,r,o,c,k,R(e)?Number.MAX_SAFE_INTEGER:e>>>0)}send_sftp_delete(n,t,e,r,o){const c=N(n,P.__wbindgen_export,P.__wbindgen_export2),i=k,s=N(e,P.__wbindgen_export,P.__wbindgen_export2),_=k,u=N(r,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_sftp_delete(this.__wbg_ptr,c,i,t,s,_,u,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_download_ack(n,t,e,r){const o=N(n,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_sftp_download_ack(this.__wbg_ptr,o,k,t,e,r)}send_sftp_download_chunk(n,t,e,r,o){const c=N(n,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_sftp_download_chunk(this.__wbg_ptr,c,k,t,e,r,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_download_start(n,t,e,r,o){const c=N(n,P.__wbindgen_export,P.__wbindgen_export2),i=k,s=N(e,P.__wbindgen_export,P.__wbindgen_export2),_=k,u=N(r,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_sftp_download_start(this.__wbg_ptr,c,i,t,s,_,u,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_list_data(n,t,e,r){const o=N(n,P.__wbindgen_export,P.__wbindgen_export2),c=k,i=N(e,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_sftp_list_data(this.__wbg_ptr,o,c,t,i,k,R(r)?Number.MAX_SAFE_INTEGER:r>>>0)}send_sftp_upload_chunk(n,t,e,r,o,c,i){const s=N(n,P.__wbindgen_export,P.__wbindgen_export2),_=k,u=S(c,P.__wbindgen_export);P.channel_send_sftp_upload_chunk(this.__wbg_ptr,s,_,t,e,r,o,u,k,R(i)?Number.MAX_SAFE_INTEGER:i>>>0)}send_sftp_upload_start(n,t,e,r,o,c,i){const s=N(n,P.__wbindgen_export,P.__wbindgen_export2),_=k,u=N(e,P.__wbindgen_export,P.__wbindgen_export2),a=k,f=N(r,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_sftp_upload_start(this.__wbg_ptr,s,_,t,u,a,f,k,o,c,R(i)?Number.MAX_SAFE_INTEGER:i>>>0)}send_ssh_terminal_resize(n,t,e,r,o,c){const i=N(n,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_ssh_terminal_resize(this.__wbg_ptr,i,k,t,e,r,o,c)}send_ssh_tunnel_data(n,t,e){const r=N(n,P.__wbindgen_export,P.__wbindgen_export2),o=k,c=N(e,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_ssh_tunnel_data(this.__wbg_ptr,r,o,t,c,k)}send_vnc_tunnel_data(n,t,e){const r=N(n,P.__wbindgen_export,P.__wbindgen_export2),o=k,c=S(e,P.__wbindgen_export);P.channel_send_vnc_tunnel_data(this.__wbg_ptr,r,o,t,c,k)}start_heartbeat(n){P.channel_start_heartbeat(this.__wbg_ptr,n)}stop_heartbeat(){P.channel_stop_heartbeat(this.__wbg_ptr)}update_service(n,t,e,r,o,c,i,s,_,u,a){const f=N(n,P.__wbindgen_export,P.__wbindgen_export2),b=k,l=N(t,P.__wbindgen_export,P.__wbindgen_export2),d=k,w=N(e,P.__wbindgen_export,P.__wbindgen_export2),g=k;var h=R(r)?0:N(r,P.__wbindgen_export,P.__wbindgen_export2),p=k;const y=N(o,P.__wbindgen_export,P.__wbindgen_export2),m=k;var v=R(i)?0:N(i,P.__wbindgen_export,P.__wbindgen_export2),A=k,S=R(s)?0:N(s,P.__wbindgen_export,P.__wbindgen_export2),T=k,U=R(_)?0:N(_,P.__wbindgen_export,P.__wbindgen_export2),j=k,F=R(u)?0:N(u,P.__wbindgen_export,P.__wbindgen_export2);P.channel_update_service(this.__wbg_ptr,f,b,l,d,w,g,h,p,y,m,c,v,A,S,T,U,j,F,k,R(a)?Number.MAX_SAFE_INTEGER:a>>>0)}}Symbol.dispose&&(n.prototype[Symbol.dispose]=n.prototype.free);const t=Object.freeze({Generic:0,0:"Generic",Authentication:10,10:"Authentication",RequiresUsername:100,100:"RequiresUsername",RequiresPassword:110,110:"RequiresPassword",RequiresUsernamePassword:120,120:"RequiresUsernamePassword"});function e(){const n={__proto__:null,__wbg_Error_92b29b0548f8b746:function(n,t){return u(Error(w(n,t)))},__wbg_String_8564e559799eccda:function(n,t){const e=N(String(p(t)),P.__wbindgen_export,P.__wbindgen_export2),r=k;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_debug_string_c25d447a39f5578f:function(n,t){const e=N(f(p(t)),P.__wbindgen_export,P.__wbindgen_export2),r=k;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_string_get_b0ca35b86a603356:function(n,t){const e=p(t),r="string"==typeof e?e:void 0;var o=R(r)?0:N(r,P.__wbindgen_export,P.__wbindgen_export2),c=k;d().setInt32(n+4,c,!0),d().setInt32(n+0,o,!0)},__wbg___wbindgen_throw_344f42d3211c4765:function(n,t){throw new Error(w(n,t))},__wbg__wbg_cb_unref_fffb441def202758:function(n){p(n)._wbg_cb_unref()},__wbg_call_8a2dd23819f8a60a:function(){return y((function(n,t){return u(p(n).call(p(t)))}),arguments)},__wbg_call_a6e5c5dce5018821:function(){return y((function(n,t,e){return u(p(n).call(p(t),p(e)))}),arguments)},__wbg_call_e3b662382210db98:function(){return y((function(n,t,e,r){return u(p(n).call(p(t),p(e),p(r)))}),arguments)},__wbg_clearInterval_26ba580547547579:function(n){return u(clearInterval(T(n)))},__wbg_close_c65ca0257e895318:function(){return y((function(n){p(n).close()}),arguments)},__wbg_data_328de4280640da92:function(n){return u(p(n).data)},__wbg_from_13e323c65fc8f464:function(n){return u(Array.from(p(n)))},__wbg_getRandomValues_3f44b700395062e5:function(){return y((function(n,t){globalThis.crypto.getRandomValues(b(n,t))}),arguments)},__wbg_get_78f252d074a84d0b:function(){return y((function(n,t){return u(Reflect.get(p(n),p(t)))}),arguments)},__wbg_info_126a81f879b26b73:function(n,t){console.info(w(n,t))},__wbg_instanceof_ArrayBuffer_4480b9e0068a8adb:function(n){let t;try{t=p(n)instanceof ArrayBuffer}catch(n){t=!1}return t},__wbg_length_1f0964f4a5e2c6d8:function(n){return p(n).length},__wbg_new_32b398fb48b6d94a:function(){return u(new Array)},__wbg_new_cd45aabdf6073e84:function(n){return u(new Uint8Array(p(n)))},__wbg_new_da52cf8fe3429cb2:function(){return u(new Object)},__wbg_new_with_str_sequence_2de2f569c29910ad:function(){return y((function(n,t,e){return u(new WebSocket(w(n,t),p(e)))}),arguments)},__wbg_prototypesetcall_4770620bbe4688a0:function(n,t,e){Uint8Array.prototype.set.call(b(n,t),p(e))},__wbg_push_d2ae3af0c1217ae6:function(n,t){return p(n).push(p(t))},__wbg_readyState_50bc38c2a9e83db6:function(n){return p(n).readyState},__wbg_send_a321b376d40ec867:function(){return y((function(n,t,e){p(n).send(b(t,e))}),arguments)},__wbg_setInterval_cbf1c35c6a692d37:function(){return y((function(n,t){return u(setInterval(p(n),t))}),arguments)},__wbg_set_6be42768c690e380:function(n,t,e){p(n)[T(t)]=T(e)},__wbg_set_8a16b38e4805b298:function(n,t,e){p(n)[t>>>0]=T(e)},__wbg_set_binaryType_a37b086c78ca7c29:function(n,t){p(n).binaryType=s[t]},__wbg_set_onclose_f706475385ecce07:function(n,t){p(n).onclose=p(t)},__wbg_set_onerror_9f5773fd31512333:function(n,t){p(n).onerror=p(t)},__wbg_set_onmessage_836d2f72130b4706:function(n,t){p(n).onmessage=p(t)},__wbg_set_onopen_4f65470ae522a61a:function(n,t){p(n).onopen=p(t)},__wbg_warn_a34cc328d5dc529a:function(n,t){console.warn(w(n,t))},__wbindgen_cast_0000000000000001:function(n,t){return u(A(n,t,o))},__wbindgen_cast_0000000000000002:function(n,t){return u(A(n,t,c))},__wbindgen_cast_0000000000000003:function(n,t){return u(A(n,t,i))},__wbindgen_cast_0000000000000004:function(n,t){return u(A(n,t,r))},__wbindgen_cast_0000000000000005:function(n){return u(n)},__wbindgen_cast_0000000000000006:function(n,t){return u(b(n,t))},__wbindgen_cast_0000000000000007:function(n,t){return u(w(n,t))},__wbindgen_cast_0000000000000008:function(n){return u(BigInt.asUintN(64,n))},__wbindgen_object_clone_ref:function(n){return u(p(n))},__wbindgen_object_drop_ref:function(n){T(n)}};return{__proto__:null,"./phirepass-channel_bg.js":n}}function r(n,t){P.__wasm_bindgen_func_elem_63(n,t)}function o(n,t,e){P.__wasm_bindgen_func_elem_59(n,t,u(e))}function c(n,t,e){P.__wasm_bindgen_func_elem_59_1(n,t,u(e))}function i(n,t,e){P.__wasm_bindgen_func_elem_59_2(n,t,u(e))}const s=["blob","arraybuffer"],_="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>P.__wbg_channel_free(n,1)));function u(n){v===m.length&&m.push(m.length+1);const t=v;return v=m[t],m[t]=n,t}const a="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>P.__wbindgen_export4(n.a,n.b)));function f(n){const t=typeof n;if("number"==t||"boolean"==t||null==n)return`${n}`;if("string"==t)return`"${n}"`;if("symbol"==t){const t=n.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=n.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(n)){const t=n.length;let e="[";t>0&&(e+=f(n[0]));for(let r=1;r<t;r++)e+=", "+f(n[r]);return e+="]",e}const e=/\[object ([^\]]+)\]/.exec(toString.call(n));let r;if(!(e&&e.length>1))return toString.call(n);if(r=e[1],"Object"==r)try{return"Object("+JSON.stringify(n)+")"}catch(n){return"Object"}return n instanceof Error?`${n.name}: ${n.message}\n${n.stack}`:r}function b(n,t){return n>>>=0,h().subarray(n/1,n/1+t)}let l=null;function d(){return(null===l||!0===l.buffer.detached||void 0===l.buffer.detached&&l.buffer!==P.memory.buffer)&&(l=new DataView(P.memory.buffer)),l}function w(n,t){return function(n,t){return F+=t,F>=j&&(U=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),U.decode(),F=t),U.decode(h().subarray(n,n+t))}(n>>>0,t)}let g=null;function h(){return null!==g&&0!==g.byteLength||(g=new Uint8Array(P.memory.buffer)),g}function p(n){return m[n]}function y(n,t){try{return n.apply(this,t)}catch(n){P.__wbindgen_export3(u(n))}}let m=new Array(1024).fill(void 0);m.push(void 0,null,!0,!1);let v=m.length;function R(n){return null==n}function A(n,t,e){const r={a:n,b:t,cnt:1},o=(...n)=>{r.cnt++;const t=r.a;r.a=0;try{return e(t,r.b,...n)}finally{r.a=t,o._wbg_cb_unref()}};return o._wbg_cb_unref=()=>{0==--r.cnt&&(P.__wbindgen_export4(r.a,r.b),r.a=0,a.unregister(r))},a.register(o,r,r),o}function S(n,t){const e=t(1*n.length,1)>>>0;return h().set(n,e/1),k=n.length,e}function N(n,t,e){if(void 0===e){const e=O.encode(n),r=t(e.length,1)>>>0;return h().subarray(r,r+e.length).set(e),k=e.length,r}let r=n.length,o=t(r,1)>>>0;const c=h();let i=0;for(;i<r;i++){const t=n.charCodeAt(i);if(t>127)break;c[o+i]=t}if(i!==r){0!==i&&(n=n.slice(i)),o=e(o,r,r=i+3*n.length,1)>>>0;const t=h().subarray(o+i,o+r);i+=O.encodeInto(n,t).written,o=e(o,r,i,1)>>>0}return k=i,o}function T(n){const t=p(n);return function(n){n<1028||(m[n]=v,v=n)}(n),t}let U=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});U.decode();const j=2146435072;let F=0;const O=new TextEncoder;"encodeInto"in O||(O.encodeInto=function(n,t){const e=O.encode(n);return t.set(e),{read:n.length,written:e.length}});let P,k=0;async function q(n){if(void 0!==P)return P;void 0!==n&&(Object.getPrototypeOf(n)===Object.prototype?({module_or_path:n}=n):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===n&&(n=new URL("phirepass-channel_bg.wasm",import.meta.url));const t=e();("string"==typeof n||"function"==typeof Request&&n instanceof Request||"function"==typeof URL&&n instanceof URL)&&(n=fetch(n));const{instance:r}=await async function(n,t){if("function"==typeof Response&&n instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(n,t)}catch(t){if(!n.ok||!function(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}(n.type)||"application/wasm"===n.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const e=await n.arrayBuffer();return await WebAssembly.instantiate(e,t)}{const e=await WebAssembly.instantiate(n,t);return e instanceof WebAssembly.Instance?{instance:e,module:n}:e}}(await n,t);return function(n){return P=n.exports,l=null,g=null,P}(r)}var I,W,E;!function(n){n.Error="Error",n.AuthSuccess="AuthSuccess",n.TunnelOpened="TunnelOpened",n.TunnelClosed="TunnelClosed",n.TunnelData="TunnelData",n.SFTPListItems="SFTPListItems",n.SFTPDownloadStartResponse="SFTPDownloadStartResponse",n.SFTPDownloadChunk="SFTPDownloadChunk",n.SFTPUploadStartResponse="SFTPUploadStartResponse",n.SFTPUploadChunkAck="SFTPUploadChunkAck"}(I||(I={})),function(n){n[n.Username=0]="Username",n[n.Password=1]="Password",n[n.Default=2]="Default"}(W||(W={})),function(n){n.Disconnected="disconnected",n.Connected="connected",n.Error="error"}(E||(E={}));export{n as C,t as E,W as I,I as P,q as _,E as a}
|