phirepass-widgets 0.0.95 → 0.0.96
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/phirepass-rdp.cjs.entry.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/{protocol-C8mBELJo.js → protocol-C_jWfJBl.js} +3 -3
- package/dist/collection/phirepass-channel_bg.wasm +0 -0
- package/dist/{phirepass-widgets/p-DUo8UDLj.js → components/p-BN06-tDZ.js} +1 -1
- package/dist/components/phirepass-rdp.js +1 -1
- package/dist/components/phirepass-sftp-client.js +1 -1
- package/dist/components/phirepass-terminal.js +4 -4
- package/dist/esm/phirepass-rdp.entry.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/{protocol-DUo8UDLj.js → protocol-BN06-tDZ.js} +2 -2
- package/dist/phirepass-widgets/{p-4696f064.entry.js → p-88f10c52.entry.js} +1 -1
- package/dist/{components/p-DUo8UDLj.js → phirepass-widgets/p-BN06-tDZ.js} +1 -1
- package/dist/phirepass-widgets/{p-e5f4baf2.entry.js → p-a3218a7f.entry.js} +5 -5
- package/dist/phirepass-widgets/{p-14a42724.entry.js → p-f945d823.entry.js} +1 -1
- package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
- package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, g as getElement, h, H as Host } from './index-T-yV-0EO.js';
|
|
2
|
-
import { _ as __wbg_init, C as Channel, a as ConnectionState, P as ProtocolMessageType } from './protocol-
|
|
2
|
+
import { _ as __wbg_init, C as Channel, a as ConnectionState, P as ProtocolMessageType } from './protocol-BN06-tDZ.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* RDP's display-control PDU describes a monitor in whole, even pixels within
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-T-yV-0EO.js';
|
|
2
|
-
import { _ as __wbg_init, E as ErrorType, C as Channel, a as ConnectionState, P as ProtocolMessageType } from './protocol-
|
|
2
|
+
import { _ as __wbg_init, E as ErrorType, C as Channel, a as ConnectionState, P as ProtocolMessageType } from './protocol-BN06-tDZ.js';
|
|
3
3
|
|
|
4
4
|
const phirepassSftpClientLogoSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10ZXJtaW5hbCB3LTMuNSBoLTMuNSB0ZXh0LXByaW1hcnkiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iNCAxNyAxMCAxMSA0IDUiPjwvcG9seWxpbmU+CiAgICA8bGluZSB4MT0iMTIiIHgyPSIyMCIgeTE9IjE5IiB5Mj0iMTkiPjwvbGluZT4KPC9zdmc+Cg==';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, g as getElement, h as h$1, H as Host } from './index-T-yV-0EO.js';
|
|
2
|
-
import { I as InputMode, _ as __wbg_init, C as Channel, a as ConnectionState, P as ProtocolMessageType, E as ErrorType } from './protocol-
|
|
2
|
+
import { I as InputMode, _ as __wbg_init, C as Channel, a as ConnectionState, P as ProtocolMessageType, E as ErrorType } from './protocol-BN06-tDZ.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
@@ -460,7 +460,7 @@ function __wbg_get_imports() {
|
|
|
460
460
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
461
461
|
return addHeapObject(ret);
|
|
462
462
|
}, arguments); },
|
|
463
|
-
|
|
463
|
+
__wbg_info_cc117f989794e3f7: function(arg0, arg1) {
|
|
464
464
|
console.info(getStringFromWasm0(arg0, arg1));
|
|
465
465
|
},
|
|
466
466
|
__wbg_instanceof_ArrayBuffer_993d02d2d254cad1: function(arg0) {
|
|
@@ -532,7 +532,7 @@ function __wbg_get_imports() {
|
|
|
532
532
|
__wbg_set_onopen_b28699f3431204cf: function(arg0, arg1) {
|
|
533
533
|
getObject(arg0).onopen = getObject(arg1);
|
|
534
534
|
},
|
|
535
|
-
|
|
535
|
+
__wbg_warn_9f118d8577cf7876: function(arg0, arg1) {
|
|
536
536
|
console.warn(getStringFromWasm0(arg0, arg1));
|
|
537
537
|
},
|
|
538
538
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as s,g as e,h as i,H as o}from"./p-T-yV-0EO.js";import{_ as n,C as h,a as r,P as a}from"./p-DUo8UDLj.js";const c=200;function d(t){return!Number.isFinite(t)||t<=0?c:Math.min(8192,Math.max(c,Math.floor(t)))}function u(t){return t-t%2}function l(t){const s=t.getBoundingClientRect();return e=s.height,{width:u(d(s.width)),height:u(d(e))};var e}class f{onResize;debounceMs;observer;handle;reported;constructor(t,s=250){this.onResize=t,this.debounceMs=s}observe(t){this.disconnect(),this.report(l(t)),"undefined"!=typeof ResizeObserver&&(this.observer=new ResizeObserver((()=>{clearTimeout(this.handle),this.handle=setTimeout((()=>this.report(l(t))),this.debounceMs)})),this.observer.observe(t))}disconnect(){clearTimeout(this.handle),this.handle=void 0,this.observer?.disconnect(),this.observer=void 0,this.reported=void 0}report(t){var s,e;e=this.reported,(s=t)&&e&&s.width===e.width&&s.height===e.height||(this.reported=t,this.onResize(t))}}function p(){return navigator.keyboard}function m(){return"function"==typeof p()?.lock}function b(t){return document.fullscreenElement===t}function y(t){return document.fullscreenElement?.contains(t)??!1}function w(){if(m())try{p().unlock()}catch(t){console.warn("Failed to release the keyboard lock:",t)}}const g=class{constructor(e){t(this,e),this.connectionStateChanged=s(this,"connectionStateChanged")}channel;containerEl;ironEl;userInteraction;viewport;domReady=!1;runtimeReady=!1;connected=!1;disposed=!1;session_id;onFullscreenChange=()=>this.sync_keyboard_lock();credentials;credentialsPrompt=!1;statusMessage;usernameBuffer="";passwordBuffer="";get el(){return e(this)}serverHost="phirepass.com";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;serviceId;token;username;password;destination;scale="fit";dynamicResize=!0;captureKeyboard=!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(){document.addEventListener("fullscreenchange",this.onFullscreenChange),this.disposed=!1,await n(),this.open_comms(),this.runtimeReady=!0,this.nodeId?this.try_connect():console.warn("Prop node_id is not set. Cannot connect to RDP.")}componentDidLoad(){this.domReady=!0,this.try_connect()}async disconnectedCallback(){document.removeEventListener("fullscreenchange",this.onFullscreenChange),this.disposed=!0,this.session_id=void 0,this.connected=!1,this.domReady=!1,this.runtimeReady=!1,this.close_comms()}async toggleFullscreen(){const t=await async function(t){try{return b(t)?(await document.exitFullscreen(),!1):(await t.requestFullscreen({navigationUI:"hide"}),!0)}catch(s){return console.warn("Failed to change the fullscreen state of the RDP session:",s),b(t)}}(this.el);return this.focus_desktop(),t}async keyboardLockSupported(){return m()}async focusDesktop(){this.focus_desktop()}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_client()})),this.channel.on_connection_error((t=>{this.connectionStateChanged.emit([r.Error,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.RDPAuthorized:this.handle_rdp_authorized(s);break;case a.TunnelClosed:this.handle_tunnel_closed(s);break;default:console.warn("Unknown protocol message type:",s)}}))}close_comms(){this.teardown_client(),this.channel&&(this.channel.stop_heartbeat(),this.channel.disconnect())}reset_session_state(){this.session_id=void 0,this.credentials=void 0,this.credentialsPrompt=!1,this.usernameBuffer="",this.passwordBuffer="",this.statusMessage=void 0}handle_auth_success(t){if(this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.username&&this.password)return this.credentials={username:this.username,password:this.password},void this.request_tunnel();this.credentialsPrompt=!0}request_tunnel(){this.credentials&&(this.statusMessage=void 0,this.channel.open_rdp_tunnel(this.nodeId,this.serviceId,this.credentials.username,this.credentials.password))}async handle_rdp_authorized(t){this.session_id=t.sid,this.statusMessage="Connecting…";const[s]=await Promise.all([import("@devolutions/iron-remote-desktop-rdp"),import("@devolutions/iron-remote-desktop")]);if(this.disposed||!this.containerEl||this.session_id!==t.sid)return;if(await s.init("info"),this.disposed||!this.containerEl||this.session_id!==t.sid)return;const e=document.createElement("iron-remote-desktop");e.module=s.Backend,e.scale=this.scale,e.flexcenter=!0,e.verbose=!1,e.addEventListener("ready",(e=>{this.start_session(e.detail.irgUserInteraction,t.ticket,s.enableCredssp(!0))})),this.ironEl=e,this.mount_client(e)}mount_client(t){this.el.appendChild(t)}async start_session(t,s,e){this.userInteraction=t;const i=t.configBuilder().withUsername(this.credentials?.username??"").withPassword(this.credentials?.password??"").withDestination(this.destination??this.nodeId).withProxyAddress(`${this.create_web_socket_endpoint()}/api/web/rdp/${this.nodeId}`).withAuthToken(s).withExtension(e);if(this.dynamicResize){const t=function(t){const s=t.getBoundingClientRect();if(Number.isFinite(s.width)&&Number.isFinite(s.height)&&!(s.width<c||s.height<c))return{width:u(Math.min(Math.floor(s.width),4096)),height:u(Math.min(Math.floor(s.height),4096))}}(this.el);t&&i.withDesktopSize(t)}try{const s=await t.connect(i.build());if(this.disposed)return this.shutdown_session(t),void await s.run();t.setVisibility(!0),this.statusMessage=void 0,this.focus_desktop(),this.start_viewport_sync(),this.sync_keyboard_lock();const e=await s.run();this.statusMessage=e.reason()}catch(t){const s=this.describe_error(t);this.statusMessage=s,this.connectionStateChanged.emit([r.Error,t])}}start_viewport_sync(){this.dynamicResize&&(this.viewport=new f((t=>this.resize_desktop(t))),this.viewport.observe(this.el))}stop_viewport_sync(){this.viewport?.disconnect(),this.viewport=void 0}resize_desktop(t){try{this.userInteraction?.resize(t.width,t.height)}catch(t){console.warn("The remote host would not resize its desktop:",t)}}focus_desktop(){var t;t=this.ironEl,t?.focus({preventScroll:!0})}async sync_keyboard_lock(){this.captureKeyboard&&y(this.el)?(await async function(t){if(m()&&y(t))try{await p().lock()}catch(t){console.warn("Failed to lock the keyboard for the RDP session:",t)}}(this.el),this.focus_desktop()):w()}describe_error(t){return t&&"function"==typeof t.backtrace?t.backtrace():t instanceof Error?t.message:"Connection failed."}handle_tunnel_closed(t){this.session_id=void 0,this.statusMessage=this.statusMessage??"Connection closed.",this.teardown_client(),this.close_comms()}handle_error(t){this.statusMessage=t.message,this.connectionStateChanged.emit([r.Error,t])}shutdown_session(t){try{t.shutdown()}catch(t){console.warn("Failed to shut the RDP session down cleanly:",t)}}teardown_client(){this.stop_viewport_sync(),w(),this.userInteraction&&(this.shutdown_session(this.userInteraction),this.userInteraction=void 0),this.ironEl?.remove(),this.ironEl=void 0,this.credentialsPrompt=!1,this.usernameBuffer="",this.passwordBuffer=""}submit_credentials(t){t.preventDefault(),this.credentialsPrompt=!1,this.credentials={username:this.usernameBuffer,password:this.passwordBuffer},this.usernameBuffer="",this.passwordBuffer="",this.request_tunnel()}render(){return i(o,{key:"892fd55fb84abf180866dd7af4e44adc9c23f338"},i("div",{key:"fd6ac08295b6ce9e3bd3932abea271c9c6fc8a00",class:"screen",ref:t=>this.containerEl=t},i("slot",{key:"b9240f804177898f29598b0c7ec7b4f4d2e8d6c6"})),this.credentialsPrompt&&i("form",{key:"49ce099f575a30c0bb326a64de74d30cf599418f",class:"prompt",onSubmit:t=>this.submit_credentials(t)},i("label",{key:"1a12eb01993f858bbbc2498cc8d896b1dd1dbf88",htmlFor:"rdp-username"},"Username"),i("input",{key:"1530953f30c68d5fe6b3a438bfa91603c18d3de8",id:"rdp-username",type:"text",autocomplete:"off",autofocus:!0,onInput:t=>this.usernameBuffer=t.target.value}),i("label",{key:"5066a95159ce5237ad4bb70fe4ef4860853b128a",htmlFor:"rdp-password"},"Password"),i("input",{key:"841ace9bfe01ae5bf55829782a047538344ee189",id:"rdp-password",type:"password",autocomplete:"off",onInput:t=>this.passwordBuffer=t.target.value}),i("button",{key:"977d63f9c0e0d25b3e710f2c650d22f2382d01c6",type:"submit"},"Connect")),this.statusMessage&&!this.credentialsPrompt&&i("div",{key:"7cf443d2a6fab96cfc87590e145e53325321b5d9",class:"status"},this.statusMessage))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}};g.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%;display:flex}::slotted(iron-remote-desktop){display:block;flex:1 1 auto;min-width:0;min-height:0;width:100%;height:100%}:host(:fullscreen){width:100vw;height:100vh;background:#000}.prompt{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0.5rem;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{margin-top:0.5rem;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{g as phirepass_rdp}
|
|
1
|
+
import{r as t,c as s,g as e,h as i,H as o}from"./p-T-yV-0EO.js";import{_ as n,C as h,a as r,P as a}from"./p-BN06-tDZ.js";const c=200;function d(t){return!Number.isFinite(t)||t<=0?c:Math.min(8192,Math.max(c,Math.floor(t)))}function u(t){return t-t%2}function l(t){const s=t.getBoundingClientRect();return e=s.height,{width:u(d(s.width)),height:u(d(e))};var e}class f{onResize;debounceMs;observer;handle;reported;constructor(t,s=250){this.onResize=t,this.debounceMs=s}observe(t){this.disconnect(),this.report(l(t)),"undefined"!=typeof ResizeObserver&&(this.observer=new ResizeObserver((()=>{clearTimeout(this.handle),this.handle=setTimeout((()=>this.report(l(t))),this.debounceMs)})),this.observer.observe(t))}disconnect(){clearTimeout(this.handle),this.handle=void 0,this.observer?.disconnect(),this.observer=void 0,this.reported=void 0}report(t){var s,e;e=this.reported,(s=t)&&e&&s.width===e.width&&s.height===e.height||(this.reported=t,this.onResize(t))}}function p(){return navigator.keyboard}function m(){return"function"==typeof p()?.lock}function b(t){return document.fullscreenElement===t}function y(t){return document.fullscreenElement?.contains(t)??!1}function w(){if(m())try{p().unlock()}catch(t){console.warn("Failed to release the keyboard lock:",t)}}const g=class{constructor(e){t(this,e),this.connectionStateChanged=s(this,"connectionStateChanged")}channel;containerEl;ironEl;userInteraction;viewport;domReady=!1;runtimeReady=!1;connected=!1;disposed=!1;session_id;onFullscreenChange=()=>this.sync_keyboard_lock();credentials;credentialsPrompt=!1;statusMessage;usernameBuffer="";passwordBuffer="";get el(){return e(this)}serverHost="phirepass.com";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;serviceId;token;username;password;destination;scale="fit";dynamicResize=!0;captureKeyboard=!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(){document.addEventListener("fullscreenchange",this.onFullscreenChange),this.disposed=!1,await n(),this.open_comms(),this.runtimeReady=!0,this.nodeId?this.try_connect():console.warn("Prop node_id is not set. Cannot connect to RDP.")}componentDidLoad(){this.domReady=!0,this.try_connect()}async disconnectedCallback(){document.removeEventListener("fullscreenchange",this.onFullscreenChange),this.disposed=!0,this.session_id=void 0,this.connected=!1,this.domReady=!1,this.runtimeReady=!1,this.close_comms()}async toggleFullscreen(){const t=await async function(t){try{return b(t)?(await document.exitFullscreen(),!1):(await t.requestFullscreen({navigationUI:"hide"}),!0)}catch(s){return console.warn("Failed to change the fullscreen state of the RDP session:",s),b(t)}}(this.el);return this.focus_desktop(),t}async keyboardLockSupported(){return m()}async focusDesktop(){this.focus_desktop()}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_client()})),this.channel.on_connection_error((t=>{this.connectionStateChanged.emit([r.Error,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.RDPAuthorized:this.handle_rdp_authorized(s);break;case a.TunnelClosed:this.handle_tunnel_closed(s);break;default:console.warn("Unknown protocol message type:",s)}}))}close_comms(){this.teardown_client(),this.channel&&(this.channel.stop_heartbeat(),this.channel.disconnect())}reset_session_state(){this.session_id=void 0,this.credentials=void 0,this.credentialsPrompt=!1,this.usernameBuffer="",this.passwordBuffer="",this.statusMessage=void 0}handle_auth_success(t){if(this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.username&&this.password)return this.credentials={username:this.username,password:this.password},void this.request_tunnel();this.credentialsPrompt=!0}request_tunnel(){this.credentials&&(this.statusMessage=void 0,this.channel.open_rdp_tunnel(this.nodeId,this.serviceId,this.credentials.username,this.credentials.password))}async handle_rdp_authorized(t){this.session_id=t.sid,this.statusMessage="Connecting…";const[s]=await Promise.all([import("@devolutions/iron-remote-desktop-rdp"),import("@devolutions/iron-remote-desktop")]);if(this.disposed||!this.containerEl||this.session_id!==t.sid)return;if(await s.init("info"),this.disposed||!this.containerEl||this.session_id!==t.sid)return;const e=document.createElement("iron-remote-desktop");e.module=s.Backend,e.scale=this.scale,e.flexcenter=!0,e.verbose=!1,e.addEventListener("ready",(e=>{this.start_session(e.detail.irgUserInteraction,t.ticket,s.enableCredssp(!0))})),this.ironEl=e,this.mount_client(e)}mount_client(t){this.el.appendChild(t)}async start_session(t,s,e){this.userInteraction=t;const i=t.configBuilder().withUsername(this.credentials?.username??"").withPassword(this.credentials?.password??"").withDestination(this.destination??this.nodeId).withProxyAddress(`${this.create_web_socket_endpoint()}/api/web/rdp/${this.nodeId}`).withAuthToken(s).withExtension(e);if(this.dynamicResize){const t=function(t){const s=t.getBoundingClientRect();if(Number.isFinite(s.width)&&Number.isFinite(s.height)&&!(s.width<c||s.height<c))return{width:u(Math.min(Math.floor(s.width),4096)),height:u(Math.min(Math.floor(s.height),4096))}}(this.el);t&&i.withDesktopSize(t)}try{const s=await t.connect(i.build());if(this.disposed)return this.shutdown_session(t),void await s.run();t.setVisibility(!0),this.statusMessage=void 0,this.focus_desktop(),this.start_viewport_sync(),this.sync_keyboard_lock();const e=await s.run();this.statusMessage=e.reason()}catch(t){const s=this.describe_error(t);this.statusMessage=s,this.connectionStateChanged.emit([r.Error,t])}}start_viewport_sync(){this.dynamicResize&&(this.viewport=new f((t=>this.resize_desktop(t))),this.viewport.observe(this.el))}stop_viewport_sync(){this.viewport?.disconnect(),this.viewport=void 0}resize_desktop(t){try{this.userInteraction?.resize(t.width,t.height)}catch(t){console.warn("The remote host would not resize its desktop:",t)}}focus_desktop(){var t;t=this.ironEl,t?.focus({preventScroll:!0})}async sync_keyboard_lock(){this.captureKeyboard&&y(this.el)?(await async function(t){if(m()&&y(t))try{await p().lock()}catch(t){console.warn("Failed to lock the keyboard for the RDP session:",t)}}(this.el),this.focus_desktop()):w()}describe_error(t){return t&&"function"==typeof t.backtrace?t.backtrace():t instanceof Error?t.message:"Connection failed."}handle_tunnel_closed(t){this.session_id=void 0,this.statusMessage=this.statusMessage??"Connection closed.",this.teardown_client(),this.close_comms()}handle_error(t){this.statusMessage=t.message,this.connectionStateChanged.emit([r.Error,t])}shutdown_session(t){try{t.shutdown()}catch(t){console.warn("Failed to shut the RDP session down cleanly:",t)}}teardown_client(){this.stop_viewport_sync(),w(),this.userInteraction&&(this.shutdown_session(this.userInteraction),this.userInteraction=void 0),this.ironEl?.remove(),this.ironEl=void 0,this.credentialsPrompt=!1,this.usernameBuffer="",this.passwordBuffer=""}submit_credentials(t){t.preventDefault(),this.credentialsPrompt=!1,this.credentials={username:this.usernameBuffer,password:this.passwordBuffer},this.usernameBuffer="",this.passwordBuffer="",this.request_tunnel()}render(){return i(o,{key:"892fd55fb84abf180866dd7af4e44adc9c23f338"},i("div",{key:"fd6ac08295b6ce9e3bd3932abea271c9c6fc8a00",class:"screen",ref:t=>this.containerEl=t},i("slot",{key:"b9240f804177898f29598b0c7ec7b4f4d2e8d6c6"})),this.credentialsPrompt&&i("form",{key:"49ce099f575a30c0bb326a64de74d30cf599418f",class:"prompt",onSubmit:t=>this.submit_credentials(t)},i("label",{key:"1a12eb01993f858bbbc2498cc8d896b1dd1dbf88",htmlFor:"rdp-username"},"Username"),i("input",{key:"1530953f30c68d5fe6b3a438bfa91603c18d3de8",id:"rdp-username",type:"text",autocomplete:"off",autofocus:!0,onInput:t=>this.usernameBuffer=t.target.value}),i("label",{key:"5066a95159ce5237ad4bb70fe4ef4860853b128a",htmlFor:"rdp-password"},"Password"),i("input",{key:"841ace9bfe01ae5bf55829782a047538344ee189",id:"rdp-password",type:"password",autocomplete:"off",onInput:t=>this.passwordBuffer=t.target.value}),i("button",{key:"977d63f9c0e0d25b3e710f2c650d22f2382d01c6",type:"submit"},"Connect")),this.statusMessage&&!this.credentialsPrompt&&i("div",{key:"7cf443d2a6fab96cfc87590e145e53325321b5d9",class:"status"},this.statusMessage))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}};g.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%;display:flex}::slotted(iron-remote-desktop){display:block;flex:1 1 auto;min-width:0;min-height:0;width:100%;height:100%}:host(:fullscreen){width:100vw;height:100vh;background:#000}.prompt{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0.5rem;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{margin-top:0.5rem;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{g as phirepass_rdp}
|
|
@@ -1 +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();O.__wbg_channel_free(n,0)}authenticate(n,t,e){const r=S(n,O.__wbindgen_export,O.__wbindgen_export2),o=P,c=S(t,O.__wbindgen_export,O.__wbindgen_export2);O.channel_authenticate(this.__wbg_ptr,r,o,c,P,R(e)?Number.MAX_SAFE_INTEGER:e>>>0)}connect(){O.channel_connect(this.__wbg_ptr)}create_service(n,t,e,r,o,c,i,s,_,u){const a=S(n,O.__wbindgen_export,O.__wbindgen_export2),f=P,b=S(t,O.__wbindgen_export,O.__wbindgen_export2),l=P;var d=R(e)?0:S(e,O.__wbindgen_export,O.__wbindgen_export2),w=P;const g=S(r,O.__wbindgen_export,O.__wbindgen_export2),h=P;var p=R(c)?0:S(c,O.__wbindgen_export,O.__wbindgen_export2),y=P,m=R(i)?0:S(i,O.__wbindgen_export,O.__wbindgen_export2),v=P,A=R(s)?0:S(s,O.__wbindgen_export,O.__wbindgen_export2),N=P,T=R(_)?0:S(_,O.__wbindgen_export,O.__wbindgen_export2);O.channel_create_service(this.__wbg_ptr,a,f,b,l,d,w,g,h,o,p,y,m,v,A,N,T,P,R(u)?Number.MAX_SAFE_INTEGER:u>>>0)}delete_service(n,t,e){const r=S(n,O.__wbindgen_export,O.__wbindgen_export2),o=P,c=S(t,O.__wbindgen_export,O.__wbindgen_export2);O.channel_delete_service(this.__wbg_ptr,r,o,c,P,R(e)?Number.MAX_SAFE_INTEGER:e>>>0)}disconnect(){O.channel_disconnect(this.__wbg_ptr)}is_connected(){return 0!==O.channel_is_connected(this.__wbg_ptr)}is_disconnected(){return 0!==O.channel_is_disconnected(this.__wbg_ptr)}constructor(n,t,e){const r=S(n,O.__wbindgen_export,O.__wbindgen_export2),o=P,c=S(t,O.__wbindgen_export,O.__wbindgen_export2),i=P;var s=R(e)?0:S(e,O.__wbindgen_export,O.__wbindgen_export2);const u=O.channel_new(r,o,c,i,s,P);return this.__wbg_ptr=u,_.register(this,this.__wbg_ptr,this),this}on_connection_close(n){O.channel_on_connection_close(this.__wbg_ptr,R(n)?0:u(n))}on_connection_error(n){O.channel_on_connection_error(this.__wbg_ptr,R(n)?0:u(n))}on_connection_message(n){O.channel_on_connection_message(this.__wbg_ptr,R(n)?0:u(n))}on_connection_open(n){O.channel_on_connection_open(this.__wbg_ptr,R(n)?0:u(n))}on_protocol_message(n){O.channel_on_protocol_message(this.__wbg_ptr,R(n)?0:u(n))}on_protocol_message_type(n,t){const e=S(n,O.__wbindgen_export,O.__wbindgen_export2);O.channel_on_protocol_message_type(this.__wbg_ptr,e,P,R(t)?0:u(t))}open_rdp_tunnel(n,t,e,r,o){const c=S(n,O.__wbindgen_export,O.__wbindgen_export2),i=P,s=S(t,O.__wbindgen_export,O.__wbindgen_export2),_=P;var u=R(e)?0:S(e,O.__wbindgen_export,O.__wbindgen_export2),a=P,f=R(r)?0:S(r,O.__wbindgen_export,O.__wbindgen_export2);O.channel_open_rdp_tunnel(this.__wbg_ptr,c,i,s,_,u,a,f,P,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}open_sftp_tunnel(n,t,e,r,o){const c=S(n,O.__wbindgen_export,O.__wbindgen_export2),i=P,s=S(t,O.__wbindgen_export,O.__wbindgen_export2),_=P;var u=R(e)?0:S(e,O.__wbindgen_export,O.__wbindgen_export2),a=P,f=R(r)?0:S(r,O.__wbindgen_export,O.__wbindgen_export2);O.channel_open_sftp_tunnel(this.__wbg_ptr,c,i,s,_,u,a,f,P,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}open_ssh_tunnel(n,t,e,r,o){const c=S(n,O.__wbindgen_export,O.__wbindgen_export2),i=P,s=S(t,O.__wbindgen_export,O.__wbindgen_export2),_=P;var u=R(e)?0:S(e,O.__wbindgen_export,O.__wbindgen_export2),a=P,f=R(r)?0:S(r,O.__wbindgen_export,O.__wbindgen_export2);O.channel_open_ssh_tunnel(this.__wbg_ptr,c,i,s,_,u,a,f,P,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_delete(n,t,e,r,o){const c=S(n,O.__wbindgen_export,O.__wbindgen_export2),i=P,s=S(e,O.__wbindgen_export,O.__wbindgen_export2),_=P,u=S(r,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_sftp_delete(this.__wbg_ptr,c,i,t,s,_,u,P,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_download_ack(n,t,e,r){const o=S(n,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_sftp_download_ack(this.__wbg_ptr,o,P,t,e,r)}send_sftp_download_chunk(n,t,e,r,o){const c=S(n,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_sftp_download_chunk(this.__wbg_ptr,c,P,t,e,r,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_download_start(n,t,e,r,o){const c=S(n,O.__wbindgen_export,O.__wbindgen_export2),i=P,s=S(e,O.__wbindgen_export,O.__wbindgen_export2),_=P,u=S(r,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_sftp_download_start(this.__wbg_ptr,c,i,t,s,_,u,P,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_list_data(n,t,e,r){const o=S(n,O.__wbindgen_export,O.__wbindgen_export2),c=P,i=S(e,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_sftp_list_data(this.__wbg_ptr,o,c,t,i,P,R(r)?Number.MAX_SAFE_INTEGER:r>>>0)}send_sftp_upload_chunk(n,t,e,r,o,c,i){const s=S(n,O.__wbindgen_export,O.__wbindgen_export2),_=P,u=function(n){const t=(0,O.__wbindgen_export)(1*n.length,1)>>>0;return h().set(n,t/1),P=n.length,t}(c);O.channel_send_sftp_upload_chunk(this.__wbg_ptr,s,_,t,e,r,o,u,P,R(i)?Number.MAX_SAFE_INTEGER:i>>>0)}send_sftp_upload_start(n,t,e,r,o,c,i){const s=S(n,O.__wbindgen_export,O.__wbindgen_export2),_=P,u=S(e,O.__wbindgen_export,O.__wbindgen_export2),a=P,f=S(r,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_sftp_upload_start(this.__wbg_ptr,s,_,t,u,a,f,P,o,c,R(i)?Number.MAX_SAFE_INTEGER:i>>>0)}send_ssh_terminal_resize(n,t,e,r,o,c){const i=S(n,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_ssh_terminal_resize(this.__wbg_ptr,i,P,t,e,r,o,c)}send_ssh_tunnel_data(n,t,e){const r=S(n,O.__wbindgen_export,O.__wbindgen_export2),o=P,c=S(e,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_ssh_tunnel_data(this.__wbg_ptr,r,o,t,c,P)}start_heartbeat(n){O.channel_start_heartbeat(this.__wbg_ptr,n)}stop_heartbeat(){O.channel_stop_heartbeat(this.__wbg_ptr)}update_service(n,t,e,r,o,c,i,s,_,u,a){const f=S(n,O.__wbindgen_export,O.__wbindgen_export2),b=P,l=S(t,O.__wbindgen_export,O.__wbindgen_export2),d=P,w=S(e,O.__wbindgen_export,O.__wbindgen_export2),g=P;var h=R(r)?0:S(r,O.__wbindgen_export,O.__wbindgen_export2),p=P;const y=S(o,O.__wbindgen_export,O.__wbindgen_export2),m=P;var v=R(i)?0:S(i,O.__wbindgen_export,O.__wbindgen_export2),A=P,N=R(s)?0:S(s,O.__wbindgen_export,O.__wbindgen_export2),T=P,U=R(_)?0:S(_,O.__wbindgen_export,O.__wbindgen_export2),j=P,F=R(u)?0:S(u,O.__wbindgen_export,O.__wbindgen_export2);O.channel_update_service(this.__wbg_ptr,f,b,l,d,w,g,h,p,y,m,c,v,A,N,T,U,j,F,P,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_408e67f47ca7b58b:function(n,t){return u(Error(w(n,t)))},__wbg_String_8564e559799eccda:function(n,t){const e=S(String(p(t)),O.__wbindgen_export,O.__wbindgen_export2),r=P;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_debug_string_a57024b9c6e4a48b:function(n,t){const e=S(f(p(t)),O.__wbindgen_export,O.__wbindgen_export2),r=P;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_string_get_d154f1e671052120:function(n,t){const e=p(t),r="string"==typeof e?e:void 0;var o=R(r)?0:S(r,O.__wbindgen_export,O.__wbindgen_export2),c=P;d().setInt32(n+4,c,!0),d().setInt32(n+0,o,!0)},__wbg___wbindgen_throw_bb96b2010945f0bc:function(n,t){throw new Error(w(n,t))},__wbg__wbg_cb_unref_be22cc64ae6946a0:function(n){p(n)._wbg_cb_unref()},__wbg_call_0f2a9af232c18fd2:function(){return y((function(n,t,e,r){return u(p(n).call(p(t),p(e),p(r)))}),arguments)},__wbg_call_1c5886ab9c57d1c7:function(){return y((function(n,t){return u(p(n).call(p(t)))}),arguments)},__wbg_call_35dba3c747ad7521:function(){return y((function(n,t,e){return u(p(n).call(p(t),p(e)))}),arguments)},__wbg_clearInterval_26ba580547547579:function(n){return u(clearInterval(N(n)))},__wbg_close_b857478a8d4c1a16:function(){return y((function(n){p(n).close()}),arguments)},__wbg_data_57d8ce4eb5f0a433:function(n){return u(p(n).data)},__wbg_from_74f3d90e0ff11240:function(n){return u(Array.from(p(n)))},__wbg_getRandomValues_a608c4436c19407a:function(){return y((function(n,t){globalThis.crypto.getRandomValues(b(n,t))}),arguments)},__wbg_get_971a0c45d172643f:function(){return y((function(n,t){return u(Reflect.get(p(n),p(t)))}),arguments)},__wbg_info_d8d9b0eb0a5b7dc9:function(n,t){console.info(w(n,t))},__wbg_instanceof_ArrayBuffer_993d02d2d254cad1:function(n){let t;try{t=p(n)instanceof ArrayBuffer}catch(n){t=!1}return t},__wbg_length_36bd29c6848c2144:function(n){return p(n).length},__wbg_new_116be93542d39019:function(){return u(new Array)},__wbg_new_77cc4f4f472aeb81:function(n){return u(new Uint8Array(p(n)))},__wbg_new_ebe3e0f6837f0879:function(){return u(new Object)},__wbg_new_with_str_sequence_d8aa2988e9c191ed:function(){return y((function(n,t,e){return u(new WebSocket(w(n,t),p(e)))}),arguments)},__wbg_prototypesetcall_de8e0d9553586985:function(n,t,e){Uint8Array.prototype.set.call(b(n,t),p(e))},__wbg_push_adb0107829f02d75:function(n,t){return p(n).push(p(t))},__wbg_readyState_fe79161592fd15ce:function(n){return p(n).readyState},__wbg_send_76be66dda8ee844c: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)[N(t)]=N(e)},__wbg_set_a80955eb93b145c6:function(n,t,e){p(n)[t>>>0]=N(e)},__wbg_set_binaryType_b701908a03166a9f:function(n,t){p(n).binaryType=s[t]},__wbg_set_onclose_cb71fea4ad9056fc:function(n,t){p(n).onclose=p(t)},__wbg_set_onerror_f1491b13f0fea022:function(n,t){p(n).onerror=p(t)},__wbg_set_onmessage_065a797dafa9c437:function(n,t){p(n).onmessage=p(t)},__wbg_set_onopen_b28699f3431204cf:function(n,t){p(n).onopen=p(t)},__wbg_warn_bd2d0da89aff04c0: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){N(n)}};return{__proto__:null,"./phirepass-channel_bg.js":n}}function r(n,t){O.__wasm_bindgen_func_elem_63(n,t)}function o(n,t,e){O.__wasm_bindgen_func_elem_59(n,t,u(e))}function c(n,t,e){O.__wasm_bindgen_func_elem_59_1(n,t,u(e))}function i(n,t,e){O.__wasm_bindgen_func_elem_59_2(n,t,u(e))}const s=["blob","arraybuffer"],_="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>O.__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=>O.__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!==O.memory.buffer)&&(l=new DataView(O.memory.buffer)),l}function w(n,t){return function(n,t){return j+=t,j>=U&&(T=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),T.decode(),j=t),T.decode(h().subarray(n,n+t))}(n>>>0,t)}let g=null;function h(){return null!==g&&0!==g.byteLength||(g=new Uint8Array(O.memory.buffer)),g}function p(n){return m[n]}function y(n,t){try{return n.apply(this,t)}catch(n){O.__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&&(O.__wbindgen_export4(r.a,r.b),r.a=0,a.unregister(r))},a.register(o,r,r),o}function S(n,t,e){if(void 0===e){const e=F.encode(n),r=t(e.length,1)>>>0;return h().subarray(r,r+e.length).set(e),P=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+=F.encodeInto(n,t).written,o=e(o,r,i,1)>>>0}return P=i,o}function N(n){const t=p(n);return function(n){n<1028||(m[n]=v,v=n)}(n),t}let T=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});T.decode();const U=2146435072;let j=0;const F=new TextEncoder;"encodeInto"in F||(F.encodeInto=function(n,t){const e=F.encode(n);return t.set(e),{read:n.length,written:e.length}});let O,P=0;async function W(n){if(void 0!==O)return O;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(!n.ok)throw new Error(`failed to fetch Wasm: ${n.status} ${n.statusText} fetching '${n.url}'`);if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(n,t)}catch(t){if(!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 O=n.exports,l=null,g=null,O}(r)}var $,k,q;!function(n){n.Error="Error",n.AuthSuccess="AuthSuccess",n.TunnelOpened="TunnelOpened",n.TunnelClosed="TunnelClosed",n.TunnelData="TunnelData",n.RDPAuthorized="RDPAuthorized",n.SFTPListItems="SFTPListItems",n.SFTPDownloadStartResponse="SFTPDownloadStartResponse",n.SFTPDownloadChunk="SFTPDownloadChunk",n.SFTPUploadStartResponse="SFTPUploadStartResponse",n.SFTPUploadChunkAck="SFTPUploadChunkAck"}($||($={})),function(n){n[n.Username=0]="Username",n[n.Password=1]="Password",n[n.Default=2]="Default"}(k||(k={})),function(n){n.Disconnected="disconnected",n.Connected="connected",n.Error="error"}(q||(q={}));export{n as C,t as E,k as I,$ as P,W as _,q as a}
|
|
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();O.__wbg_channel_free(n,0)}authenticate(n,t,e){const r=S(n,O.__wbindgen_export,O.__wbindgen_export2),o=P,c=S(t,O.__wbindgen_export,O.__wbindgen_export2);O.channel_authenticate(this.__wbg_ptr,r,o,c,P,R(e)?Number.MAX_SAFE_INTEGER:e>>>0)}connect(){O.channel_connect(this.__wbg_ptr)}create_service(n,t,e,r,o,c,i,s,_,u){const a=S(n,O.__wbindgen_export,O.__wbindgen_export2),f=P,b=S(t,O.__wbindgen_export,O.__wbindgen_export2),l=P;var d=R(e)?0:S(e,O.__wbindgen_export,O.__wbindgen_export2),w=P;const g=S(r,O.__wbindgen_export,O.__wbindgen_export2),h=P;var p=R(c)?0:S(c,O.__wbindgen_export,O.__wbindgen_export2),y=P,m=R(i)?0:S(i,O.__wbindgen_export,O.__wbindgen_export2),v=P,A=R(s)?0:S(s,O.__wbindgen_export,O.__wbindgen_export2),N=P,T=R(_)?0:S(_,O.__wbindgen_export,O.__wbindgen_export2);O.channel_create_service(this.__wbg_ptr,a,f,b,l,d,w,g,h,o,p,y,m,v,A,N,T,P,R(u)?Number.MAX_SAFE_INTEGER:u>>>0)}delete_service(n,t,e){const r=S(n,O.__wbindgen_export,O.__wbindgen_export2),o=P,c=S(t,O.__wbindgen_export,O.__wbindgen_export2);O.channel_delete_service(this.__wbg_ptr,r,o,c,P,R(e)?Number.MAX_SAFE_INTEGER:e>>>0)}disconnect(){O.channel_disconnect(this.__wbg_ptr)}is_connected(){return 0!==O.channel_is_connected(this.__wbg_ptr)}is_disconnected(){return 0!==O.channel_is_disconnected(this.__wbg_ptr)}constructor(n,t,e){const r=S(n,O.__wbindgen_export,O.__wbindgen_export2),o=P,c=S(t,O.__wbindgen_export,O.__wbindgen_export2),i=P;var s=R(e)?0:S(e,O.__wbindgen_export,O.__wbindgen_export2);const u=O.channel_new(r,o,c,i,s,P);return this.__wbg_ptr=u,_.register(this,this.__wbg_ptr,this),this}on_connection_close(n){O.channel_on_connection_close(this.__wbg_ptr,R(n)?0:u(n))}on_connection_error(n){O.channel_on_connection_error(this.__wbg_ptr,R(n)?0:u(n))}on_connection_message(n){O.channel_on_connection_message(this.__wbg_ptr,R(n)?0:u(n))}on_connection_open(n){O.channel_on_connection_open(this.__wbg_ptr,R(n)?0:u(n))}on_protocol_message(n){O.channel_on_protocol_message(this.__wbg_ptr,R(n)?0:u(n))}on_protocol_message_type(n,t){const e=S(n,O.__wbindgen_export,O.__wbindgen_export2);O.channel_on_protocol_message_type(this.__wbg_ptr,e,P,R(t)?0:u(t))}open_rdp_tunnel(n,t,e,r,o){const c=S(n,O.__wbindgen_export,O.__wbindgen_export2),i=P,s=S(t,O.__wbindgen_export,O.__wbindgen_export2),_=P;var u=R(e)?0:S(e,O.__wbindgen_export,O.__wbindgen_export2),a=P,f=R(r)?0:S(r,O.__wbindgen_export,O.__wbindgen_export2);O.channel_open_rdp_tunnel(this.__wbg_ptr,c,i,s,_,u,a,f,P,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}open_sftp_tunnel(n,t,e,r,o){const c=S(n,O.__wbindgen_export,O.__wbindgen_export2),i=P,s=S(t,O.__wbindgen_export,O.__wbindgen_export2),_=P;var u=R(e)?0:S(e,O.__wbindgen_export,O.__wbindgen_export2),a=P,f=R(r)?0:S(r,O.__wbindgen_export,O.__wbindgen_export2);O.channel_open_sftp_tunnel(this.__wbg_ptr,c,i,s,_,u,a,f,P,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}open_ssh_tunnel(n,t,e,r,o){const c=S(n,O.__wbindgen_export,O.__wbindgen_export2),i=P,s=S(t,O.__wbindgen_export,O.__wbindgen_export2),_=P;var u=R(e)?0:S(e,O.__wbindgen_export,O.__wbindgen_export2),a=P,f=R(r)?0:S(r,O.__wbindgen_export,O.__wbindgen_export2);O.channel_open_ssh_tunnel(this.__wbg_ptr,c,i,s,_,u,a,f,P,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_delete(n,t,e,r,o){const c=S(n,O.__wbindgen_export,O.__wbindgen_export2),i=P,s=S(e,O.__wbindgen_export,O.__wbindgen_export2),_=P,u=S(r,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_sftp_delete(this.__wbg_ptr,c,i,t,s,_,u,P,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_download_ack(n,t,e,r){const o=S(n,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_sftp_download_ack(this.__wbg_ptr,o,P,t,e,r)}send_sftp_download_chunk(n,t,e,r,o){const c=S(n,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_sftp_download_chunk(this.__wbg_ptr,c,P,t,e,r,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_download_start(n,t,e,r,o){const c=S(n,O.__wbindgen_export,O.__wbindgen_export2),i=P,s=S(e,O.__wbindgen_export,O.__wbindgen_export2),_=P,u=S(r,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_sftp_download_start(this.__wbg_ptr,c,i,t,s,_,u,P,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_list_data(n,t,e,r){const o=S(n,O.__wbindgen_export,O.__wbindgen_export2),c=P,i=S(e,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_sftp_list_data(this.__wbg_ptr,o,c,t,i,P,R(r)?Number.MAX_SAFE_INTEGER:r>>>0)}send_sftp_upload_chunk(n,t,e,r,o,c,i){const s=S(n,O.__wbindgen_export,O.__wbindgen_export2),_=P,u=function(n){const t=(0,O.__wbindgen_export)(1*n.length,1)>>>0;return h().set(n,t/1),P=n.length,t}(c);O.channel_send_sftp_upload_chunk(this.__wbg_ptr,s,_,t,e,r,o,u,P,R(i)?Number.MAX_SAFE_INTEGER:i>>>0)}send_sftp_upload_start(n,t,e,r,o,c,i){const s=S(n,O.__wbindgen_export,O.__wbindgen_export2),_=P,u=S(e,O.__wbindgen_export,O.__wbindgen_export2),a=P,f=S(r,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_sftp_upload_start(this.__wbg_ptr,s,_,t,u,a,f,P,o,c,R(i)?Number.MAX_SAFE_INTEGER:i>>>0)}send_ssh_terminal_resize(n,t,e,r,o,c){const i=S(n,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_ssh_terminal_resize(this.__wbg_ptr,i,P,t,e,r,o,c)}send_ssh_tunnel_data(n,t,e){const r=S(n,O.__wbindgen_export,O.__wbindgen_export2),o=P,c=S(e,O.__wbindgen_export,O.__wbindgen_export2);O.channel_send_ssh_tunnel_data(this.__wbg_ptr,r,o,t,c,P)}start_heartbeat(n){O.channel_start_heartbeat(this.__wbg_ptr,n)}stop_heartbeat(){O.channel_stop_heartbeat(this.__wbg_ptr)}update_service(n,t,e,r,o,c,i,s,_,u,a){const f=S(n,O.__wbindgen_export,O.__wbindgen_export2),b=P,l=S(t,O.__wbindgen_export,O.__wbindgen_export2),d=P,w=S(e,O.__wbindgen_export,O.__wbindgen_export2),g=P;var h=R(r)?0:S(r,O.__wbindgen_export,O.__wbindgen_export2),p=P;const y=S(o,O.__wbindgen_export,O.__wbindgen_export2),m=P;var v=R(i)?0:S(i,O.__wbindgen_export,O.__wbindgen_export2),A=P,N=R(s)?0:S(s,O.__wbindgen_export,O.__wbindgen_export2),T=P,U=R(_)?0:S(_,O.__wbindgen_export,O.__wbindgen_export2),j=P,F=R(u)?0:S(u,O.__wbindgen_export,O.__wbindgen_export2);O.channel_update_service(this.__wbg_ptr,f,b,l,d,w,g,h,p,y,m,c,v,A,N,T,U,j,F,P,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_408e67f47ca7b58b:function(n,t){return u(Error(w(n,t)))},__wbg_String_8564e559799eccda:function(n,t){const e=S(String(p(t)),O.__wbindgen_export,O.__wbindgen_export2),r=P;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_debug_string_a57024b9c6e4a48b:function(n,t){const e=S(f(p(t)),O.__wbindgen_export,O.__wbindgen_export2),r=P;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_string_get_d154f1e671052120:function(n,t){const e=p(t),r="string"==typeof e?e:void 0;var o=R(r)?0:S(r,O.__wbindgen_export,O.__wbindgen_export2),c=P;d().setInt32(n+4,c,!0),d().setInt32(n+0,o,!0)},__wbg___wbindgen_throw_bb96b2010945f0bc:function(n,t){throw new Error(w(n,t))},__wbg__wbg_cb_unref_be22cc64ae6946a0:function(n){p(n)._wbg_cb_unref()},__wbg_call_0f2a9af232c18fd2:function(){return y((function(n,t,e,r){return u(p(n).call(p(t),p(e),p(r)))}),arguments)},__wbg_call_1c5886ab9c57d1c7:function(){return y((function(n,t){return u(p(n).call(p(t)))}),arguments)},__wbg_call_35dba3c747ad7521:function(){return y((function(n,t,e){return u(p(n).call(p(t),p(e)))}),arguments)},__wbg_clearInterval_26ba580547547579:function(n){return u(clearInterval(N(n)))},__wbg_close_b857478a8d4c1a16:function(){return y((function(n){p(n).close()}),arguments)},__wbg_data_57d8ce4eb5f0a433:function(n){return u(p(n).data)},__wbg_from_74f3d90e0ff11240:function(n){return u(Array.from(p(n)))},__wbg_getRandomValues_a608c4436c19407a:function(){return y((function(n,t){globalThis.crypto.getRandomValues(b(n,t))}),arguments)},__wbg_get_971a0c45d172643f:function(){return y((function(n,t){return u(Reflect.get(p(n),p(t)))}),arguments)},__wbg_info_cc117f989794e3f7:function(n,t){console.info(w(n,t))},__wbg_instanceof_ArrayBuffer_993d02d2d254cad1:function(n){let t;try{t=p(n)instanceof ArrayBuffer}catch(n){t=!1}return t},__wbg_length_36bd29c6848c2144:function(n){return p(n).length},__wbg_new_116be93542d39019:function(){return u(new Array)},__wbg_new_77cc4f4f472aeb81:function(n){return u(new Uint8Array(p(n)))},__wbg_new_ebe3e0f6837f0879:function(){return u(new Object)},__wbg_new_with_str_sequence_d8aa2988e9c191ed:function(){return y((function(n,t,e){return u(new WebSocket(w(n,t),p(e)))}),arguments)},__wbg_prototypesetcall_de8e0d9553586985:function(n,t,e){Uint8Array.prototype.set.call(b(n,t),p(e))},__wbg_push_adb0107829f02d75:function(n,t){return p(n).push(p(t))},__wbg_readyState_fe79161592fd15ce:function(n){return p(n).readyState},__wbg_send_76be66dda8ee844c: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)[N(t)]=N(e)},__wbg_set_a80955eb93b145c6:function(n,t,e){p(n)[t>>>0]=N(e)},__wbg_set_binaryType_b701908a03166a9f:function(n,t){p(n).binaryType=s[t]},__wbg_set_onclose_cb71fea4ad9056fc:function(n,t){p(n).onclose=p(t)},__wbg_set_onerror_f1491b13f0fea022:function(n,t){p(n).onerror=p(t)},__wbg_set_onmessage_065a797dafa9c437:function(n,t){p(n).onmessage=p(t)},__wbg_set_onopen_b28699f3431204cf:function(n,t){p(n).onopen=p(t)},__wbg_warn_9f118d8577cf7876: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){N(n)}};return{__proto__:null,"./phirepass-channel_bg.js":n}}function r(n,t){O.__wasm_bindgen_func_elem_63(n,t)}function o(n,t,e){O.__wasm_bindgen_func_elem_59(n,t,u(e))}function c(n,t,e){O.__wasm_bindgen_func_elem_59_1(n,t,u(e))}function i(n,t,e){O.__wasm_bindgen_func_elem_59_2(n,t,u(e))}const s=["blob","arraybuffer"],_="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>O.__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=>O.__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!==O.memory.buffer)&&(l=new DataView(O.memory.buffer)),l}function w(n,t){return function(n,t){return j+=t,j>=U&&(T=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),T.decode(),j=t),T.decode(h().subarray(n,n+t))}(n>>>0,t)}let g=null;function h(){return null!==g&&0!==g.byteLength||(g=new Uint8Array(O.memory.buffer)),g}function p(n){return m[n]}function y(n,t){try{return n.apply(this,t)}catch(n){O.__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&&(O.__wbindgen_export4(r.a,r.b),r.a=0,a.unregister(r))},a.register(o,r,r),o}function S(n,t,e){if(void 0===e){const e=F.encode(n),r=t(e.length,1)>>>0;return h().subarray(r,r+e.length).set(e),P=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+=F.encodeInto(n,t).written,o=e(o,r,i,1)>>>0}return P=i,o}function N(n){const t=p(n);return function(n){n<1028||(m[n]=v,v=n)}(n),t}let T=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});T.decode();const U=2146435072;let j=0;const F=new TextEncoder;"encodeInto"in F||(F.encodeInto=function(n,t){const e=F.encode(n);return t.set(e),{read:n.length,written:e.length}});let O,P=0;async function W(n){if(void 0!==O)return O;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(!n.ok)throw new Error(`failed to fetch Wasm: ${n.status} ${n.statusText} fetching '${n.url}'`);if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(n,t)}catch(t){if(!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 O=n.exports,l=null,g=null,O}(r)}var $,k,q;!function(n){n.Error="Error",n.AuthSuccess="AuthSuccess",n.TunnelOpened="TunnelOpened",n.TunnelClosed="TunnelClosed",n.TunnelData="TunnelData",n.RDPAuthorized="RDPAuthorized",n.SFTPListItems="SFTPListItems",n.SFTPDownloadStartResponse="SFTPDownloadStartResponse",n.SFTPDownloadChunk="SFTPDownloadChunk",n.SFTPUploadStartResponse="SFTPUploadStartResponse",n.SFTPUploadChunkAck="SFTPUploadChunkAck"}($||($={})),function(n){n[n.Username=0]="Username",n[n.Password=1]="Password",n[n.Default=2]="Default"}(k||(k={})),function(n){n.Disconnected="disconnected",n.Connected="connected",n.Error="error"}(q||(q={}));export{n as C,t as E,k as I,$ as P,W as _,q as a}
|