From ab99ba452dad40accb100ec4b964fabaac7a8d20 Mon Sep 17 00:00:00 2001 From: lxsang Date: Mon, 28 Dec 2020 16:48:36 +0000 Subject: [PATCH] update packages --- Antunnel/build/debug/main.js | 2 +- Antunnel/build/debug/package.json | 2 +- Antunnel/build/release/Antunnel.zip | Bin 7289 -> 7322 bytes Antunnel/coffees/Antunnel.coffee | 3 ++- Antunnel/package.json | 2 +- packages.json | 6 +++--- vTerm/build/debug/package.json | 4 ++-- vTerm/build/release/vTerm.zip | Bin 4729 -> 4729 bytes vTerm/package.json | 4 ++-- 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Antunnel/build/debug/main.js b/Antunnel/build/debug/main.js index 0fa1351..c337629 100644 --- a/Antunnel/build/debug/main.js +++ b/Antunnel/build/debug/main.js @@ -1 +1 @@ -(function(){var e,n,t,s,i;(t=class e{constructor(){this.header={sid:0,cid:0,type:0,size:0},this.data=void 0}as_raw(){var n,t,s;return s=13+this.header.size,(n=new Uint8Array(s)).set(e.MAGIC_START,0),n[2]=this.header.type,t=e.bytes_of(this.header.cid),n.set(t,3),t=e.bytes_of(this.header.sid),n.set(t,5),t=e.bytes_of(this.header.size,4),n.set(t,7),this.data&&n.set(this.data,11),n.set(e.MAGIC_END,this.header.size+11),n.buffer}}).decode=function(e){return new Promise((function(n,s){var i;return i=new t,t.int_from(t.MAGIC_START,0)!==t.int_from(e,0)?s("Unmatch message begin magic number"):(i.header.type=e[2],i.header.cid=t.int_from(e,3),i.header.sid=t.int_from(e,5),i.header.size=t.int_from(e,7,4),i.data=e.slice(11,11+i.header.size),t.int_from(t.MAGIC_END,0)!==t.int_from(e,11+i.header.size)?s("Unmatch message end magic number"):n(i))}))},t.bytes_of=function(e,n){var t;return 4!==n&&(n=2),(t=new Uint8Array(n))[0]=255&e,e>>=8,t[1]=255&e,4!==n||(e>>=8,t[2]=255&e,e>>=8,t[3]=255&e),t},t.int_from=function(e,n,t){return 4!==t?e[n]|e[n+1]<<8:e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24},t.OK=0,t.ERROR=1,t.DATA=6,t.CLOSE=5,t.SUBSCRIBE=2,t.UNSUBSCRIBE=3,t.CTRL=7,t.PING=8,t.MAGIC_END=[68,84],t.MAGIC_START=[78,65],s=class{constructor(e){this.channel=e,this.id=void 0,this.channel_id=void 0,this.onmessage=void 0,this.onerror=void 0,this.onopen=void 0,this.onclose=void 0,this.tunnel=void 0,this.is_opened=!1}send(e,n){if(this.tunnel){if(this.is_opened)return this.tunnel.send(this.genmsg(e,n));this.onerror&&this.onerror("Channel is not opened yet")}else this.onerror&&this.onerror("Tunnel is not opened")}genmsg(e,n){var s;return(s=new t).header.sid=this.id,s.header.cid=this.channel_id,s.header.type=e,s.header.size=n?n.length:0,s.data=n,s}close(e){if(this.is_opened=!1,this.tunnel)return this.tunnel.unsubscribe(this,e)}},e=class{constructor(e){this.uri=e,this.socket=void 0,this.pending={},this.subscribers={},this.onclose=void 0}ready(){return new Promise((e,n)=>this.uri?void 0!==this.socket?e():(console.log("Connect to "+this.uri),this.socket=new WebSocket(this.uri),this.socket.binaryType="arraybuffer",this.socket.onmessage=e=>this.process(e),this.socket.onclose=e=>{var n,t,s,i;for(n in this.socket=void 0,t=this.pending)(i=t[n]).tunnel=void 0,i.onclose&&i.onclose();for(n in s=this.subscribers)(i=s[n]).tunnel=void 0,i.is_opened=!1,i.onclose&&i.onclose();if(this.pending={},this.subscribe={},this.onclose())return this.onclose()},this.socket.onerror=e=>{var n,t,s,i,r;for(n in t=this.pending)(r=t[n]).onerror&&r.onerror(e.toString());for(n in i=[],s=this.subscribers)(r=s[n]).onerror&&i.push(r.onerror(e.toString()));return i},this.socket.onopen=n=>e()):n())}process(e){return t.decode(new Uint8Array(e.data)).then(e=>{var n,s;switch(n=(e,n)=>{var t;if(!(t=this.pending[e.header.sid]))return(t=this.subscribers[e.header.sid])&&t[n]?t[n](e):void 0;t[n]&&t[n](e)},e.header.type){case t.OK:if(!(s=this.pending[e.header.sid]))return n(e,"onmessage");if(delete this.pending[e.header.sid],s.id=t.int_from(e.data,0),s.channel_id=e.header.cid,this.subscribers[s.id]=s,s.is_opened=!0,s.onopen)return s.onopen();break;case t.DATA:return n(e,"onmessage");case t.ERROR:return n(e,"onerror");case t.UNSUBSCRIBE:if(!(s=this.subscribers[e.header.sid]))return;return s.close(!0);case t.PING:break;default:return console.error(`Message of type ${e.header.type} is unsupported`,e)}}).catch(e=>{var n,t,s,i;for(n in t=this.pending)(i=t[n]).onerror&&i.onerror(e);for(n in s=this.subscribers)(i=s[n]).onerror&&i.onerror(e);return console.log(e)})}subscribe(e){return this.ready().then(()=>{for(e.tunnel=this,e.id=Math.floor(1e3*Math.random())+1;this.subscribers[e.id]||this.pending[e.id];)e.id=Math.floor(1e3*Math.random())+1;return this.pending[e.id]=e,this.send(e.genmsg(t.SUBSCRIBE,(new TextEncoder).encode(e.channel)))}).catch((function(n){if(e.onerror)return e.onerror(n.toString())}))}unsubscribe(e,n){return this.ready().then(()=>{if(this.subscribers[e.id])return n||this.send(e.genmsg(t.UNSUBSCRIBE,void 0)),e.onclose&&e.onclose(),delete this.subscribers[e.id],e.tunnel=void 0,e.is_opened=!1}).catch((function(n){if(e.onerror)return e.onerror(n.toString())}))}send(e){return this.socket.send(e.as_raw())}close(){if(console.log("Close connection to "+this.uri),this.socket&&this.socket.close(),this.onclose())return this.onclose()}},(i=this).Antunnel||(i.Antunnel={tunnel:void 0,init:function(n){return new Promise((function(t,s){return i.Antunnel.tunnel?t(i.Antunnel.tunnel):(i.Antunnel.tunnel=new e(n),i.Antunnel.tunnel.onclose=function(){return i.Antunnel.tunnel=void 0},i.Antunnel.tunnel.ready().then((function(){return t(i.Antunnel.tunnel)})).catch((function(e){return s(e)})))}))},Subscriber:s,Msg:t}),n=class extends OS.application.BaseService{constructor(e){super("AntunnelService",e),this.text=__("Tunnel"),this.iconclass="fa fa-close",this.is_connect=!1,this.nodes=[{text:__("Connect"),id:1},{text:__("Disconnect"),id:2},{text:__("Enter uri"),id:3},{text:__("Exit"),id:4}],this.onchildselect=e=>this.action(e)}init(){return this.watch(1500,()=>{var e;if(e=!1,void 0!==Antunnel.tunnel&&(e=!0),e!==this.is_connect)return this.is_connect=e,this.iconclass="fa fa-circle",this.is_connect||(this.iconclass="fa fa-close"),this.update()}),OS.onexit("cleanupAntunnel",()=>(Antunnel.tunnel&&Antunnel.tunnel.close(),this.quit()))}action(e){var n;switch(n=()=>this._gui.openDialog("PromptDialog",{title:__("Tunnel uri"),label:__("Please enter tunnel uri"),value:"wss://localhost/tunnel"}).then(e=>{if(e&&""!==e)return this.systemsetting.system.tunnel_uri=e,this.start()}),e.data.item.data.id){case 1:if(this.is_connect)return;return this.systemsetting.system.tunnel_uri?this.start():n();case 2:if(Antunnel.tunnel)return Antunnel.tunnel.close();break;case 3:return Antunnel.tunnel&&Antunnel.tunnel.close(),n();case 4:return Antunnel.tunnel&&Antunnel.tunnel.close(),this.quit()}}start(){if(this.systemsetting.system.tunnel_uri&&!Antunnel.tunnel)return Antunnel.init(this.systemsetting.system.tunnel_uri).then(e=>this.notify(__("Tunnel now connected to the server at: {0}",this.systemsetting.system.tunnel_uri))).catch(e=>(Antunnel.tunnel&&Antunnel.tunnel.close(),this.error(__("Unable to connect to the tunnel: {0}",e.toString()),e)))}awake(){}},this.OS.register("AntunnelService",n)}).call(this); \ No newline at end of file +(function(){var e,n,t,s,i;(t=class e{constructor(){this.header={sid:0,cid:0,type:0,size:0},this.data=void 0}as_raw(){var n,t,s;return s=13+this.header.size,(n=new Uint8Array(s)).set(e.MAGIC_START,0),n[2]=this.header.type,t=e.bytes_of(this.header.cid),n.set(t,3),t=e.bytes_of(this.header.sid),n.set(t,5),t=e.bytes_of(this.header.size,4),n.set(t,7),this.data&&n.set(this.data,11),n.set(e.MAGIC_END,this.header.size+11),n.buffer}}).decode=function(e){return new Promise((function(n,s){var i;return i=new t,t.int_from(t.MAGIC_START,0)!==t.int_from(e,0)?s("Unmatch message begin magic number"):(i.header.type=e[2],i.header.cid=t.int_from(e,3),i.header.sid=t.int_from(e,5),i.header.size=t.int_from(e,7,4),i.data=e.slice(11,11+i.header.size),t.int_from(t.MAGIC_END,0)!==t.int_from(e,11+i.header.size)?s("Unmatch message end magic number"):n(i))}))},t.bytes_of=function(e,n){var t;return 4!==n&&(n=2),(t=new Uint8Array(n))[0]=255&e,e>>=8,t[1]=255&e,4!==n||(e>>=8,t[2]=255&e,e>>=8,t[3]=255&e),t},t.int_from=function(e,n,t){return 4!==t?e[n]|e[n+1]<<8:e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24},t.OK=0,t.ERROR=1,t.DATA=6,t.CLOSE=5,t.SUBSCRIBE=2,t.UNSUBSCRIBE=3,t.CTRL=7,t.PING=8,t.MAGIC_END=[68,84],t.MAGIC_START=[78,65],s=class{constructor(e){this.channel=e,this.id=void 0,this.channel_id=void 0,this.onmessage=void 0,this.onerror=void 0,this.onopen=void 0,this.onclose=void 0,this.tunnel=void 0,this.is_opened=!1}send(e,n){if(this.tunnel){if(this.is_opened)return this.tunnel.send(this.genmsg(e,n));this.onerror&&this.onerror("Channel is not opened yet")}else this.onerror&&this.onerror("Tunnel is not opened")}genmsg(e,n){var s;return(s=new t).header.sid=this.id,s.header.cid=this.channel_id,s.header.type=e,s.header.size=n?n.length:0,s.data=n,s}close(e){if(this.is_opened=!1,this.tunnel)return this.tunnel.unsubscribe(this,e)}},e=class{constructor(e){this.uri=e,this.socket=void 0,this.pending={},this.subscribers={},this.onclose=void 0}ready(){return new Promise((e,n)=>this.uri?void 0!==this.socket?e():(console.log("Connect to "+this.uri),this.socket=new WebSocket(this.uri),this.socket.binaryType="arraybuffer",this.socket.onmessage=e=>this.process(e),this.socket.onclose=e=>{var n,t,s,i;for(n in this.socket=void 0,t=this.pending)(i=t[n]).tunnel=void 0,i.onclose&&i.onclose();for(n in s=this.subscribers)(i=s[n]).tunnel=void 0,i.is_opened=!1,i.onclose&&i.onclose();if(this.pending={},this.subscribe={},this.onclose())return this.onclose()},this.socket.onerror=e=>{var n,t,s,i,r;for(n in t=this.pending)(r=t[n]).onerror&&r.onerror(e.toString());for(n in i=[],s=this.subscribers)(r=s[n]).onerror&&i.push(r.onerror(e.toString()));return i},this.socket.onopen=n=>e()):n())}process(e){return t.decode(new Uint8Array(e.data)).then(e=>{var n,s;switch(n=(e,n)=>{var t;if(!(t=this.pending[e.header.sid]))return(t=this.subscribers[e.header.sid])&&t[n]?t[n](e):void 0;t[n]&&t[n](e)},e.header.type){case t.OK:if(!(s=this.pending[e.header.sid]))return n(e,"onmessage");if(delete this.pending[e.header.sid],s.id=t.int_from(e.data,0),s.channel_id=e.header.cid,this.subscribers[s.id]=s,s.is_opened=!0,s.onopen)return s.onopen();break;case t.DATA:return n(e,"onmessage");case t.CTRL:return n(e,"onctrl");case t.ERROR:return n(e,"onerror");case t.UNSUBSCRIBE:if(!(s=this.subscribers[e.header.sid]))return;return s.close(!0);case t.PING:break;default:return console.error(`Message of type ${e.header.type} is unsupported`,e)}}).catch(e=>{var n,t,s,i;for(n in t=this.pending)(i=t[n]).onerror&&i.onerror(e);for(n in s=this.subscribers)(i=s[n]).onerror&&i.onerror(e);return console.log(e)})}subscribe(e){return this.ready().then(()=>{for(e.tunnel=this,e.id=Math.floor(1e3*Math.random())+1;this.subscribers[e.id]||this.pending[e.id];)e.id=Math.floor(1e3*Math.random())+1;return this.pending[e.id]=e,this.send(e.genmsg(t.SUBSCRIBE,(new TextEncoder).encode(e.channel)))}).catch((function(n){if(e.onerror)return e.onerror(n.toString())}))}unsubscribe(e,n){return this.ready().then(()=>{if(this.subscribers[e.id])return n||this.send(e.genmsg(t.UNSUBSCRIBE,void 0)),e.onclose&&e.onclose(),delete this.subscribers[e.id],e.tunnel=void 0,e.is_opened=!1}).catch((function(n){if(e.onerror)return e.onerror(n.toString())}))}send(e){return this.socket.send(e.as_raw())}close(){if(console.log("Close connection to "+this.uri),this.socket&&this.socket.close(),this.onclose())return this.onclose()}},(i=this).Antunnel||(i.Antunnel={tunnel:void 0,init:function(n){return new Promise((function(t,s){return i.Antunnel.tunnel?t(i.Antunnel.tunnel):(i.Antunnel.tunnel=new e(n),i.Antunnel.tunnel.onclose=function(){return i.Antunnel.tunnel=void 0},i.Antunnel.tunnel.ready().then((function(){return t(i.Antunnel.tunnel)})).catch((function(e){return s(e)})))}))},Subscriber:s,Msg:t}),n=class extends OS.application.BaseService{constructor(e){super("AntunnelService",e),this.text=__("Tunnel"),this.iconclass="fa fa-close",this.is_connect=!1,this.nodes=[{text:__("Connect"),id:1},{text:__("Disconnect"),id:2},{text:__("Enter uri"),id:3},{text:__("Exit"),id:4}],this.onchildselect=e=>this.action(e)}init(){return this.watch(1500,()=>{var e;if(e=!1,void 0!==Antunnel.tunnel&&(e=!0),e!==this.is_connect)return this.is_connect=e,this.iconclass="fa fa-circle",this.is_connect||(this.iconclass="fa fa-close"),this.update()}),OS.onexit("cleanupAntunnel",()=>(Antunnel.tunnel&&Antunnel.tunnel.close(),this.quit()))}action(e){var n;switch(n=()=>this._gui.openDialog("PromptDialog",{title:__("Tunnel uri"),label:__("Please enter tunnel uri"),value:"wss://localhost/tunnel"}).then(e=>{if(e&&""!==e)return this.systemsetting.system.tunnel_uri=e,this.start()}),e.data.item.data.id){case 1:if(this.is_connect)return;return this.systemsetting.system.tunnel_uri?this.start():n();case 2:if(Antunnel.tunnel)return Antunnel.tunnel.close();break;case 3:return Antunnel.tunnel&&Antunnel.tunnel.close(),n();case 4:return Antunnel.tunnel&&Antunnel.tunnel.close(),this.quit()}}start(){if(this.systemsetting.system.tunnel_uri&&!Antunnel.tunnel)return Antunnel.init(this.systemsetting.system.tunnel_uri).then(e=>this.notify(__("Tunnel now connected to the server at: {0}",this.systemsetting.system.tunnel_uri))).catch(e=>(Antunnel.tunnel&&Antunnel.tunnel.close(),this.error(__("Unable to connect to the tunnel: {0}",e.toString()),e)))}awake(){}},this.OS.register("AntunnelService",n)}).call(this); \ No newline at end of file diff --git a/Antunnel/build/debug/package.json b/Antunnel/build/debug/package.json index 4dbc224..39afdb6 100644 --- a/Antunnel/build/debug/package.json +++ b/Antunnel/build/debug/package.json @@ -9,7 +9,7 @@ "author": "Xuan Sang LE", "email": "xsang.le@lxsang.me" }, - "version":"0.1.7-a", + "version":"0.1.8-a", "category":"Library", "iconclass":"fa fa-adn", "mimes":["none"], diff --git a/Antunnel/build/release/Antunnel.zip b/Antunnel/build/release/Antunnel.zip index 30b1cf43ce766f5d240a66c28fcea4a7676916c5..1038ee94978744bae681591fbc1cf9a55a4febd4 100644 GIT binary patch delta 188 zcmexqG0Rdsz?+$civa{4w$2H3-Y?j_MuLH1%|`J=9&zW8ARnuu)RNMoJcT@sR2`-K zyyTLioXvSWK0HhhTQ~2KsA1#)X)FFXeaB`8DG5eKi^-AF1-vLmO}-|r0aQInMuzd? zWLX&r7nqJzMg|5D<^fv|BmAWp7zz@TvlG)(^|Ffd^8&nC*+6p4K)4J@-;)OM0HU5Y A-~a#s delta 122 zcmbPb`O`u?z?+$civa|JQsx9+xG2ETEy2Lhy-_@oXY))RCmyDtl+AY~Y8W{{(ngjQ z+?x}nBp4aZCs#=q@S{v+b1zSp@)! CEFyFO diff --git a/Antunnel/coffees/Antunnel.coffee b/Antunnel/coffees/Antunnel.coffee index 80e7571..a02d11e 100644 --- a/Antunnel/coffees/Antunnel.coffee +++ b/Antunnel/coffees/Antunnel.coffee @@ -168,7 +168,8 @@ class AntunnelApi when Msg.DATA relay_msg msg, "onmessage" - + when Msg.CTRL + relay_msg msg, "onctrl" when Msg.ERROR relay_msg msg, "onerror" diff --git a/Antunnel/package.json b/Antunnel/package.json index 4dbc224..39afdb6 100644 --- a/Antunnel/package.json +++ b/Antunnel/package.json @@ -9,7 +9,7 @@ "author": "Xuan Sang LE", "email": "xsang.le@lxsang.me" }, - "version":"0.1.7-a", + "version":"0.1.8-a", "category":"Library", "iconclass":"fa fa-adn", "mimes":["none"], diff --git a/packages.json b/packages.json index 7c8a396..4e485cc 100644 --- a/packages.json +++ b/packages.json @@ -35,7 +35,7 @@ "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Antunnel/README.md", "category": "Library", "author": "Xuan Sang LE", - "version": "0.1.7-a", + "version": "0.1.8-a", "dependencies": [], "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Antunnel/build/release/Antunnel.zip" }, @@ -235,8 +235,8 @@ "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/vTerm/README.md", "category": "System", "author": "Xuan Sang LE", - "version": "0.1.10-a", - "dependencies": ["Antunnel@0.1.7-a","xTerm@4.8.1-r"], + "version": "0.1.11-a", + "dependencies": ["Antunnel@0.1.8-a","xTerm@4.8.1-r"], "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/vTerm/build/release/vTerm.zip" }, { diff --git a/vTerm/build/debug/package.json b/vTerm/build/debug/package.json index 0ba6443..75af356 100644 --- a/vTerm/build/debug/package.json +++ b/vTerm/build/debug/package.json @@ -6,12 +6,12 @@ "author": "Xuan Sang LE", "email": "xsang.le@gmail.com" }, - "version":"0.1.10-a", + "version":"0.1.11-a", "category":"System", "iconclass":"fa fa-terminal", "mimes":["none"], "dependencies": [ - "Antunnel@0.1.7-a", + "Antunnel@0.1.8-a", "xTerm@4.8.1-r" ], "locales":{ diff --git a/vTerm/build/release/vTerm.zip b/vTerm/build/release/vTerm.zip index 240de0a48d4111fb83f383de9743f512184c626c..5728a2a734c78daa9d41abfd28f288660ff8326a 100644 GIT binary patch delta 110 zcmeyV@>7K;z?+$civa|_wQl5j!Nv5gb@Ml_NG2dXIgnSC<6G;Tz*Vb0eVbgz`<~Ho tavon3qs8Wrd{Y=f3fcuOgQyrmV-Ph_&=f?S5HvyPVi7U|iCG9a0sv^TEr$RA delta 110 zcmeyV@>7K;z?+$civa|VrEKJR!NqheW%D<#NG2dXIgnSC<5WtK~#*OF^HNdXbPfE2$~>tu?QJ~#4Lmy0j(A(lK=n! diff --git a/vTerm/package.json b/vTerm/package.json index 0ba6443..75af356 100644 --- a/vTerm/package.json +++ b/vTerm/package.json @@ -6,12 +6,12 @@ "author": "Xuan Sang LE", "email": "xsang.le@gmail.com" }, - "version":"0.1.10-a", + "version":"0.1.11-a", "category":"System", "iconclass":"fa fa-terminal", "mimes":["none"], "dependencies": [ - "Antunnel@0.1.7-a", + "Antunnel@0.1.8-a", "xTerm@4.8.1-r" ], "locales":{