mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-09-07 13:16:38 +02:00
1 line
5.0 KiB
JavaScript
1 line
5.0 KiB
JavaScript
(function(){var t,e,i;(t=class t extends this.OS.GUI.BasicDialog{constructor(){super("ConnectionDialog",t.scheme)}main(){return super.main(),this.find("bbp").data=[{text:"16 bits",value:16,selected:!0},{text:"32 bits",value:32}],this.find("compression").data=[{text:"No compression",value:0},{text:"JPEG",value:1,selected:!0}],this.find("jq").value=40,this.find("bt-ok").onbtclick=t=>{var e;if(this.handle)return e={wvnc:this.find("txtWVNC").value,server:this.find("txtServer").value,bbp:this.find("bbp").selectedItem.data.value,flag:this.find("compression").selectedItem.data.value,quality:this.find("jq").value},this.handle(e),this.quit()},this.find("bt-cancel").onbtclick=t=>this.quit()}}).scheme='<afx-app-window width=\'350\' height=\'270\'>\n <afx-hbox>\n <div data-width="5"></div>\n <afx-vbox>\n <afx-label text="__(WVNC Websocket)" data-height="25" class="header" ></afx-label>\n <input data-height="25" data-id="txtWVNC" value="wss://localhost/wvnc"></input>\n <afx-label text="__(VNC Server)" data-height="25" class="header" ></afx-label>\n <input data-height="25" data-id="txtServer" value="192.168.1.27:5901"></input>\n <div data-height="5"></div>\n <afx-label text="__(Bits per pixel)" data-height="25" class="header" ></afx-label>\n <afx-list-view dropdown = "true" data-id ="bbp" data-height="25" ></afx-list-view>\n <div data-height="5"></div>\n <afx-label text="__(Compression)" data-height="25" class="header" ></afx-label>\n <afx-list-view dropdown = "true" data-id ="compression" data-height="25" ></afx-list-view>\n <div data-height="5"></div>\n <afx-label text="__(JPEG quality)" data-height="25" class="header" ></afx-label>\n <afx-slider data-id ="jq" data-height="25" ></afx-slider>\n <afx-hbox data-height = \'30\'>\n <div style=\' text-align:right;\'>\n <afx-button data-id = "bt-ok" text = "__(Connect)"></afx-button>\n <afx-button data-id = "bt-cancel" text = "__(Cancel)"></afx-button>\n </div>\n <div data-width="5"></div>\n </afx-hbox>\n </afx-vbox>\n <div data-width="5"></div>\n </afx-hbox>\n</afx-app-window>\n',(e=class t extends this.OS.GUI.BasicDialog{constructor(){super("CredentialDialog",t.scheme)}main(){return this.find("bt-ok").onbtclick=()=>{var t;return this.handle?(t={username:this.find("txtUser").value,password:this.find("txtPass").value},this.handle(t),this.quit()):this.quit()},this.find("bt-cancel").onbtclick=()=>this.quit()}}).scheme='<afx-app-window width=\'350\' height=\'150\'>\n <afx-vbox>\n <afx-label text="__(Username)" data-height="25" class="header" ></afx-label>\n <input data-height="30" data-id="txtUser"></input>\n <afx-label text="__(Password)" data-height="25" class="header" ></afx-label>\n <input type="password" data-height="30" data-id="txtPass"></input>\n <afx-hbox data-height = \'30\'>\n <div style=\' text-align:right;\'>\n <afx-button data-id = "bt-ok" text = "__(Ok)"></afx-button>\n <afx-button data-id = "bt-cancel" text = "__(Cancel)"></afx-button>\n </div>\n <div data-width="5"></div>\n </afx-hbox>\n </afx-vbox>\n</afx-app-window>\n',(i=class extends this.OS.application.BaseApplication{constructor(t){super("RemoteDesktop",t)}main(){return this.canvas=this.find("screen"),this.container=this.find("container"),this.client=new WVNC({element:this.canvas,libjpeg:"pkg://libjpeg/jpg.js".asFileHandle().getlink()}),this.client.onerror=t=>(this.error(t),this.showConnectionDialog()),this.client.onresize=()=>this.setScale(),this.client.onpassword=()=>new Promise((t,e)=>this.openDialog("PromptDialog",{title:__("VNC password"),label:__("VNC password"),value:"password",type:"password"}).then((function(e){return t(e)}))),this.client.oncredential=()=>new Promise((t,i)=>this.openDialog(new e,{title:__("User credential")}).then((function(e){return t(e.username,e.password)}))),this.on("resize",t=>this.setScale()),this.on("focus",t=>$(this.canvas).focus()),this.client.init().then(()=>this.showConnectionDialog())}setScale(){var t,e,i,a;if(this.client&&this.client.resolution)return a=$(this.container).width(),t=$(this.container).height(),(e=a/this.client.resolution.w)>(i=t/this.client.resolution.h)?this.client.setScale(i):this.client.setScale(e)}menu(){return[{text:"__(Connection)",nodes:[{text:"__(New Connection)",dataid:this.name+"-new"},{text:"__(Disconnect)",dataid:this.name+"-close"}],onchildselect:t=>this.actionConnection()}]}actionConnection(t){return this.client&&this.client.disconnect(!1),this.showConnectionDialog()}showConnectionDialog(){return this.openDialog(new t,{title:__("Connection")}).then(t=>(this.client.ws=t.wvnc,this.client.connect(t.server,t)))}cleanup(){if(this.client)return this.client.disconnect(!0)}}).dependencies=["pkg://libwvnc/main.js"],this.OS.register("RemoteDesktop",i)}).call(this); |