update vterm

This commit is contained in:
Dany LE 2021-11-27 17:42:20 +01:00
parent f08e9ab00d
commit 0df49e387c
8 changed files with 12 additions and 8 deletions

View File

@ -425,7 +425,7 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/vTerm/README.md",
"category": "System",
"author": "Xuan Sang LE",
"version": "0.1.15-a",
"version": "0.1.16-a",
"dependencies": ["Antunnel@0.2.0-b","xTerm@4.8.1-r"],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/vTerm/build/release/vTerm.zip"
},

View File

@ -12,7 +12,8 @@ VTerm depends on the server side **tunnel** plugin and the AntOS **Antunnel**
client side package
## Change logs
-v0.1.15-a update dependencies to latest
- v0.1.16-a fix incorrect control command
- v0.1.15-a update dependencies to latest
- v0.1.14-a: Change app icon
- v0.1.12-a: Add copy/paste shortcuts (CTRL+SHIFT+C/ CTRL+SHIFT+V)
- v0.1.9-a: Update dependencies to latest

View File

@ -12,7 +12,8 @@ VTerm depends on the server side **tunnel** plugin and the AntOS **Antunnel**
client side package
## Change logs
-v0.1.15-a update dependencies to latest
- v0.1.16-a fix incorrect control command
- v0.1.15-a update dependencies to latest
- v0.1.14-a: Change app icon
- v0.1.12-a: Add copy/paste shortcuts (CTRL+SHIFT+C/ CTRL+SHIFT+V)
- v0.1.9-a: Update dependencies to latest

View File

@ -1 +1 @@
(function(){var t;(t=class extends this.OS.application.BaseApplication{constructor(t){super("vTerm",t)}main(){var t;return this.mterm=this.find("myterm"),this.term=new Terminal({cursorBlink:!0}),this.fitAddon=new FitAddon.FitAddon,this.term.loadAddon(this.fitAddon),this.term.setOption("fontSize","12"),this.term.open(this.mterm),this.sub=void 0,this.bindKey("CTRL-SHIFT-C",t=>(this.mctxHandle({id:"copy"}),this.term.focus())),this.bindKey("CTRL-SHIFT-V",t=>this.mctxHandle({id:"paste"})),this.term.onKey(t=>{if(this.sub)return this.sub.send(Antunnel.Msg.DATA,new TextEncoder("utf-8").encode(t.key))}),this.on("focus",()=>this.term.focus()),this.mterm.contextmenuHandle=(t,e)=>(e.items=[{text:"__(Copy)",id:"copy"},{text:"__(Paste)",id:"paste"}],e.onmenuselect=t=>{if(t)return this.mctxHandle(t.data.item.data)},e.show(t)),this.resizeContent(),this.systemsetting.desktop.menu[this.name]||(this.systemsetting.desktop.menu[this.name]={text:"__(Open terminal)",app:"vTerm"}),this.on("hboxchange",t=>this.resizeContent()),t=()=>Antunnel.tunnel?(this.tunnel=Antunnel.tunnel,this.openSession()):this._gui.pushService("Antunnel/AntunnelService").then(t=>{if(this.systemsetting.system.tunnel_uri)return Antunnel.init(this.systemsetting.system.tunnel_uri).then(t=>(this.notify(__("Tunnel now connected to the server at: {0}",this.systemsetting.system.tunnel_uri)),this.tunnel=Antunnel.tunnel,this.openSession())).catch(t=>(Antunnel.tunnel&&Antunnel.tunnel.close(),this.error(__("Unable to connect to the tunnel: {0}",t.toString()),t),this.quit()))}).catch(t=>(this.error(__("Unable to run Antunnel service: {0}",t.toString()),t),this.quit())),window.Antunnel?t():this._api.requires("pkg://Antunnel/main.js").then(()=>t()).catch(t=>(this.error(__("Unable to load Antunnel: {0}",t.toString()),t),this.quit()))}mctxHandle(t){var e,n;switch(t.id){case"paste":return e=t=>{if(t&&""!==t)return t=t.replace(/\n/g,"\r"),this.sub&&this.sub.send(Antunnel.Msg.DATA,new TextEncoder("utf-8").encode(t)),this.term.focus()},this._api.getClipboard().then(t=>e(t)).catch(t=>(this.error(__("Unable to paste"),t),this.openDialog("TextDialog",{title:"Paste text"}).then(t=>e(t)).catch(t=>this.error(t.toString(),t))));case"copy":if(!(n=this.term.getSelection())||""===n)return;return this._api.setClipboard(n)}}resizeContent(){var t,e,n;if(this.fitAddon.fit(),e=this.term.cols,n=this.term.rows,this.sub)return(t=new Uint8Array(8)).set(Antunnel.Msg.bytes_of(e),0),t.set(Antunnel.Msg.bytes_of(n),4),this.sub.send(Antunnel.Msg.CTRL,t)}openSession(){return this.term.clear(),this.term.focus(),this.sub=new Antunnel.Subscriber("vterm"),this.sub.onopen=()=>(console.log("Subscribed"),this.resizeContent($(this.mterm).width(),$(this.mterm).height()),this.term.focus()),this.sub.onerror=t=>(this.error(__("Unable to connect to: vterm"),t),this.sub=void 0),this.sub.onmessage=t=>{if(this.term&&t.data)return this.term.write(new TextDecoder("utf-8").decode(t.data))},this.sub.onclose=()=>(this.sub=void 0,this.notify(__("Terminal connection closed")),this.quit()),this.tunnel.subscribe(this.sub)}cleanup(t){if(this.sub)return this.sub.close()}}).dependencies=["pkg://xTerm/main.js","pkg://xTerm/main.css","pkg://Antunnel/main.js"],this.OS.register("vTerm",t)}).call(this);
(function(){var t;(t=class extends this.OS.application.BaseApplication{constructor(t){super("vTerm",t)}main(){var t;return this.mterm=this.find("myterm"),this.term=new Terminal({cursorBlink:!0}),this.fitAddon=new FitAddon.FitAddon,this.term.loadAddon(this.fitAddon),this.term.setOption("fontSize","12"),this.term.open(this.mterm),this.sub=void 0,this.bindKey("CTRL-SHIFT-C",t=>(this.mctxHandle({id:"copy"}),this.term.focus())),this.bindKey("CTRL-SHIFT-V",t=>this.mctxHandle({id:"paste"})),this.term.onKey(t=>{if(this.sub)return this.sub.send(Antunnel.Msg.DATA,new TextEncoder("utf-8").encode(t.key))}),this.on("focus",()=>this.term.focus()),this.mterm.contextmenuHandle=(t,e)=>(e.items=[{text:"__(Copy)",id:"copy"},{text:"__(Paste)",id:"paste"}],e.onmenuselect=t=>{if(t)return this.mctxHandle(t.data.item.data)},e.show(t)),this.resizeContent(),this.systemsetting.desktop.menu[this.name]||(this.systemsetting.desktop.menu[this.name]={text:"__(Open terminal)",app:"vTerm"}),this.on("hboxchange",t=>this.resizeContent()),t=()=>Antunnel.tunnel?(this.tunnel=Antunnel.tunnel,this.openSession()):this._gui.pushService("Antunnel/AntunnelService").then(t=>{if(this.systemsetting.system.tunnel_uri)return Antunnel.init(this.systemsetting.system.tunnel_uri).then(t=>(this.notify(__("Tunnel now connected to the server at: {0}",this.systemsetting.system.tunnel_uri)),this.tunnel=Antunnel.tunnel,this.openSession())).catch(t=>(Antunnel.tunnel&&Antunnel.tunnel.close(),this.error(__("Unable to connect to the tunnel: {0}",t.toString()),t),this.quit()))}).catch(t=>(this.error(__("Unable to run Antunnel service: {0}",t.toString()),t),this.quit())),window.Antunnel?t():this._api.requires("pkg://Antunnel/main.js").then(()=>t()).catch(t=>(this.error(__("Unable to load Antunnel: {0}",t.toString()),t),this.quit()))}mctxHandle(t){var e,n;switch(t.id){case"paste":return e=t=>{if(t&&""!==t)return t=t.replace(/\n/g,"\r"),this.sub&&this.sub.send(Antunnel.Msg.DATA,new TextEncoder("utf-8").encode(t)),this.term.focus()},this._api.getClipboard().then(t=>e(t)).catch(t=>(this.error(__("Unable to paste"),t),this.openDialog("TextDialog",{title:"Paste text"}).then(t=>e(t)).catch(t=>this.error(t.toString(),t))));case"copy":if(!(n=this.term.getSelection())||""===n)return;return this._api.setClipboard(n)}}resizeContent(){var t,e,n;if(this.fitAddon.fit(),e=this.term.cols,n=this.term.rows,this.sub)return(t=new Uint8Array(8)).set(Antunnel.Msg.bytes_of(e,4),0),t.set(Antunnel.Msg.bytes_of(n,4),4),this.sub.send(Antunnel.Msg.CTRL,t)}openSession(){return this.term.clear(),this.term.focus(),this.sub=new Antunnel.Subscriber("vterm"),this.sub.onopen=()=>(console.log("Subscribed"),this.resizeContent($(this.mterm).width(),$(this.mterm).height()),this.term.focus()),this.sub.onerror=t=>(this.error(__("Unable to connect to: vterm"),t),this.sub=void 0),this.sub.onmessage=t=>{if(this.term&&t.data)return this.term.write(new TextDecoder("utf-8").decode(t.data))},this.sub.onclose=()=>(this.sub=void 0,this.notify(__("Terminal connection closed")),this.quit()),this.tunnel.subscribe(this.sub)}cleanup(t){if(this.sub)return this.sub.close()}}).dependencies=["pkg://xTerm/main.js","pkg://xTerm/main.css","pkg://Antunnel/main.js"],this.OS.register("vTerm",t)}).call(this);

View File

@ -1,4 +1,5 @@
{
"pkgname":"vTerm" ,
"app":"vTerm",
"name":"Virtual Terminal",
"description":"Access Unix terminal from web",
@ -6,7 +7,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1.15-a",
"version":"0.1.16-a",
"category":"System",
"iconclass":"bi bi-terminal-fill",
"mimes":["none"],

Binary file not shown.

View File

@ -120,8 +120,8 @@ class vTerm extends this.OS.application.BaseApplication
nrow = @term.rows
return unless @sub
arr = new Uint8Array(8)
arr.set Antunnel.Msg.bytes_of(ncol), 0
arr.set Antunnel.Msg.bytes_of(nrow), 4
arr.set Antunnel.Msg.bytes_of(ncol,4), 0
arr.set Antunnel.Msg.bytes_of(nrow,4), 4
@sub.send Antunnel.Msg.CTRL, arr
openSession: () ->

View File

@ -1,4 +1,5 @@
{
"pkgname":"vTerm" ,
"app":"vTerm",
"name":"Virtual Terminal",
"description":"Access Unix terminal from web",
@ -6,7 +7,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1.15-a",
"version":"0.1.16-a",
"category":"System",
"iconclass":"bi bi-terminal-fill",
"mimes":["none"],