1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
'use strict';var __createBinding=this&&this["__createBinding"]||(Object["create"]?function(_0x3e1b0f,_0xb59403,_0x20de4d,_0x218c01){const _0x4eb85c=_0x1ede40,_0xbca2d={'HNdUv':function(_0x295f25,_0x22e2a4){return _0x295f25===_0x22e2a4;}};if(_0xbca2d["HNdUv"](_0x218c01,undefined))_0x218c01=_0x20de4d;var _0x350502=Object["getOwnPropertyDescriptor"](_0xb59403,_0x20de4d);(!_0x350502||('get'in _0x350502?!_0xb59403["__esModule"]:_0x350502["writable"]||_0x350502["configurable"]))&&(_0x350502={'enumerable':!![],'get':function(){return _0xb59403[_0x20de4d];}}),Object['defineProperty'](_0x3e1b0f,_0x218c01,_0x350502);}:function(_0x1a00e9,_0x491e2e,_0x1a820a,_0x4989a8){if(_0x4989a8===undefined)_0x4989a8=_0x1a820a;_0x1a00e9[_0x4989a8]=_0x491e2e[_0x1a820a];}),__setModuleDefault=this&&this["__setModuleDefault"]||(Object["create"]?function(_0x29c4c5,_0x32ace2){const _0x182fa9=_0x1ede40,_0x4cf4ff={'RDtLV':"default"};Object["defineProperty"](_0x29c4c5,_0x4cf4ff["RDtLV"],{'enumerable':!![],'value':_0x32ace2});}:function(_0x52f038,_0x328d91){const _0xaaa62a=_0x1ede40,_0xd5699c={'UDNOD':"default"};_0x52f038[_0xd5699c["UDNOD"]]=_0x328d91;}),__importStar=this&&this['__importStar']||(function(){const _0x2df000=_0x1ede40,_0x1c3c71={'lTDeF':function(_0x433649,_0x107638){return _0x433649!==_0x107638;},'LynhB':function(_0x115f72,_0x2be46b){return _0x115f72===_0x2be46b;},'qBjFZ':"ChbgJ",'EpACO':"4|3|2|1|0",'QIZWZ':function(_0x577f98,_0x42790c,_0x5d0b9b){return _0x577f98(_0x42790c,_0x5d0b9b);},'cedxp':function(_0x1669d8,_0x4b8dec){return _0x1669d8<_0x4b8dec;},'KJmyh':function(_0x33bfc2,_0x157ade){return _0x33bfc2!==_0x157ade;},'Otlxd':function(_0x5c2307,_0x59b029,_0x5e4312,_0x223386){return _0x5c2307(_0x59b029,_0x5e4312,_0x223386);}};var _0x40485b=function(_0x332d56){return _0x40485b=Object['getOwnPropertyNames']||function(_0x293b06){const _0xde3d97=_0x3fbb;var _0x2ba725=[];for(var _0x200cc6 in _0x293b06)if(Object['prototype']["hasOwnProperty"]["call"](_0x293b06,_0x200cc6))_0x2ba725[_0x2ba725["length"]]=_0x200cc6;return _0x2ba725;},_0x40485b(_0x332d56);};return function(_0x2d0d88){const _0x4fbc9f=_0x2df000;if(_0x1c3c71["LynhB"](_0x1c3c71["qBjFZ"],"ChbgJ")){const _0xe4ab1a=_0x1c3c71["EpACO"]["split"]('|');let _0x4f03d1=0x0;while(!![]){switch(_0xe4ab1a[_0x4f03d1++]){case'0':return _0x5114f9;case'1':_0x1c3c71["QIZWZ"](__setModuleDefault,_0x5114f9,_0x2d0d88);continue;case'2':if(_0x2d0d88!=null){for(var _0x2719f1=_0x40485b(_0x2d0d88),_0x391d88=0x0;_0x1c3c71['cedxp'](_0x391d88,_0x2719f1['length']);_0x391d88++)if(_0x1c3c71["KJmyh"](_0x2719f1[_0x391d88],'default'))_0x1c3c71["Otlxd"](__createBinding,_0x5114f9,_0x2d0d88,_0x2719f1[_0x391d88]);}continue;case'3':var _0x5114f9={};continue;case'4':if(_0x2d0d88&&_0x2d0d88['__esModule'])return _0x2d0d88;continue;}break;}}else _0x1c3c71['lTDeF'](_0x3b93cb,_0x285669)&&(_0x1b3ce4=_0x4f8670,_0x2bfedd["forEach"](_0x1988cb=>_0x1988cb(_0x4056de)));};}());Object['defineProperty'](exports,"__esModule",{'value':!![]}),exports["getApiUrl"]=getApiUrl,exports["getOnlineStatus"]=getOnlineStatus,exports['onOnlineStatusChange']=onOnlineStatusChange,exports['verifyKey']=verifyKey,exports["switchAccount"]=switchAccount,exports['getProxyConfig']=getProxyConfig,exports["updateProxyConfig"]=updateProxyConfig,exports["getSeamlessStatus"]=getSeamlessStatus,exports["getUserSwitchStatus"]=getUserSwitchStatus,exports["getSeamlessConfig"]=getSeamlessConfig,exports["updateSeamlessConfig"]=updateSeamlessConfig,exports["injectSeamless"]=injectSeamless,exports['restoreSeamless']=restoreSeamless,exports["getSeamlessAccounts"]=getSeamlessAccounts,exports["syncSeamlessAccounts"]=syncSeamlessAccounts,exports["getSeamlessToken"]=getSeamlessToken,exports['switchSeamlessToken']=switchSeamlessToken,exports["getLatestVersion"]=getLatestVersion;const vscode=__importStar(require("vscode")),DEFAULT_API_URL="http://111.170.7.59:5000",REQUEST_TIMEOUT=0x3a98;let isOnline=!![],onlineStatusCallbacks=[];function getApiUrl(){const _0x517f75=_0x1ede40,_0x1ef38a={'sKqFt':'cursorpro'},_0x4896a2=vscode["workspace"]['getConfiguration'](_0x1ef38a["sKqFt"]);return _0x4896a2['get']("apiUrl")||DEFAULT_API_URL;}function getOnlineStatus(){return isOnline;}function onOnlineStatusChange(_0x5437a2){const _0x4c36cf=_0x1ede40;return onlineStatusCallbacks["push"](_0x5437a2),()=>{const _0x1977a2=_0x4c36cf;onlineStatusCallbacks=onlineStatusCallbacks["filter"](_0x5f2c05=>_0x5f2c05!==_0x5437a2);};}function setOnlineStatus(_0x85a407){const _0x5afdbb=_0x1ede40,_0x198bf3={'LiLdl':function(_0x41d862,_0x4b32ad){return _0x41d862!==_0x4b32ad;}};_0x198bf3["LiLdl"](isOnline,_0x85a407)&&(isOnline=_0x85a407,onlineStatusCallbacks["forEach"](_0x3d7640=>_0x3d7640(_0x85a407)));}async function fetchWithTimeout(_0x17ebeb,_0x493671,_0x52d2e1){const _0x507ce6=_0x1ede40,_0xe51b9b={'MXvym':function(_0x537a9a,_0x5e5823){return _0x537a9a(_0x5e5823);}},_0x1b91f1=new AbortController(),_0x2dacf7=setTimeout(()=>_0x1b91f1["abort"](),_0x52d2e1);try{const _0x21e977=await fetch(_0x17ebeb,{..._0x493671,'signal':_0x1b91f1['signal']});return _0xe51b9b["MXvym"](clearTimeout,_0x2dacf7),_0x21e977;}catch(_0x5d29f1){_0xe51b9b['MXvym'](clearTimeout,_0x2dacf7);throw _0x5d29f1;}}async function request(_0x293593,_0x47ac75='GET',_0x6f6be7){const _0x1b24d0=_0x1ede40,_0xad9ae1={'BNHsr':function(_0x10bf01,_0x16f1c2){return _0x10bf01(_0x16f1c2);},'vWrbX':function(_0x1c8834,_0xdd25eb){return _0x1c8834===_0xdd25eb;},'QeGOL':function(_0x565697,_0x1c8232){return _0x565697 in _0x1c8232;},'JTIwx':function(_0x2ab795){return _0x2ab795();},'HSNSw':"application/json",'aJNrt':'TbLeL','hqoir':function(_0x1fa4e8,_0x223d94,_0x3412d5,_0x3d3de1){return _0x1fa4e8(_0x223d94,_0x3412d5,_0x3d3de1);},'UlSjX':function(_0x2577b0,_0x1c619f){return _0x2577b0(_0x1c619f);},'dVHKp':"wwMyU",'ttOtR':"AbortError",'MNJYC':function(_0x57fe62,_0x4f5ad6){return _0x57fe62===_0x4f5ad6;},'vaLQW':"TypeError",'NtsiM':'fetch','qUkdJ':'network','UhPHK':"ECONNREFUSED",'EJlaN':"ENOTFOUND",'ztjks':"ETIMEDOUT",'RnnaP':function(_0x1d9a14,_0x1565b6){return _0x1d9a14(_0x1565b6);}},_0x4879af=''+_0xad9ae1["JTIwx"](getApiUrl)+_0x293593,_0x4dbc6b={'method':_0x47ac75,'headers':{'Content-Type':_0xad9ae1["HSNSw"]}};_0x6f6be7&&(_0x4dbc6b["body"]=JSON["stringify"](_0x6f6be7));try{if(_0xad9ae1['vWrbX']("TbLeL",_0xad9ae1['aJNrt'])){const _0x2625e8=await _0xad9ae1["hqoir"](fetchWithTimeout,_0x4879af,_0x4dbc6b,REQUEST_TIMEOUT),_0x43f5ea=await _0x2625e8["json"]();_0xad9ae1["UlSjX"](setOnlineStatus,!![]);if(!_0x2625e8['ok']&&_0x43f5ea['error']){if(_0xad9ae1["dVHKp"]!==_0xad9ae1["dVHKp"]){_0xad9ae1["BNHsr"](_0x51896e,_0x3d20bc);throw _0x3902c6;}else _0x43f5ea['success']=![],_0x43f5ea['message']=_0x43f5ea['error'];}return _0x43f5ea;}else{if(_0xad9ae1['vWrbX'](_0x50a88d,_0x3c7316))_0xf926c6=_0x44d71d;var _0x229dad=_0x5c9dd8["getOwnPropertyDescriptor"](_0x2683bc,_0x123a83);(!_0x229dad||(_0xad9ae1["QeGOL"]("get",_0x229dad)?!_0x28b288["__esModule"]:_0x229dad["writable"]||_0x229dad["configurable"]))&&(_0x229dad={'enumerable':!![],'get':function(){return _0x115262[_0x437497];}}),_0x2596a6["defineProperty"](_0x4b73ec,_0x1bfdba,_0x229dad);}}catch(_0x8301bb){const _0x2da852=_0x8301bb['name']===_0xad9ae1["ttOtR"]||_0xad9ae1["MNJYC"](_0x8301bb['name'],_0xad9ae1["vaLQW"])||_0x8301bb['message']?.["includes"](_0xad9ae1["NtsiM"])||_0x8301bb["message"]?.["includes"](_0xad9ae1["qUkdJ"])||_0x8301bb["message"]?.["includes"](_0xad9ae1['UhPHK'])||_0x8301bb['message']?.['includes'](_0xad9ae1["EJlaN"])||_0x8301bb['message']?.['includes'](_0xad9ae1["ztjks"]);if(_0x2da852)return _0xad9ae1["RnnaP"](setOnlineStatus,![]),{'success':![],'error':"网络连接失败,请检查网络",'isOffline':!![]};throw _0x8301bb;}}async function verifyKey(_0x5a4ca){const _0x36d9c0=_0x1ede40,_0x5a0926={'ZDjOQ':function(_0x17f546,_0x305330,_0xc0721f,_0x125b9e){return _0x17f546(_0x305330,_0xc0721f,_0x125b9e);},'WqzrL':"/api/verify-key",'obRAG':"POST"};return _0x5a0926["ZDjOQ"](request,_0x5a0926["WqzrL"],_0x5a0926['obRAG'],{'key':_0x5a4ca});};async function switchAccount(_0x577fd6){const _0x15748f=_0x1ede40,_0x38858e={'UZIiJ':function(_0x4be17e,_0x461bfe,_0x37a5d1,_0x2b8616){return _0x4be17e(_0x461bfe,_0x37a5d1,_0x2b8616);},'BFJKe':"/api/switch-account",'mnjoz':"POST"};return _0x38858e["UZIiJ"](request,_0x38858e["BFJKe"],_0x38858e["mnjoz"],{'key':_0x577fd6});}async function getProxyConfig(){const _0x1acc63=_0x1ede40,_0x53f294={'tGYeq':function(_0x295e04,_0x5e6e4d,_0x181a1b){return _0x295e04(_0x5e6e4d,_0x181a1b);},'gOUCa':'/api/proxy-config','qAfDy':"GET"};return _0x53f294["tGYeq"](request,_0x53f294["gOUCa"],_0x53f294["qAfDy"]);}async function updateProxyConfig(_0x5f0bbe,_0x177139){const _0xda86de=_0x1ede40,_0x5cbec3={'yDQrL':function(_0x5e0abb,_0x388d0b,_0x2513f4,_0x495f0d){return _0x5e0abb(_0x388d0b,_0x2513f4,_0x495f0d);}};return _0x5cbec3["yDQrL"](request,"/api/proxy-config","PUT",{'is_enabled':_0x5f0bbe,'proxy_url':_0x177139});}async function getSeamlessStatus(){const _0x42cb20=_0x1ede40,_0x1db932={'FIIzk':function(_0x414e05,_0x20c82d){return _0x414e05(_0x20c82d);}};return _0x1db932["FIIzk"](request,"/api/seamless/status");}async function getUserSwitchStatus(_0x11efc8){const _0x3f99ea=_0x1ede40,_0x494ac5={'MGwRv':function(_0x58ed8f,_0x151655){return _0x58ed8f(_0x151655);}};return _0x494ac5["MGwRv"](request,"/api/seamless/user-status?userKey="+_0x494ac5['MGwRv'](encodeURIComponent,_0x11efc8));}async function getSeamlessConfig(){const _0xeb43df=_0x1ede40,_0x11b858={'DfQJY':function(_0x3ff223,_0x515685){return _0x3ff223(_0x515685);},'WtWjp':'/api/seamless/config'};return _0x11b858["DfQJY"](request,_0x11b858["WtWjp"]);}async function updateSeamlessConfig(_0x4e91f5){const _0xac9b59=_0x1ede40,_0xae283={'eVhRM':function(_0x302e6d,_0x1b29d1,_0xfc2c0f,_0x27bd4c){return _0x302e6d(_0x1b29d1,_0xfc2c0f,_0x27bd4c);},'ksxVc':"/api/seamless/config",'LROFh':"POST"};return _0xae283["eVhRM"](request,_0xae283["ksxVc"],_0xae283["LROFh"],_0x4e91f5);}async function injectSeamless(_0x585c33,_0x5e920e){const _0x15aadd=_0x1ede40,_0x3480b6={'ozfwi':function(_0x496feb,_0x3db5af,_0x41caae,_0x109bfc){return _0x496feb(_0x3db5af,_0x41caae,_0x109bfc);},'qQGdF':"/api/seamless/inject",'edilS':"POST"};return _0x3480b6["ozfwi"](request,_0x3480b6["qQGdF"],_0x3480b6['edilS'],{'api_url':_0x585c33,'user_key':_0x5e920e});}async function restoreSeamless(){const _0x12dfcf=_0x1ede40,_0x1df6e7={'baHAv':function(_0x57c4ec,_0x1d11b1,_0x36cd49){return _0x57c4ec(_0x1d11b1,_0x36cd49);},'sndsx':'/api/seamless/restore','ueshn':"POST"};return _0x1df6e7['baHAv'](request,_0x1df6e7['sndsx'],_0x1df6e7["ueshn"]);}async function getSeamlessAccounts(){const _0x42b4f6=_0x1ede40,_0x4ac511={'LxhXL':function(_0x53c82d,_0x3b3e63){return _0x53c82d(_0x3b3e63);},'MbXwB':'/api/seamless/accounts'};return _0x4ac511["LxhXL"](request,_0x4ac511['MbXwB']);}async function syncSeamlessAccounts(_0x8eab80){const _0x1bebfa=_0x1ede40;return request("/api/seamless/sync-accounts","POST",{'accounts':_0x8eab80});}async function getSeamlessToken(_0x3d9506){const _0x5b4aa0=_0x1ede40,_0x47d5c8={'tWyAu':function(_0x2630d5,_0x8f24b0){return _0x2630d5(_0x8f24b0);}};return request("/api/seamless/get-token?userKey="+_0x47d5c8["tWyAu"](encodeURIComponent,_0x3d9506));}async function switchSeamlessToken(_0x45b49c){const _0x530ea9=_0x1ede40,_0x25fd60={'TTiUq':function(_0x12885e,_0x9ff48a,_0x48600c,_0xfe1be7){return _0x12885e(_0x9ff48a,_0x48600c,_0xfe1be7);},'zZNHr':"/api/seamless/switch-token",'IRCBl':"manual"};return _0x25fd60["TTiUq"](request,_0x25fd60['zZNHr'],"POST",{'mode':_0x25fd60["IRCBl"],'userKey':_0x45b49c});}async function getLatestVersion(){const _0x207d6a=_0x1ede40,_0x3450ac={'GvtLu':"/api/version"};return request(_0x3450ac["GvtLu"]);} |