phirepass-widgets 0.0.79 → 0.0.81

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.
Files changed (44) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/phirepass-rdp.cjs.entry.js +308 -0
  3. package/dist/cjs/phirepass-sftp-client.cjs.entry.js +17 -17
  4. package/dist/cjs/phirepass-terminal.cjs.entry.js +2 -2
  5. package/dist/cjs/phirepass-widgets.cjs.js +1 -1
  6. package/dist/cjs/{protocol-DC4eLkqJ.js → protocol-DS0qXomZ.js} +25 -26
  7. package/dist/collection/collection-manifest.json +2 -2
  8. package/dist/collection/common/protocol.js +1 -0
  9. package/dist/collection/components/{phirepass-vnc/phirepass-vnc.css → phirepass-rdp/phirepass-rdp.css} +9 -2
  10. package/dist/collection/components/{phirepass-vnc/phirepass-vnc.js → phirepass-rdp/phirepass-rdp.js} +198 -90
  11. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +16 -16
  12. package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +1 -1
  13. package/dist/collection/phirepass-channel_bg.wasm +0 -0
  14. package/dist/components/p-CWIhN33k.js +1 -0
  15. package/dist/components/{phirepass-vnc.d.ts → phirepass-rdp.d.ts} +4 -4
  16. package/dist/components/phirepass-rdp.js +1 -0
  17. package/dist/components/phirepass-sftp-client.js +1 -1
  18. package/dist/components/phirepass-terminal.js +2 -2
  19. package/dist/esm/loader.js +1 -1
  20. package/dist/esm/phirepass-rdp.entry.js +306 -0
  21. package/dist/esm/phirepass-sftp-client.entry.js +17 -17
  22. package/dist/esm/phirepass-terminal.entry.js +2 -2
  23. package/dist/esm/phirepass-widgets.js +1 -1
  24. package/dist/esm/{protocol-BR2c80mW.js → protocol-CWIhN33k.js} +24 -25
  25. package/dist/phirepass-widgets/{p-339cd54e.entry.js → p-19789356.entry.js} +1 -1
  26. package/dist/phirepass-widgets/{p-14c7611f.entry.js → p-2478a6eb.entry.js} +2 -2
  27. package/dist/phirepass-widgets/p-CWIhN33k.js +1 -0
  28. package/dist/phirepass-widgets/p-a5528005.entry.js +1 -0
  29. package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
  30. package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
  31. package/dist/types/common/protocol.d.ts +17 -1
  32. package/dist/types/components/phirepass-rdp/phirepass-rdp.d.ts +90 -0
  33. package/dist/types/components.d.ts +136 -90
  34. package/package.json +4 -3
  35. package/dist/cjs/phirepass-vnc.cjs.entry.js +0 -336
  36. package/dist/collection/common/channel-socket.js +0 -89
  37. package/dist/components/p-BR2c80mW.js +0 -1
  38. package/dist/components/phirepass-vnc.js +0 -1
  39. package/dist/esm/phirepass-vnc.entry.js +0 -334
  40. package/dist/phirepass-widgets/p-19e2a30c.entry.js +0 -1
  41. package/dist/phirepass-widgets/p-BR2c80mW.js +0 -1
  42. package/dist/types/common/channel-socket.d.ts +0 -47
  43. package/dist/types/common/novnc.d.ts +0 -53
  44. package/dist/types/components/phirepass-vnc/phirepass-vnc.d.ts +0 -52
@@ -1,334 +0,0 @@
1
- import { r as registerInstance, c as createEvent, g as getElement, h, H as Host } from './index-DovZQ7sb.js';
2
- import { _ as __wbg_init, C as Channel, a as ConnectionState, P as ProtocolMessageType } from './protocol-BR2c80mW.js';
3
-
4
- /**
5
- * Presents a phirepass tunnel as the "raw channel" noVNC expects in place of a
6
- * WebSocket.
7
- *
8
- * noVNC's `Websock.attach()` validates the object it is handed against a fixed
9
- * property list — `send`, `close`, `binaryType`, `onerror`, `onmessage`,
10
- * `onopen`, `protocol`, `readyState` — collected from `Object.keys(channel)`
11
- * plus the own property names of its prototype. Methods and getters satisfy
12
- * that from the prototype; the event handlers only satisfy it if they are
13
- * *assigned* in the constructor, so every one of them is initialised to `null`
14
- * below even though TypeScript would not otherwise require it. Leaving one
15
- * merely declared makes `attach()` throw "Raw channel missing property".
16
- */
17
- /** Matches the numeric `WebSocket.readyState` constants noVNC compares against. */
18
- var ChannelSocketState;
19
- (function (ChannelSocketState) {
20
- ChannelSocketState[ChannelSocketState["Connecting"] = 0] = "Connecting";
21
- ChannelSocketState[ChannelSocketState["Open"] = 1] = "Open";
22
- ChannelSocketState[ChannelSocketState["Closing"] = 2] = "Closing";
23
- ChannelSocketState[ChannelSocketState["Closed"] = 3] = "Closed";
24
- })(ChannelSocketState || (ChannelSocketState = {}));
25
- class ChannelSocket {
26
- /** noVNC overwrites this with "arraybuffer" during attach. */
27
- binaryType = 'arraybuffer';
28
- /** Always empty: there is no WebSocket sub-protocol negotiation here. */
29
- protocol = '';
30
- readyState = ChannelSocketState.Connecting;
31
- onopen = null;
32
- onmessage = null;
33
- onclose = null;
34
- onerror = null;
35
- sendData;
36
- closeTunnel;
37
- constructor(sendData, closeTunnel) {
38
- this.sendData = sendData;
39
- this.closeTunnel = closeTunnel;
40
- }
41
- /** Marks the tunnel as usable and lets noVNC start the RFB handshake. */
42
- open() {
43
- if (this.readyState !== ChannelSocketState.Connecting) {
44
- return;
45
- }
46
- this.readyState = ChannelSocketState.Open;
47
- this.onopen?.();
48
- }
49
- /** Hands bytes arriving from the node up to noVNC. */
50
- receive(data) {
51
- if (this.readyState !== ChannelSocketState.Open) {
52
- return;
53
- }
54
- // Copy into a standalone buffer: the incoming view may be backed by
55
- // wasm memory that is reused or detached after this call returns.
56
- const buffer = new ArrayBuffer(data.byteLength);
57
- new Uint8Array(buffer).set(data);
58
- this.onmessage?.({ data: buffer });
59
- }
60
- /** Ends the socket from the phirepass side (tunnel closed, disconnect). */
61
- closed() {
62
- if (this.readyState === ChannelSocketState.Closed) {
63
- return;
64
- }
65
- this.readyState = ChannelSocketState.Closed;
66
- this.onclose?.();
67
- }
68
- failed(error) {
69
- this.onerror?.(error);
70
- this.closed();
71
- }
72
- // ── the surface noVNC calls ───────────────────────────────────────────────
73
- send(data) {
74
- if (this.readyState !== ChannelSocketState.Open) {
75
- return;
76
- }
77
- const bytes = data instanceof ArrayBuffer
78
- ? new Uint8Array(data)
79
- : new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
80
- // Copy before handing off: noVNC sends views into its own reusable
81
- // send queue, which it overwrites immediately afterwards.
82
- this.sendData(new Uint8Array(bytes));
83
- }
84
- close() {
85
- if (this.readyState === ChannelSocketState.Closed) {
86
- return;
87
- }
88
- this.readyState = ChannelSocketState.Closing;
89
- this.closeTunnel();
90
- this.closed();
91
- }
92
- }
93
-
94
- const phirepassVncCss = () => `:host{display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;position:relative;background:#0b1021}.screen{width:100%;height:100%}.screen canvas{max-width:100%;display:block}.prompt{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0.75rem;background:rgba(11, 16, 33, 0.92);color:#e2e8f0;font-family:"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace;font-size:0.875rem}.prompt input{padding:0.5rem 0.75rem;border:1px solid #334155;border-radius:0.375rem;background:#0f172a;color:inherit;font:inherit;min-width:16rem}.prompt input:focus{outline:2px solid #67e8f9;outline-offset:1px}.prompt button{padding:0.5rem 1.25rem;border:0;border-radius:0.375rem;background:#67e8f9;color:#0b1021;font:inherit;font-weight:600;cursor:pointer}.status{position:absolute;inset-inline:0;bottom:0;padding:0.5rem 0.75rem;background:rgba(11, 16, 33, 0.92);color:#e2e8f0;font-family:"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace;font-size:0.8125rem;text-align:center}`;
95
-
96
- const PhirepassVnc = class {
97
- constructor(hostRef) {
98
- registerInstance(this, hostRef);
99
- this.connectionStateChanged = createEvent(this, "connectionStateChanged");
100
- }
101
- channel;
102
- containerEl;
103
- socket;
104
- rfb;
105
- domReady = false;
106
- runtimeReady = false;
107
- connected = false;
108
- session_id;
109
- passwordPrompt = false;
110
- statusMessage;
111
- passwordBuffer = '';
112
- get el() { return getElement(this); }
113
- serverHost = "phirepass.com";
114
- serverPort = 443;
115
- allowInsecure = false;
116
- heartbeatInterval = 30_000;
117
- nodeId;
118
- serviceId;
119
- token;
120
- /** Scales the remote desktop to fit the widget instead of showing scrollbars. */
121
- scaleViewport = true;
122
- /** Asks the VNC server to match its resolution to the widget size. */
123
- resizeSession = true;
124
- onNodeIdChange(newValue, _oldValue) {
125
- this.reset_session_state();
126
- if (this.channel && this.channel.is_connected()) {
127
- this.close_comms();
128
- }
129
- if (newValue) {
130
- this.open_comms();
131
- this.channel.connect();
132
- }
133
- }
134
- serverId;
135
- onServerIdChange(_newValue, _oldValue) {
136
- this.onNodeIdChange(this.nodeId, this.nodeId);
137
- }
138
- connectionStateChanged;
139
- create_web_socket_endpoint() {
140
- const protocol = this.allowInsecure ? 'ws' : 'wss';
141
- if (!this.allowInsecure && this.serverPort === 443) {
142
- return `${protocol}://${this.serverHost}`;
143
- }
144
- if (this.allowInsecure && this.serverPort === 80) {
145
- return `${protocol}://${this.serverHost}`;
146
- }
147
- return `${protocol}://${this.serverHost}:${this.serverPort}`;
148
- }
149
- async connectedCallback() {
150
- await __wbg_init();
151
- this.open_comms();
152
- this.runtimeReady = true;
153
- if (!this.nodeId) {
154
- console.warn('Prop node_id is not set. Cannot connect to VNC.');
155
- return;
156
- }
157
- this.try_connect();
158
- }
159
- componentDidLoad() {
160
- this.domReady = true;
161
- this.try_connect();
162
- }
163
- async disconnectedCallback() {
164
- this.connected = false;
165
- this.domReady = false;
166
- this.runtimeReady = false;
167
- this.close_comms();
168
- }
169
- try_connect() {
170
- if (this.connected || !this.domReady || !this.runtimeReady) {
171
- return;
172
- }
173
- if (!this.containerEl || !this.channel) {
174
- return;
175
- }
176
- this.connect();
177
- }
178
- connect() {
179
- this.connected = true;
180
- this.channel.connect();
181
- }
182
- open_comms() {
183
- if (this.serverId) {
184
- this.channel = new Channel(`${this.create_web_socket_endpoint()}/api/web/ws`, this.nodeId, this.serverId);
185
- }
186
- else {
187
- this.channel = new Channel(`${this.create_web_socket_endpoint()}/api/web/ws`, this.nodeId);
188
- }
189
- this.channel.on_connection_open(() => {
190
- this.connectionStateChanged.emit([ConnectionState.Connected]);
191
- this.channel.authenticate(this.token, this.nodeId);
192
- });
193
- this.channel.on_connection_close(() => {
194
- this.connectionStateChanged.emit([ConnectionState.Disconnected]);
195
- this.teardown_rfb();
196
- });
197
- this.channel.on_connection_error((err) => {
198
- this.connectionStateChanged.emit([ConnectionState.Error, err]);
199
- this.socket?.failed(err);
200
- });
201
- this.channel.on_connection_message((_raw_) => {
202
- // raw frames are handled by on_protocol_message below
203
- });
204
- this.channel.on_protocol_message((msg) => {
205
- const { web } = msg.data;
206
- switch (web.type) {
207
- case ProtocolMessageType.Error:
208
- this.handle_error(web);
209
- break;
210
- case ProtocolMessageType.AuthSuccess:
211
- this.handle_auth_success(web);
212
- break;
213
- case ProtocolMessageType.TunnelOpened:
214
- this.handle_tunnel_opened(web);
215
- break;
216
- case ProtocolMessageType.TunnelClosed:
217
- this.handle_tunnel_closed(web);
218
- break;
219
- case ProtocolMessageType.TunnelData:
220
- this.handle_tunnel_data(web);
221
- break;
222
- default:
223
- console.warn('Unknown protocol message type:', web);
224
- }
225
- });
226
- }
227
- close_comms() {
228
- this.teardown_rfb();
229
- if (this.channel) {
230
- this.channel.stop_heartbeat();
231
- this.channel.disconnect();
232
- }
233
- }
234
- reset_session_state() {
235
- this.session_id = undefined;
236
- this.passwordPrompt = false;
237
- this.passwordBuffer = '';
238
- this.statusMessage = undefined;
239
- }
240
- handle_auth_success(_auth_) {
241
- this.channel.start_heartbeat(this.heartbeatInterval <= 15_000 ? 30_000 : this.heartbeatInterval);
242
- this.channel.open_vnc_tunnel(this.nodeId, this.serviceId);
243
- }
244
- /**
245
- * The tunnel is a byte pipe from here on: noVNC drives the RFB handshake,
246
- * including authentication, over the socket adapter.
247
- */
248
- async handle_tunnel_opened(web) {
249
- this.session_id = web.sid;
250
- this.statusMessage = undefined;
251
- const socket = new ChannelSocket((data) => {
252
- if (this.session_id === undefined) {
253
- return;
254
- }
255
- this.channel.send_vnc_tunnel_data(this.nodeId, this.session_id, data);
256
- }, () => this.close_comms());
257
- this.socket = socket;
258
- // Loaded on demand so consumers embedding only the terminal or the SFTP
259
- // client never download the RFB client.
260
- const { default: RFBClient } = await import('@novnc/novnc');
261
- // The element may have gone away while the module was loading.
262
- if (!this.containerEl || this.socket !== socket) {
263
- return;
264
- }
265
- const rfb = new RFBClient(this.containerEl, socket);
266
- rfb.scaleViewport = this.scaleViewport;
267
- rfb.resizeSession = this.resizeSession;
268
- rfb.addEventListener('credentialsrequired', () => {
269
- this.passwordPrompt = true;
270
- });
271
- rfb.addEventListener('securityfailure', (event) => {
272
- const detail = event.detail;
273
- this.statusMessage = detail?.reason ?? 'Authentication failed.';
274
- this.connectionStateChanged.emit([ConnectionState.Error, detail]);
275
- });
276
- rfb.addEventListener('disconnect', () => {
277
- this.statusMessage = this.statusMessage ?? 'Connection closed.';
278
- });
279
- this.rfb = rfb;
280
- // Only now can noVNC start reading: it attaches on construction.
281
- socket.open();
282
- }
283
- handle_tunnel_data(web) {
284
- this.socket?.receive(new Uint8Array(web.data));
285
- }
286
- handle_tunnel_closed(_web_) {
287
- this.session_id = undefined;
288
- this.statusMessage = 'Connection closed.';
289
- this.teardown_rfb();
290
- this.close_comms();
291
- }
292
- handle_error(error) {
293
- this.statusMessage = error.message;
294
- this.connectionStateChanged.emit([ConnectionState.Error, error]);
295
- this.socket?.failed(error);
296
- }
297
- teardown_rfb() {
298
- if (this.rfb) {
299
- try {
300
- this.rfb.disconnect();
301
- }
302
- catch (err) {
303
- console.warn('Failed to disconnect RFB cleanly:', err);
304
- }
305
- this.rfb = undefined;
306
- }
307
- if (this.socket) {
308
- this.socket.closed();
309
- this.socket = undefined;
310
- }
311
- this.passwordPrompt = false;
312
- this.passwordBuffer = '';
313
- }
314
- submit_password(event) {
315
- event.preventDefault();
316
- this.passwordPrompt = false;
317
- this.rfb?.sendCredentials({ password: this.passwordBuffer });
318
- this.passwordBuffer = '';
319
- }
320
- render() {
321
- 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))));
322
- }
323
- static get watchers() { return {
324
- "nodeId": [{
325
- "onNodeIdChange": 0
326
- }],
327
- "serverId": [{
328
- "onServerIdChange": 0
329
- }]
330
- }; }
331
- };
332
- PhirepassVnc.style = phirepassVncCss();
333
-
334
- export { PhirepassVnc as phirepass_vnc };
@@ -1 +0,0 @@
1
- import{r as t,c as s,g as e,h as i,H as n}from"./p-DovZQ7sb.js";import{_ as o,C as h,a as r,P as a}from"./p-BR2c80mW.js";var c;!function(t){t[t.Connecting=0]="Connecting",t[t.Open=1]="Open",t[t.Closing=2]="Closing",t[t.Closed=3]="Closed"}(c||(c={}));class d{binaryType="arraybuffer";protocol="";readyState=c.Connecting;onopen=null;onmessage=null;onclose=null;onerror=null;sendData;closeTunnel;constructor(t,s){this.sendData=t,this.closeTunnel=s}open(){this.readyState===c.Connecting&&(this.readyState=c.Open,this.onopen?.())}receive(t){if(this.readyState!==c.Open)return;const s=new ArrayBuffer(t.byteLength);new Uint8Array(s).set(t),this.onmessage?.({data:s})}closed(){this.readyState!==c.Closed&&(this.readyState=c.Closed,this.onclose?.())}failed(t){this.onerror?.(t),this.closed()}send(t){if(this.readyState!==c.Open)return;const s=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);this.sendData(new Uint8Array(s))}close(){this.readyState!==c.Closed&&(this.readyState=c.Closing,this.closeTunnel(),this.closed())}}const l=class{constructor(e){t(this,e),this.connectionStateChanged=s(this,"connectionStateChanged")}channel;containerEl;socket;rfb;domReady=!1;runtimeReady=!1;connected=!1;session_id;passwordPrompt=!1;statusMessage;passwordBuffer="";get el(){return e(this)}serverHost="phirepass.com";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;serviceId;token;scaleViewport=!0;resizeSession=!0;onNodeIdChange(t,s){this.reset_session_state(),this.channel&&this.channel.is_connected()&&this.close_comms(),t&&(this.open_comms(),this.channel.connect())}serverId;onServerIdChange(t,s){this.onNodeIdChange(this.nodeId,this.nodeId)}connectionStateChanged;create_web_socket_endpoint(){const t=this.allowInsecure?"ws":"wss";return this.allowInsecure||443!==this.serverPort?this.allowInsecure&&80===this.serverPort?`${t}://${this.serverHost}`:`${t}://${this.serverHost}:${this.serverPort}`:`${t}://${this.serverHost}`}async connectedCallback(){await o(),this.open_comms(),this.runtimeReady=!0,this.nodeId?this.try_connect():console.warn("Prop node_id is not set. Cannot connect to VNC.")}componentDidLoad(){this.domReady=!0,this.try_connect()}async disconnectedCallback(){this.connected=!1,this.domReady=!1,this.runtimeReady=!1,this.close_comms()}try_connect(){!this.connected&&this.domReady&&this.runtimeReady&&this.containerEl&&this.channel&&this.connect()}connect(){this.connected=!0,this.channel.connect()}open_comms(){this.channel=this.serverId?new h(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId,this.serverId):new h(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId),this.channel.on_connection_open((()=>{this.connectionStateChanged.emit([r.Connected]),this.channel.authenticate(this.token,this.nodeId)})),this.channel.on_connection_close((()=>{this.connectionStateChanged.emit([r.Disconnected]),this.teardown_rfb()})),this.channel.on_connection_error((t=>{this.connectionStateChanged.emit([r.Error,t]),this.socket?.failed(t)})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((t=>{const{web:s}=t.data;switch(s.type){case a.Error:this.handle_error(s);break;case a.AuthSuccess:this.handle_auth_success(s);break;case a.TunnelOpened:this.handle_tunnel_opened(s);break;case a.TunnelClosed:this.handle_tunnel_closed(s);break;case a.TunnelData:this.handle_tunnel_data(s);break;default:console.warn("Unknown protocol message type:",s)}}))}close_comms(){this.teardown_rfb(),this.channel&&(this.channel.stop_heartbeat(),this.channel.disconnect())}reset_session_state(){this.session_id=void 0,this.passwordPrompt=!1,this.passwordBuffer="",this.statusMessage=void 0}handle_auth_success(t){this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.channel.open_vnc_tunnel(this.nodeId,this.serviceId)}async handle_tunnel_opened(t){this.session_id=t.sid,this.statusMessage=void 0;const s=new d((t=>{void 0!==this.session_id&&this.channel.send_vnc_tunnel_data(this.nodeId,this.session_id,t)}),(()=>this.close_comms()));this.socket=s;const{default:e}=await import("@novnc/novnc");if(!this.containerEl||this.socket!==s)return;const i=new e(this.containerEl,s);i.scaleViewport=this.scaleViewport,i.resizeSession=this.resizeSession,i.addEventListener("credentialsrequired",(()=>{this.passwordPrompt=!0})),i.addEventListener("securityfailure",(t=>{const s=t.detail;this.statusMessage=s?.reason??"Authentication failed.",this.connectionStateChanged.emit([r.Error,s])})),i.addEventListener("disconnect",(()=>{this.statusMessage=this.statusMessage??"Connection closed."})),this.rfb=i,s.open()}handle_tunnel_data(t){this.socket?.receive(new Uint8Array(t.data))}handle_tunnel_closed(t){this.session_id=void 0,this.statusMessage="Connection closed.",this.teardown_rfb(),this.close_comms()}handle_error(t){this.statusMessage=t.message,this.connectionStateChanged.emit([r.Error,t]),this.socket?.failed(t)}teardown_rfb(){if(this.rfb){try{this.rfb.disconnect()}catch(t){console.warn("Failed to disconnect RFB cleanly:",t)}this.rfb=void 0}this.socket&&(this.socket.closed(),this.socket=void 0),this.passwordPrompt=!1,this.passwordBuffer=""}submit_password(t){t.preventDefault(),this.passwordPrompt=!1,this.rfb?.sendCredentials({password:this.passwordBuffer}),this.passwordBuffer=""}render(){return i(n,{key:"5daf583edea28d1592827dd7b96aff27bf3fd857"},i("div",{key:"4a5f3d8b64084c3929fc16fdda7eba0de300c188",class:"screen",ref:t=>this.containerEl=t}),this.passwordPrompt&&i("form",{key:"cadd7db5b5985f332156a93eae953fadd377af54",class:"prompt",onSubmit:t=>this.submit_password(t)},i("label",{key:"2c1702e048c5d932e3384bacf65c4a5393aecc79",htmlFor:"vnc-password"},"VNC password"),i("input",{key:"0e2c947e15bdbf0cd76b6414bc0d22896914af0d",id:"vnc-password",type:"password",autofocus:!0,onInput:t=>this.passwordBuffer=t.target.value}),i("button",{key:"eb5b346b830f449454bb2476d12f08e5fb61a4a5",type:"submit"},"Connect")),this.statusMessage&&!this.passwordPrompt&&i("div",{key:"28f55f457ae33e774c6914b7f6f9761bdb95b804",class:"status"},this.statusMessage))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}};l.style=':host{display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;position:relative;background:#0b1021}.screen{width:100%;height:100%}.screen canvas{max-width:100%;display:block}.prompt{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0.75rem;background:rgba(11, 16, 33, 0.92);color:#e2e8f0;font-family:"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace;font-size:0.875rem}.prompt input{padding:0.5rem 0.75rem;border:1px solid #334155;border-radius:0.375rem;background:#0f172a;color:inherit;font:inherit;min-width:16rem}.prompt input:focus{outline:2px solid #67e8f9;outline-offset:1px}.prompt button{padding:0.5rem 1.25rem;border:0;border-radius:0.375rem;background:#67e8f9;color:#0b1021;font:inherit;font-weight:600;cursor:pointer}.status{position:absolute;inset-inline:0;bottom:0;padding:0.5rem 0.75rem;background:rgba(11, 16, 33, 0.92);color:#e2e8f0;font-family:"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace;font-size:0.8125rem;text-align:center}';export{l as phirepass_vnc}
@@ -1 +0,0 @@
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}
@@ -1,47 +0,0 @@
1
- /**
2
- * Presents a phirepass tunnel as the "raw channel" noVNC expects in place of a
3
- * WebSocket.
4
- *
5
- * noVNC's `Websock.attach()` validates the object it is handed against a fixed
6
- * property list — `send`, `close`, `binaryType`, `onerror`, `onmessage`,
7
- * `onopen`, `protocol`, `readyState` — collected from `Object.keys(channel)`
8
- * plus the own property names of its prototype. Methods and getters satisfy
9
- * that from the prototype; the event handlers only satisfy it if they are
10
- * *assigned* in the constructor, so every one of them is initialised to `null`
11
- * below even though TypeScript would not otherwise require it. Leaving one
12
- * merely declared makes `attach()` throw "Raw channel missing property".
13
- */
14
- /** Matches the numeric `WebSocket.readyState` constants noVNC compares against. */
15
- export declare enum ChannelSocketState {
16
- Connecting = 0,
17
- Open = 1,
18
- Closing = 2,
19
- Closed = 3
20
- }
21
- export type ChannelSocketSend = (data: Uint8Array) => void;
22
- export type ChannelSocketClose = () => void;
23
- export declare class ChannelSocket {
24
- /** noVNC overwrites this with "arraybuffer" during attach. */
25
- binaryType: string;
26
- /** Always empty: there is no WebSocket sub-protocol negotiation here. */
27
- readonly protocol: string;
28
- readyState: number;
29
- onopen: ((event?: unknown) => void) | null;
30
- onmessage: ((event: {
31
- data: ArrayBuffer;
32
- }) => void) | null;
33
- onclose: ((event?: unknown) => void) | null;
34
- onerror: ((event?: unknown) => void) | null;
35
- private readonly sendData;
36
- private readonly closeTunnel;
37
- constructor(sendData: ChannelSocketSend, closeTunnel: ChannelSocketClose);
38
- /** Marks the tunnel as usable and lets noVNC start the RFB handshake. */
39
- open(): void;
40
- /** Hands bytes arriving from the node up to noVNC. */
41
- receive(data: Uint8Array): void;
42
- /** Ends the socket from the phirepass side (tunnel closed, disconnect). */
43
- closed(): void;
44
- failed(error?: unknown): void;
45
- send(data: ArrayBuffer | ArrayBufferView): void;
46
- close(): void;
47
- }
@@ -1,53 +0,0 @@
1
- /**
2
- * Ambient types for noVNC, which ships as plain ES modules with no bundled
3
- * declarations. Only the surface `phirepass-vnc` uses is described here.
4
- *
5
- * Verified against @novnc/novnc 1.7.0.
6
- */
7
- declare module '@novnc/novnc' {
8
- export interface RFBCredentials {
9
- username?: string;
10
- password?: string;
11
- target?: string;
12
- }
13
-
14
- export interface RFBOptions {
15
- shared?: boolean;
16
- credentials?: RFBCredentials;
17
- repeaterID?: string;
18
- wsProtocols?: string[];
19
- }
20
-
21
- /**
22
- * The second argument is a URL or any object carrying the raw-channel
23
- * surface noVNC checks for: `send`, `close`, `binaryType`, `onerror`,
24
- * `onmessage`, `onopen`, `protocol` and `readyState`.
25
- */
26
- export default class RFB extends EventTarget {
27
- constructor(target: Element, urlOrChannel: string | object, options?: RFBOptions);
28
-
29
- viewOnly: boolean;
30
- focusOnClick: boolean;
31
- clipViewport: boolean;
32
- dragViewport: boolean;
33
- scaleViewport: boolean;
34
- resizeSession: boolean;
35
- showDotCursor: boolean;
36
- background: string;
37
- qualityLevel: number;
38
- compressionLevel: number;
39
-
40
- readonly capabilities: { power?: boolean };
41
-
42
- disconnect(): void;
43
- sendCredentials(credentials: RFBCredentials): void;
44
- sendKey(keysym: number, code: string | null, down?: boolean): void;
45
- sendCtrlAltDel(): void;
46
- focus(options?: FocusOptions): void;
47
- blur(): void;
48
- clipboardPasteFrom(text: string): void;
49
- machineShutdown(): void;
50
- machineReboot(): void;
51
- machineReset(): void;
52
- }
53
- }
@@ -1,52 +0,0 @@
1
- import { EventEmitter } from '../../stencil-public-runtime';
2
- import { ConnectionState } from '../../common/protocol';
3
- export declare class PhirepassVnc {
4
- private channel;
5
- private containerEl?;
6
- private socket?;
7
- private rfb?;
8
- private domReady;
9
- private runtimeReady;
10
- private connected;
11
- private session_id?;
12
- private passwordPrompt;
13
- private statusMessage?;
14
- private passwordBuffer;
15
- el: HTMLElement;
16
- serverHost: string;
17
- serverPort: number;
18
- allowInsecure: boolean;
19
- heartbeatInterval: number;
20
- nodeId: string;
21
- serviceId: string;
22
- token: string;
23
- /** Scales the remote desktop to fit the widget instead of showing scrollbars. */
24
- scaleViewport: boolean;
25
- /** Asks the VNC server to match its resolution to the widget size. */
26
- resizeSession: boolean;
27
- onNodeIdChange(newValue?: string, _oldValue?: string): void;
28
- serverId?: string;
29
- onServerIdChange(_newValue?: string, _oldValue?: string): void;
30
- connectionStateChanged: EventEmitter<[ConnectionState, unknown?]>;
31
- private create_web_socket_endpoint;
32
- connectedCallback(): Promise<void>;
33
- componentDidLoad(): void;
34
- disconnectedCallback(): Promise<void>;
35
- private try_connect;
36
- private connect;
37
- private open_comms;
38
- private close_comms;
39
- private reset_session_state;
40
- private handle_auth_success;
41
- /**
42
- * The tunnel is a byte pipe from here on: noVNC drives the RFB handshake,
43
- * including authentication, over the socket adapter.
44
- */
45
- private handle_tunnel_opened;
46
- private handle_tunnel_data;
47
- private handle_tunnel_closed;
48
- private handle_error;
49
- private teardown_rfb;
50
- private submit_password;
51
- render(): any;
52
- }