xcube
Version:
Alipay Cube Tools
3 lines (2 loc) • 9.18 kB
JavaScript
;const _0x300ff8=_0x3f3b;(function(_0x48fbc9,_0x3c2189){const _0x481f49=_0x3f3b,_0x50beee=_0x48fbc9();while(!![]){try{const _0x13df0c=-parseInt(_0x481f49(0x1d3))/0x1*(-parseInt(_0x481f49(0x201))/0x2)+-parseInt(_0x481f49(0x1c8))/0x3*(-parseInt(_0x481f49(0x1d8))/0x4)+-parseInt(_0x481f49(0x1cb))/0x5+parseInt(_0x481f49(0x1dc))/0x6+-parseInt(_0x481f49(0x1e7))/0x7+parseInt(_0x481f49(0x1cc))/0x8*(-parseInt(_0x481f49(0x1d5))/0x9)+-parseInt(_0x481f49(0x1ea))/0xa;if(_0x13df0c===_0x3c2189)break;else _0x50beee['push'](_0x50beee['shift']());}catch(_0x2a813a){_0x50beee['push'](_0x50beee['shift']());}}}(_0x23de,0x54325));var __createBinding=this&&this[_0x300ff8(0x1e4)]||(Object['create']?function(_0x255ca0,_0x3027af,_0x3f113f,_0x5792bc){const _0xc94207=_0x300ff8;void 0x0===_0x5792bc&&(_0x5792bc=_0x3f113f);var _0x5d5631=Object['getOwnPropertyDescriptor'](_0x3027af,_0x3f113f);_0x5d5631&&!('get'in _0x5d5631?!_0x3027af['__esModule']:_0x5d5631['writable']||_0x5d5631['configurable'])||(_0x5d5631={'enumerable':!0x0,'get':function(){return _0x3027af[_0x3f113f];}}),Object[_0xc94207(0x1c5)](_0x255ca0,_0x5792bc,_0x5d5631);}:function(_0x183309,_0xe3228d,_0x113b2e,_0x572a1a){void 0x0===_0x572a1a&&(_0x572a1a=_0x113b2e),_0x183309[_0x572a1a]=_0xe3228d[_0x113b2e];}),__setModuleDefault=this&&this[_0x300ff8(0x1cd)]||(Object[_0x300ff8(0x1fc)]?function(_0x23fd2a,_0x1ab777){const _0x25e3e6=_0x300ff8;Object[_0x25e3e6(0x1c5)](_0x23fd2a,_0x25e3e6(0x1d6),{'enumerable':!0x0,'value':_0x1ab777});}:function(_0x2b56a4,_0x468f88){const _0x275665=_0x300ff8;_0x2b56a4[_0x275665(0x1d6)]=_0x468f88;}),__importStar=this&&this[_0x300ff8(0x1f5)]||function(_0x5cb4c8){const _0x4641c3=_0x300ff8;if(_0x5cb4c8&&_0x5cb4c8[_0x4641c3(0x1d9)])return _0x5cb4c8;var _0x509c6d={};if(null!=_0x5cb4c8){for(var _0x32dee9 in _0x5cb4c8)'default'!==_0x32dee9&&Object[_0x4641c3(0x1f7)][_0x4641c3(0x1c6)][_0x4641c3(0x1d2)](_0x5cb4c8,_0x32dee9)&&__createBinding(_0x509c6d,_0x5cb4c8,_0x32dee9);}return __setModuleDefault(_0x509c6d,_0x5cb4c8),_0x509c6d;};Object[_0x300ff8(0x1c5)](exports,_0x300ff8(0x1d9),{'value':!0x0}),exports['fillFileRemoteUrl']=exports[_0x300ff8(0x207)]=exports[_0x300ff8(0x1c4)]=exports[_0x300ff8(0x200)]=exports[_0x300ff8(0x1c7)]=exports['launch']=exports['Singleton']=exports[_0x300ff8(0x1d0)]=void 0x0;const WS=__importStar(require('ws')),Http=__importStar(require('http')),shared_1=require('@xcube/shared'),QRCode=require(_0x300ff8(0x1df));function _0x3f3b(_0x3a977e,_0x209da5){const _0x23de11=_0x23de();return _0x3f3b=function(_0x3f3bf6,_0x3b7462){_0x3f3bf6=_0x3f3bf6-0x1c3;let _0x288f0b=_0x23de11[_0x3f3bf6];return _0x288f0b;},_0x3f3b(_0x3a977e,_0x209da5);}var State,Singleton;function launch(_0x4c863b){const _0x592739=_0x300ff8;return _0x4c863b&&(Singleton['onEvent']=_0x4c863b),(0x0,shared_1[_0x592739(0x1e9)])(_0x592739(0x204)+Singleton['IP']+':'+Singleton[_0x592739(0x1ed)]+']'),new Promise((_0x324e04,_0x5aff75)=>{const _0x13aee5=_0x592739;Singleton[_0x13aee5(0x1ef)][_0x13aee5(0x1ec)](Singleton[_0x13aee5(0x1ed)],()=>{_0x324e04();});});}function clientSessions(){const _0x4a786a=_0x300ff8,_0x23df1b=new Array();if(Singleton[_0x4a786a(0x1da)]&&Singleton[_0x4a786a(0x1da)][_0x4a786a(0x1ca)])for(const _0x72bf07 of Singleton[_0x4a786a(0x1da)]['clients']){const _0x3e2690=_0x72bf07;_0x72bf07['readyState']===WS[_0x4a786a(0x1fa)]&&_0x3e2690[_0x4a786a(0x1f4)]&&_0x23df1b['push'](_0x3e2690['session']);}return _0x23df1b;}function broadcase(_0x506d6c){const _0x230e13=_0x300ff8;if(Singleton['wss'])for(const _0x336ab5 of Singleton['wss'][_0x230e13(0x1ca)]){const _0x4a41f3=_0x336ab5;_0x336ab5[_0x230e13(0x202)]===WS['OPEN']&&_0x4a41f3[_0x230e13(0x1f4)]&&_0x336ab5[_0x230e13(0x1c4)](_0x506d6c);}return Promise['resolve']();}function _0x23de(){const _0x44f500=['state','qrvalue','client-error','env','urlencode','platform','name','send','defineProperty','hasOwnProperty','clientSessions','27cRtdVY','parse','clients','692185AqfGjT','2867528XHpALI','__setModuleDefault','UNKNOWN','server-listening','State','loge','call','479ybofTo','\x20lost\x20connection','9XwRnof','default','pong','168332SHaKTO','__esModule','wss','headers','2568858dwvPcr','Communication\x20channel\x20is\x20ready,\x20please\x20scan\x20the\x20QR\x20code\x20or\x20enter\x20the\x20port\x20to\x20connect','generate','qrcode-terminal','/api?action=file&path=','close','connection','onEvent','__createBinding','error','message','618996TjJfBb','server-error','logi','1827960cfeeul','terminate','listen','PORT','http://','server','win32','getTime','LISTENING','createServer','session','__importStar','TERM_PROGRAM','prototype','\x20has\x20connected','cube-devtools','OPEN','launch','create','cube-devtools\x20has\x20connected','Singleton','&stamp=','broadcase','1278QHeSrM','readyState','Server','Start\x20service\x20[','receiveSocketMessage'];_0x23de=function(){return _0x44f500;};return _0x23de();}function send(_0x5b04a7,_0x40334e){return new Promise((_0x368de8,_0x4a8a4c)=>{const _0x44dc92=_0x3f3b,_0x112a30=client(_0x5b04a7);_0x112a30?_0x112a30[_0x44dc92(0x1c4)](_0x40334e,_0x57f19c=>{_0x57f19c?_0x4a8a4c(_0x57f19c):_0x368de8();}):_0x4a8a4c(Error('No\x20connected\x20device\x20currently'));});}function client(_0x11a691){const _0x477c12=_0x300ff8;let _0x23d140;if(Singleton['wss']&&Singleton['wss'][_0x477c12(0x1ca)])for(const _0x42897d of Singleton[_0x477c12(0x1da)][_0x477c12(0x1ca)]){const _0xc2a4a1=_0x42897d;_0x42897d[_0x477c12(0x202)]===WS[_0x477c12(0x1fa)]&&_0xc2a4a1['session']['token']===_0x11a691&&(_0x23d140=_0x42897d);}return _0x23d140;}function qrvalue(){const _0xe0308f=_0x300ff8;return'alipays://platformapi/startApp?appId=20002042&action=connect&ip='+Singleton['IP']+'&port='+Singleton[_0xe0308f(0x1ed)];}function fillFileRemoteUrl(_0x19c6fc){const _0x54791b=_0x300ff8;return _0x54791b(0x1ee)+Singleton['IP']+':'+Singleton['PORT']+_0x54791b(0x1e0)+(0x0,shared_1[_0x54791b(0x20a)])(_0x19c6fc)+_0x54791b(0x1ff)+new Date()[_0x54791b(0x1f1)]();}!function(_0x2a018e){const _0x581189=_0x300ff8;_0x2a018e[_0x2a018e[_0x581189(0x1ce)]=0x0]=_0x581189(0x1ce),_0x2a018e[_0x2a018e['INVALID']=0x1]='INVALID',_0x2a018e[_0x2a018e[_0x581189(0x1f2)]=0x2]=_0x581189(0x1f2);}(State=exports[_0x300ff8(0x1d0)]||(exports['State']={})),function(_0x521688){const _0x40f20a=_0x300ff8;_0x521688['IP']=(0x0,shared_1['localip'])(),_0x521688['PORT']=0x2329,_0x521688[_0x40f20a(0x1ef)]=Http[_0x40f20a(0x1f3)](),_0x521688['wss']=new WS[(_0x40f20a(0x203))]({'server':_0x521688[_0x40f20a(0x1ef)]}),_0x521688['receiveSocketMessage']=void 0x0,_0x521688[_0x40f20a(0x1e3)]=(_0x34a351,_0x4c3cc8)=>{},_0x521688[_0x40f20a(0x206)]=State['UNKNOWN'];}(Singleton=exports[_0x300ff8(0x1fe)]||(exports[_0x300ff8(0x1fe)]={})),Singleton[_0x300ff8(0x1da)]['on'](_0x300ff8(0x1e5),_0x2ff2ce=>{const _0x394227=_0x300ff8;Singleton['state']=State['INVALID'],Singleton[_0x394227(0x1e3)](_0x394227(0x1e8),_0x2ff2ce),(0x0,shared_1[_0x394227(0x1d1)])(''+_0x2ff2ce);}),Singleton[_0x300ff8(0x1da)]['on'](_0x300ff8(0x1d7),_0x505244=>{}),Singleton['wss']['on']('listening',()=>{const _0x4835c1=_0x300ff8;Singleton[_0x4835c1(0x206)]=State['LISTENING'],Singleton[_0x4835c1(0x1e3)](_0x4835c1(0x1cf),void 0x0),(0x0,shared_1[_0x4835c1(0x1e9)])(_0x4835c1(0x1dd));let _0x189447=!0x0;_0x4835c1(0x1f0)===process[_0x4835c1(0x20b)]&&'vscode'!==process[_0x4835c1(0x209)][_0x4835c1(0x1f6)]&&(_0x189447=void 0x0),QRCode[_0x4835c1(0x1de)](qrvalue(),{'small':_0x189447});}),Singleton[_0x300ff8(0x1da)]['on'](_0x300ff8(0x1e2),(_0x429f04,_0x37bf3f)=>{const _0x32ae17=_0x300ff8;var _0x2821a2;if(Singleton['onEvent']('server-connection',{'client':_0x429f04,'request':_0x37bf3f}),_0x37bf3f['headers'][_0x32ae17(0x1f4)]){const _0x3d0124=_0x429f04;_0x3d0124['session']=JSON[_0x32ae17(0x1c9)](decodeURI('string'==typeof _0x37bf3f[_0x32ae17(0x1db)][_0x32ae17(0x1f4)]?_0x37bf3f['headers'][_0x32ae17(0x1f4)]:'{}')),(0x0,shared_1['logi'])((null===(_0x2821a2=null==_0x3d0124?void 0x0:_0x3d0124['session'])||void 0x0===_0x2821a2?void 0x0:_0x2821a2[_0x32ae17(0x1c3)])+_0x32ae17(0x1f8));}else(0x0,shared_1['logi'])(_0x32ae17(0x1fd));_0x429f04['on'](_0x32ae17(0x1e5),_0x33bc94=>{const _0x2daa43=_0x32ae17;Singleton['onEvent'](_0x2daa43(0x208),_0x33bc94),_0x429f04['terminate']();}),_0x429f04['on'](_0x32ae17(0x1e1),_0x1a8e75=>{const _0x110126=_0x32ae17;Singleton[_0x110126(0x1e3)]('client-close',_0x1a8e75),_0x429f04[_0x110126(0x1eb)](),(0x0,shared_1['logw'])((_0x429f04['session']?_0x429f04[_0x110126(0x1f4)]['name']:_0x110126(0x1f9))+_0x110126(0x1d4));}),_0x429f04['on']('pong',()=>{}),_0x429f04['on'](_0x32ae17(0x1e6),_0x28c1f1=>{const _0x20ccae=_0x32ae17;(0x0,shared_1[_0x20ccae(0x1e9)])(''+_0x28c1f1),Singleton[_0x20ccae(0x205)]&&Singleton[_0x20ccae(0x205)](_0x28c1f1,_0x429f04);});}),setInterval(()=>{const _0x4266ce=_0x300ff8;if(Singleton[_0x4266ce(0x1da)]&&Singleton['wss']['clients']){for(const _0x234a2c of Singleton[_0x4266ce(0x1da)][_0x4266ce(0x1ca)])_0x234a2c[_0x4266ce(0x202)]===WS['CLOSED']&&_0x234a2c[_0x4266ce(0x1eb)]();}},0x1388),exports[_0x300ff8(0x1fb)]=launch,exports[_0x300ff8(0x1c7)]=clientSessions,exports[_0x300ff8(0x200)]=broadcase,exports[_0x300ff8(0x1c4)]=send,exports[_0x300ff8(0x207)]=qrvalue,exports['fillFileRemoteUrl']=fillFileRemoteUrl;
//# sourceMappingURL=server.js.map