Spaces:
Paused
Paused
Download server.js from AiBotTeszt/Posei: direct link, hf CLI and curl.
- Browser
- Download file 18.8 kB
-
https://huggingface.co/spaces/AiBotTeszt/Posei/resolve/main/server.js
- Command line
-
hf download hf://spaces/AiBotTeszt/Posei/server.js
-
curl -L -o server.js https://huggingface.co/spaces/AiBotTeszt/Posei/resolve/main/server.js
18.8 kB
| const a0_0x5914bf=a0_0x207c;(function(_0x1b7146,_0x4dd898){const _0x1f466e=a0_0x207c,_0x4fffc6=_0x1b7146();while(!![]){try{const _0xb09554=parseInt(_0x1f466e(0x1e5))/0x1+-parseInt(_0x1f466e(0x1bf))/0x2*(parseInt(_0x1f466e(0x1b6))/0x3)+-parseInt(_0x1f466e(0x190))/0x4+-parseInt(_0x1f466e(0x1dd))/0x5+-parseInt(_0x1f466e(0x187))/0x6*(parseInt(_0x1f466e(0x1b1))/0x7)+parseInt(_0x1f466e(0x1ce))/0x8*(-parseInt(_0x1f466e(0x196))/0x9)+parseInt(_0x1f466e(0x174))/0xa*(parseInt(_0x1f466e(0x1a3))/0xb);if(_0xb09554===_0x4dd898)break;else _0x4fffc6['push'](_0x4fffc6['shift']());}catch(_0x170ccc){_0x4fffc6['push'](_0x4fffc6['shift']());}}}(a0_0x2bec,0xf1e37));import a0_0x290348 from'node:http';import a0_0x369bfe from'node:fs';import a0_0x57249b from'node:path';import a0_0xa56348 from'node:crypto';import{fileURLToPath}from'node:url';import{WebSocket,WebSocketServer}from'ws';import{startTelegram}from'./telegram.js';const dir=a0_0x57249b[a0_0x5914bf(0x188)](fileURLToPath(import.meta.url));try{for(const line of a0_0x369bfe[a0_0x5914bf(0x1be)](a0_0x57249b[a0_0x5914bf(0x1b0)](dir,a0_0x5914bf(0x1e6)),'utf8')[a0_0x5914bf(0x162)](/\r?\n/)){const m=line['match'](/^\s*([A-Z_]+)\s*=\s*(.*?)\s*$/);if(m&&!line[a0_0x5914bf(0x1e2)]()[a0_0x5914bf(0x1aa)]('#')&&process.env[m[1]]===undefined)process.env[m[1]]=m[0x2]['replace'](/^["']|["']$/g,'');}}catch{}const API_URL=new URL(process.env.API_URL||a0_0x5914bf(0x1da)),API_KEY=process.env.API_KEY||'',HF_TOKEN=process.env.HF_TOKEN||'',WS_PATH=process.env.WS_PATH||'/ws',PORT=Number(process.env.DASH_PORT)||0x1f90,HOST=process.env.DASH_HOST||a0_0x5914bf(0x16e),USER=process.env.DASH_USER||'',PASS=process.env.DASH_PASS||'',REQUEST_TIMEOUT_MS=Number(process.env.REQUEST_TIMEOUT_MS)||0x1e848,WAIT_OPEN_MS=0x1f40,CONSUMER=process.env.DASH_CONSUMER||a0_0x5914bf(0x189),upstreamUrl=((()=>{const _0x144d34=a0_0x5914bf,_0x52bdae=new URL(API_URL);return _0x52bdae['protocol']={'http:':_0x144d34(0x1db),'https:':'wss:','ws:':'ws:','wss:':_0x144d34(0x1d8)}[_0x52bdae[_0x144d34(0x1e0)]]||_0x144d34(0x1db),_0x52bdae['pathname']=WS_PATH,_0x52bdae['search']='',_0x52bdae[_0x144d34(0x16d)]='',_0x52bdae;})()),sha=_0x227e3e=>a0_0xa56348[a0_0x5914bf(0x16a)]('sha256')[a0_0x5914bf(0x1c6)](String(_0x227e3e))[a0_0x5914bf(0x1d0)](),safeEq=(_0xd54fa5,_0x108cb4)=>a0_0xa56348['timingSafeEqual'](sha(_0xd54fa5),sha(_0x108cb4)),fail=(_0x21a305,_0x4a9aff)=>({'ok':![],'status':_0x21a305,'error':_0x4a9aff}),up={'ws':null,'state':a0_0x5914bf(0x1e8),'since':Date['now'](),'lastError':'','attempts':0x0,'latencyMs':null,'mongo':null,'lastSeen':0x0,'seq':0x0,'pending':new Map(),'subscribed':new Set(),'waiters':new Set(),'reconnectTimer':null},browsers=new Set(),eventListeners=new Set(),publicStatus=()=>({'event':a0_0x5914bf(0x1cf),'upstream':{'state':up[a0_0x5914bf(0x18d)],'since':up[a0_0x5914bf(0x197)],'lastError':up[a0_0x5914bf(0x181)],'attempts':up[a0_0x5914bf(0x17a)],'latencyMs':up[a0_0x5914bf(0x1a9)],'mongo':up['mongo'],'host':upstreamUrl[a0_0x5914bf(0x17c)]}});function broadcastStatus(){const _0x4e7fb6=a0_0x5914bf,_0xbec2bd=JSON['stringify'](publicStatus());for(const _0x591f81 of browsers)if(_0x591f81[_0x4e7fb6(0x1c7)]===WebSocket['OPEN'])_0x591f81[_0x4e7fb6(0x1ae)](_0xbec2bd);}function setState(_0x4e3a25,_0xb17d){const _0x3f99d0=a0_0x5914bf;up[_0x3f99d0(0x18d)]=_0x4e3a25,up['since']=Date[_0x3f99d0(0x1c3)]();if(_0xb17d!==undefined)up[_0x3f99d0(0x181)]=_0xb17d;if(_0x4e3a25==='open'){for(const _0x1a3164 of[...up[_0x3f99d0(0x15e)]])_0x1a3164();}broadcastStatus();}function failAllPending(_0x4b8cbe,_0x36ee20){const _0x336681=a0_0x5914bf;for(const [_0x1df70d,_0x32d3ca]of up[_0x336681(0x182)]){clearTimeout(_0x32d3ca[_0x336681(0x193)]),_0x32d3ca[_0x336681(0x16b)](fail(_0x4b8cbe,_0x36ee20)),up[_0x336681(0x182)]['delete'](_0x1df70d);}}function scheduleReconnect(){const _0x2fd268=a0_0x5914bf;if(up[_0x2fd268(0x1b2)])return;const _0x41dcb9=Math[_0x2fd268(0x1ca)](0x2710,0x1f4*0x2**Math['min'](up[_0x2fd268(0x17a)],0x5));up[_0x2fd268(0x17a)]+=0x1,up[_0x2fd268(0x1b2)]=setTimeout(()=>{const _0x31ca7f=_0x2fd268;up[_0x31ca7f(0x1b2)]=null,connectUpstream();},_0x41dcb9);}function connectUpstream(){const _0x3fa600=a0_0x5914bf;setState(_0x3fa600(0x1e8));const _0xa3a46b={};if(API_KEY)_0xa3a46b['x-api-key']=API_KEY;if(HF_TOKEN)_0xa3a46b[_0x3fa600(0x1e4)]=_0x3fa600(0x17b)+HF_TOKEN;const _0x183fff=new WebSocket(upstreamUrl,{'headers':_0xa3a46b,'handshakeTimeout':0x3a98,'maxPayload':0x10*0x400*0x400});up['ws']=_0x183fff;let _0x4863b7=![];const _0x19147b=_0xc40cef=>{const _0x36da3a=_0x3fa600;if(_0x4863b7)return;_0x4863b7=!![];if(up['ws']===_0x183fff)up['ws']=null;failAllPending(0x1f6,_0x36da3a(0x1dc)),setState(_0x36da3a(0x165),_0xc40cef||up[_0x36da3a(0x181)]),scheduleReconnect();};_0x183fff['on'](_0x3fa600(0x1a1),(_0x568779,_0x235493)=>{const _0x54e707=_0x3fa600,_0x2a7c6a=_0x235493['statusCode'],_0x5f22be=_0x2a7c6a===0x191?_0x54e707(0x1ea):_0x2a7c6a===0x194?'Bot\x20'+WS_PATH+_0x54e707(0x19c):_0x54e707(0x1ba)+_0x2a7c6a+').';_0x235493['resume'](),_0x568779[_0x54e707(0x1a6)](),_0x19147b(_0x5f22be);}),_0x183fff['on'](_0x3fa600(0x16c),()=>{const _0x121296=_0x3fa600;up['attempts']=0x0,up[_0x121296(0x1d9)]=Date['now'](),setState(_0x121296(0x16c),'');for(const _0x143c44 of up[_0x121296(0x17e)])upstreamRequest('subscribe',{'userId':_0x143c44,'consumer':CONSUMER})[_0x121296(0x1d6)](()=>{});pollBot();}),_0x183fff['on'](_0x3fa600(0x183),_0x38c9de=>{const _0x5f3956=_0x3fa600;up[_0x5f3956(0x1d9)]=Date['now']();let _0x55a059;try{_0x55a059=JSON[_0x5f3956(0x1d2)](_0x38c9de['toString'](_0x5f3956(0x1a0)));}catch{return;}if(_0x55a059[_0x5f3956(0x1e3)]){if(_0x55a059['event']===_0x5f3956(0x19b)){if(_0x55a059['authRequired']&&API_KEY)_0x183fff['send'](JSON[_0x5f3956(0x1e9)]({'id':'auth','action':'auth','params':{'apiKey':API_KEY}}));return;}const _0x53c6a0=_0x38c9de[_0x5f3956(0x191)](_0x5f3956(0x1a0));for(const _0x3dd333 of browsers){if(_0x3dd333['readyState']===WebSocket['OPEN']&&_0x3dd333['subs'][_0x5f3956(0x1ed)](_0x55a059[_0x5f3956(0x1cd)]))_0x3dd333[_0x5f3956(0x1ae)](_0x53c6a0);}for(const _0x16c593 of eventListeners){try{_0x16c593(_0x55a059);}catch(_0x3df5f1){console[_0x5f3956(0x1c2)](_0x5f3956(0x1bb),_0x3df5f1);}}return;}if(_0x55a059['id']===_0x5f3956(0x1de)){if(!_0x55a059['ok'])up[_0x5f3956(0x181)]=_0x5f3956(0x1a4);return;}const _0x37a8ef=up[_0x5f3956(0x182)][_0x5f3956(0x1d4)](_0x55a059['id']);if(!_0x37a8ef)return;if(_0x55a059[_0x5f3956(0x166)]){_0x37a8ef[_0x5f3956(0x164)]?.(_0x55a059[_0x5f3956(0x1ee)]);return;}clearTimeout(_0x37a8ef[_0x5f3956(0x193)]),up['pending'][_0x5f3956(0x175)](_0x55a059['id']),_0x37a8ef[_0x5f3956(0x16b)]({'ok':!!_0x55a059['ok'],'status':_0x55a059[_0x5f3956(0x180)],'data':_0x55a059[_0x5f3956(0x1ee)],'error':_0x55a059['error']});}),_0x183fff['on'](_0x3fa600(0x1ef),(_0x36e48b,_0x135361)=>{const _0x54ea72=_0x3fa600,_0xdb6378=_0x135361?.[_0x54ea72(0x191)]();_0x19147b(_0x36e48b===0x1131?_0x54ea72(0x1d3):_0xdb6378||(up['lastError']||_0x54ea72(0x18c)+_0x36e48b+').'));}),_0x183fff['on'](_0x3fa600(0x1c2),_0xb08938=>{const _0x319a9b=_0x3fa600;up['lastError']=_0xb08938[_0x319a9b(0x184)]==='ECONNREFUSED'?'Bot\x27a\x20ulaşılamıyor\x20('+upstreamUrl[_0x319a9b(0x17c)]+_0x319a9b(0x1c1):_0xb08938[_0x319a9b(0x183)];if(_0x183fff[_0x319a9b(0x1c7)]!==WebSocket[_0x319a9b(0x170)])_0x19147b(up[_0x319a9b(0x181)]);});}function a0_0x2bec(){const _0x492276=['split','no-store','onProgress','closed','progress','401\x20Unauthorized','default-src\x20\x27none\x27;\x20script-src\x20\x27unsafe-inline\x27;\x20style-src\x20\x27unsafe-inline\x27;\x20connect-src\x20\x27self\x27\x20ws:\x20wss:;\x20base-uri\x20\x27none\x27;\x20form-action\x20\x27none\x27','toLowerCase','createHash','resolve','open','hash','127.0.0.1','SIGINT','OPEN','url','stats','unref','8270CFBBSB','delete','slice','write','403\x20Forbidden','mongo','attempts','Bearer\x20','host','http://x','subscribed','Bot\x20(WebSocket):\x20','status','lastError','pending','message','code','headers','Gönderilemedi:\x20','12GrPNoP','dirname','dashboard','writeHead','404\x20Not\x20Found','Bağlantı\x20kapandı\x20(','state','subscribe','Bulunamadı.','4364696lAWZRL','toString','length','timer','isArray','origin','30384RxWeYw','since','connection','warn','from','ws.ready','\x20yolunu\x20bulamadı\x20(404).\x20Adres\x20ya\x20da\x20WS_PATH\x20yanlış\x20olabilir.','Bu\x20eylem\x20panelden\x20kullanılamaz.','Basic\x20','base64','utf8','unexpected-response','notifications/list','79673jymFYh','API_KEY\x20bot\x20tarafından\x20reddedildi.','terminate','destroy','upgrade','kapanıyor','latencyMs','startsWith','Bu\x20eylem\x20kullanılamaz.','handleUpgrade','text/html;\x20charset=utf-8','send','log','join','1619219tCQpJA','reconnectTimer','userId\x20parametresi\x20eksik\x20veya\x20geçersiz.','background','no-referrer','1638057pYjXJL','exit','/index.html','stream','Bot\x20WebSocket\x20yükseltmesini\x20reddetti\x20(HTTP\x20','Olay\x20dinleyicisi\x20hata\x20verdi:','Bot\x27a\x20WebSocket\x20bağlantısı\x20kurulamadı','SIGTERM','readFileSync','6UEDWpo','emit',').\x20Çalışıyor\x20mu?','error','now','command','end','update','readyState','upstream','add','min','true','index.html','userId','4392xtLogI','dash.status','digest','async','parse','Bot\x20kimlik\x20doğrulamayı\x20reddetti\x20(API_KEY\x20yanlış).','get','localhost','catch','string','wss:','lastSeen','http://127.0.0.1:3333','ws:','Bot\x20bağlantısı\x20koptu.\x20İstek\x20işlenmiş\x20olabilir;\x20/send\x20ve\x20/command\x20için\x20aynı\x20requestId\x20ile\x20tekrar\x20deneyebilirsiniz.','3254575CfxpJH','auth','createServer','protocol','subs','trim','event','authorization','697018xoPAHr','.env','consumer','connecting','stringify','Bot\x20401\x20verdi:\x20API_KEY\x20yanlış\x20(özel\x20Hugging\x20Face\x20Space\x20ise\x20HF_TOKEN\x20da\x20gerekir).','0.0.0.0','Geçersiz\x20JSON.','has','data','close','public','ping','includes','waiters','stop','pathname','DENY'];a0_0x2bec=function(){return _0x492276;};return a0_0x2bec();}function waitOpen(_0xd1592f){const _0x335851=a0_0x5914bf;if(up[_0x335851(0x18d)]===_0x335851(0x16c))return Promise[_0x335851(0x16b)](!![]);return new Promise(_0x3e8e82=>{const _0x59d4f7=()=>{const _0x36664c=a0_0x207c;clearTimeout(_0x58f1d1),up[_0x36664c(0x15e)][_0x36664c(0x175)](_0x59d4f7),_0x3e8e82(up[_0x36664c(0x18d)]===_0x36664c(0x16c));},_0x58f1d1=setTimeout(_0x59d4f7,_0xd1592f);up['waiters']['add'](_0x59d4f7);});}async function upstreamRequest(_0x4dd602,_0x5c5e6b={},_0x10e2eb=REQUEST_TIMEOUT_MS,_0x4579df){const _0x20004d=a0_0x5914bf;if(!await waitOpen(WAIT_OPEN_MS))return fail(0x1f7,_0x20004d(0x1bc)+(up[_0x20004d(0x181)]?':\x20'+up[_0x20004d(0x181)]:'.'));return new Promise(_0xdf9385=>{const _0x599095=_0x20004d,_0x4bed78='d'+ ++up['seq'],_0x370700=setTimeout(()=>{const _0x191ad3=a0_0x207c;up['pending'][_0x191ad3(0x175)](_0x4bed78),_0xdf9385(fail(0x1f8,'Bot\x20cevap\x20vermedi\x20(zaman\x20aşımı).'));},_0x10e2eb);up[_0x599095(0x182)]['set'](_0x4bed78,{'resolve':_0xdf9385,'timer':_0x370700,'onProgress':_0x4579df});try{up['ws'][_0x599095(0x1ae)](JSON['stringify']({'id':_0x4bed78,'action':_0x4dd602,'params':_0x5c5e6b,..._0x4579df?{'stream':!![]}:{}}));}catch(_0x20cb7b){clearTimeout(_0x370700),up[_0x599095(0x182)]['delete'](_0x4bed78),_0xdf9385(fail(0x1f6,_0x599095(0x186)+_0x20cb7b['message']));}});}function prepareParams(_0x5dda86,_0x3ba79c){const _0xe77bb4=a0_0x5914bf,_0x1c1826=_0x3ba79c&&typeof _0x3ba79c==='object'&&!Array[_0xe77bb4(0x194)](_0x3ba79c)?{..._0x3ba79c}:{};if(_0x5dda86===_0xe77bb4(0x1a2)||_0x5dda86==='notifications/ack')_0x1c1826[_0xe77bb4(0x1e7)]=CONSUMER;if(_0x5dda86===_0xe77bb4(0x1c4)&&[_0xe77bb4(0x1cb),'1'][_0xe77bb4(0x15d)](String(_0x1c1826[_0xe77bb4(0x1d1)]??_0x1c1826[_0xe77bb4(0x1b4)]??'')[_0xe77bb4(0x169)]()))_0x1c1826[_0xe77bb4(0x1e7)]=CONSUMER;return _0x1c1826;}async function subscribeUser(_0x46ffb0){const _0x2abb41=a0_0x5914bf,_0x1748f8=await upstreamRequest(_0x2abb41(0x18e),{'userId':_0x46ffb0,'consumer':CONSUMER},0x3a98);if(_0x1748f8['ok']||_0x1748f8['status']===0x1f7)up['subscribed'][_0x2abb41(0x1c9)](_0x46ffb0);return _0x1748f8;}async function pollBot(){const _0x5a669a=a0_0x5914bf;if(up['state']!==_0x5a669a(0x16c))return;const _0x440ea6=Date[_0x5a669a(0x1c3)](),_0x3527ef=await upstreamRequest(_0x5a669a(0x15c),{},0x2710);if(!_0x3527ef['ok'])return;up[_0x5a669a(0x1a9)]=Date[_0x5a669a(0x1c3)]()-_0x440ea6;const _0x291cfd=await upstreamRequest(_0x5a669a(0x172),{},0x4e20);if(_0x291cfd['ok'])up[_0x5a669a(0x179)]=_0x291cfd['data']?.[_0x5a669a(0x179)]??null;broadcastStatus();}setInterval(pollBot,0x3a98)['unref'](),setInterval(()=>{const _0x3c9a55=a0_0x5914bf;if(up[_0x3c9a55(0x18d)]===_0x3c9a55(0x16c)&&Date['now']()-up[_0x3c9a55(0x1d9)]>0x13880)try{up['ws']?.[_0x3c9a55(0x1a5)]();}catch{}},0x2710)[a0_0x5914bf(0x173)]();function authorized(_0x3fd116){const _0x482591=a0_0x5914bf;if(!USER&&!PASS)return!![];const _0xce1f7d=_0x3fd116['headers'][_0x482591(0x1e4)]||'';if(!_0xce1f7d[_0x482591(0x1aa)](_0x482591(0x19e)))return![];const [_0x1ec31f,..._0x23bfce]=Buffer[_0x482591(0x19a)](_0xce1f7d[_0x482591(0x176)](0x6),_0x482591(0x19f))[_0x482591(0x191)]()[_0x482591(0x162)](':');return safeEq(_0x1ec31f,USER)&&safeEq(_0x23bfce['join'](':'),PASS);}const uiWss=new WebSocketServer({'noServer':!![],'maxPayload':0x400*0x400}),BLOCKED=new Set([a0_0x5914bf(0x1de)]);uiWss['on']('connection',_0xfec68c=>{const _0x481157=a0_0x5914bf;_0xfec68c[_0x481157(0x1e1)]=new Set(),browsers['add'](_0xfec68c),_0xfec68c[_0x481157(0x1ae)](JSON[_0x481157(0x1e9)](publicStatus())),_0xfec68c['on'](_0x481157(0x1ef),()=>browsers[_0x481157(0x175)](_0xfec68c)),_0xfec68c['on'](_0x481157(0x1c2),()=>{}),_0xfec68c['on']('message',async(_0xdb352f,_0xa8cc61)=>{const _0x553e46=_0x481157,_0x2384b0=(_0x253973,_0x2d777b)=>{const _0x4ec1b2=a0_0x207c;if(_0xfec68c[_0x4ec1b2(0x1c7)]===WebSocket['OPEN'])_0xfec68c[_0x4ec1b2(0x1ae)](JSON[_0x4ec1b2(0x1e9)]({'id':_0x253973,..._0x2d777b}));};if(_0xa8cc61)return;let _0x3ee6f4;try{_0x3ee6f4=JSON[_0x553e46(0x1d2)](_0xdb352f[_0x553e46(0x191)](_0x553e46(0x1a0)));}catch{return _0x2384b0(undefined,fail(0x190,_0x553e46(0x1ec)));}const {id:_0x4fae2b,action:_0x387ca6,params:_0x41801f}=_0x3ee6f4||{};if(typeof _0x387ca6!=='string'||!_0x387ca6)return _0x2384b0(_0x4fae2b,fail(0x190,'action\x20gerekli.'));if(BLOCKED[_0x553e46(0x1ed)](_0x387ca6))return _0x2384b0(_0x4fae2b,fail(0x193,_0x553e46(0x19d)));if(_0x387ca6==='ping')return _0x2384b0(_0x4fae2b,{'ok':!![],'status':0xc8,'data':{'pong':Date['now']()}});if(_0x387ca6==='subscribe'||_0x387ca6==='unsubscribe'){const _0xb01245=typeof _0x41801f?.[_0x553e46(0x1cd)]===_0x553e46(0x1d7)?_0x41801f[_0x553e46(0x1cd)][_0x553e46(0x1e2)]():'';if(!_0xb01245||_0xb01245[_0x553e46(0x192)]>0x80)return _0x2384b0(_0x4fae2b,fail(0x190,_0x553e46(0x1b3)));if(_0x387ca6==='unsubscribe')return _0xfec68c[_0x553e46(0x1e1)][_0x553e46(0x175)](_0xb01245),_0x2384b0(_0x4fae2b,{'ok':!![],'status':0xc8,'data':{'success':!![]}});_0xfec68c[_0x553e46(0x1e1)]['add'](_0xb01245);const _0x1dcffd=await subscribeUser(_0xb01245);if(!(_0x1dcffd['ok']||_0x1dcffd[_0x553e46(0x180)]===0x1f7))return _0x2384b0(_0x4fae2b,_0x1dcffd);return _0x2384b0(_0x4fae2b,{'ok':!![],'status':0xc8,'data':{'success':!![],'userId':_0xb01245}});}const _0x45ef3a=_0x3ee6f4[_0x553e46(0x1b9)]===!![]?_0x13d6e0=>_0x2384b0(_0x4fae2b,{'progress':!![],'data':_0x13d6e0}):undefined,_0x3f944b=prepareParams(_0x387ca6,_0x41801f);_0x2384b0(_0x4fae2b,await upstreamRequest(_0x387ca6,_0x3f944b,REQUEST_TIMEOUT_MS,_0x45ef3a));});});const pageFile=a0_0x57249b[a0_0x5914bf(0x1b0)](dir,a0_0x5914bf(0x1f0),a0_0x5914bf(0x1cc)),server=a0_0x290348[a0_0x5914bf(0x1df)]((_0x36bd67,_0x1f1378)=>{const _0x599381=a0_0x5914bf;if(!authorized(_0x36bd67))return _0x1f1378[_0x599381(0x18a)](0x191,{'www-authenticate':'Basic\x20realm=\x22Bot\x20Dashboard\x22,\x20charset=\x22UTF-8\x22'}),_0x1f1378['end']('Giriş\x20gerekli.');const {pathname:_0x40830f}=new URL(_0x36bd67['url'],_0x599381(0x17d));if(_0x40830f==='/'||_0x40830f===_0x599381(0x1b8))return _0x1f1378[_0x599381(0x18a)](0xc8,{'content-type':_0x599381(0x1ad),'cache-control':_0x599381(0x163),'x-frame-options':_0x599381(0x161),'x-content-type-options':'nosniff','referrer-policy':_0x599381(0x1b5),'content-security-policy':_0x599381(0x168)}),_0x1f1378['end'](a0_0x369bfe[_0x599381(0x1be)](pageFile));_0x1f1378[_0x599381(0x18a)](0x194,{'content-type':'text/plain;\x20charset=utf-8'}),_0x1f1378[_0x599381(0x1c5)](_0x599381(0x18f));});server['on'](a0_0x5914bf(0x1a7),(_0x465ab1,_0x1b2129,_0x566211)=>{const _0x666446=a0_0x5914bf,_0x54d1bb=_0x458a7a=>{const _0x18398a=a0_0x207c;_0x1b2129[_0x18398a(0x177)]('HTTP/1.1\x20'+_0x458a7a+'\x0d\x0aConnection:\x20close\x0d\x0a\x0d\x0a'),_0x1b2129[_0x18398a(0x1a6)]();};let _0x49d5b4;try{_0x49d5b4=new URL(_0x465ab1[_0x666446(0x171)],'http://x')['pathname'];}catch{return _0x1b2129['destroy']();}if(_0x49d5b4!=='/ui')return _0x54d1bb(_0x666446(0x18b));if(!authorized(_0x465ab1))return _0x54d1bb(_0x666446(0x167));const _0x3bf62b=_0x465ab1[_0x666446(0x185)][_0x666446(0x195)];if(_0x3bf62b){let _0x5027ac=![];try{_0x5027ac=new URL(_0x3bf62b)[_0x666446(0x17c)]===_0x465ab1[_0x666446(0x185)][_0x666446(0x17c)];}catch{}if(!_0x5027ac)return _0x54d1bb(_0x666446(0x178));}uiWss[_0x666446(0x1ac)](_0x465ab1,_0x1b2129,_0x566211,_0x3880a1=>uiWss[_0x666446(0x1c0)](_0x666446(0x198),_0x3880a1,_0x465ab1));}),server['listen'](PORT,HOST,()=>{const _0x5d7aca=a0_0x5914bf;console[_0x5d7aca(0x1af)]('Dashboard:\x20http://'+(HOST===_0x5d7aca(0x1eb)?_0x5d7aca(0x1d5):HOST)+':'+PORT),console[_0x5d7aca(0x1af)](_0x5d7aca(0x17f)+upstreamUrl[_0x5d7aca(0x195)]+upstreamUrl[_0x5d7aca(0x160)]),HOST!=='127.0.0.1'&&HOST!==_0x5d7aca(0x1d5)&&!(USER&&PASS)&&console[_0x5d7aca(0x199)]('UYARI:\x20Dashboard\x20ağa\x20açık\x20ve\x20parolasız.\x20DASH_USER/DASH_PASS\x20tanımlayın.');}),connectUpstream();const telegram=startTelegram({'dir':dir,'consumer':CONSUMER,'call':(_0x226cee,_0x151da8,_0x377ba8={})=>{const _0x317189=a0_0x5914bf;if(BLOCKED['has'](_0x226cee))return Promise[_0x317189(0x16b)](fail(0x193,_0x317189(0x1ab)));return upstreamRequest(_0x226cee,prepareParams(_0x226cee,_0x151da8),_0x377ba8['timeoutMs']||REQUEST_TIMEOUT_MS,_0x377ba8[_0x317189(0x164)]);},'subscribe':subscribeUser,'onEvent':_0x32699c=>{const _0x472929=a0_0x5914bf;return eventListeners[_0x472929(0x1c9)](_0x32699c),()=>eventListeners['delete'](_0x32699c);},'status':()=>publicStatus()[a0_0x5914bf(0x1c8)]});function shutdown(){const _0x26984e=a0_0x5914bf;try{telegram?.[_0x26984e(0x15f)]();}catch{}for(const _0xce81d0 of browsers)_0xce81d0['close'](0x3e9,_0x26984e(0x1a8));try{up['ws']?.[_0x26984e(0x1ef)](0x3e9);}catch{}setTimeout(()=>process[_0x26984e(0x1b7)](0x0),0x12c)[_0x26984e(0x173)]();}function a0_0x207c(_0x44b6e8,_0x5f450a){_0x44b6e8=_0x44b6e8-0x15c;const _0x2beca6=a0_0x2bec();let _0x207ca6=_0x2beca6[_0x44b6e8];return _0x207ca6;}process['on'](a0_0x5914bf(0x16f),shutdown),process['on'](a0_0x5914bf(0x1bd),shutdown); |