forked from atralice/Curso.Prep.Henry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit.js
1 lines (1 loc) · 4.28 KB
/
submit.js
1
const _0x3af6=['git\x20add\x20.','log','then','Usuario\x20de\x20github:','04-JS-III','Falló\x20el\x20submit\x0a','toLowerCase','hide','child_process','Homework\x20sin\x20tests\x20\x0a','Ejecutando\x20tests...\x0a','08-HTML','numPassedTests','/homework/tests/result.json','05-JS-IV','\x20master','Submit\x20OK\x0a','now','numTotalTests','trim','includes','.\x20\x0a','argv','unlinkSync','node-fetch','readFileSync','pop','03-JS-II','statusText','\x20de\x20','prompt-sync','error:\x20','Password:','Prep\x20-\x20','split','RESULTADO:\x20','status','application/json','npm\x20run\x20test','Parámetro\x20inválido\x20revise\x20que\x20sea\x20un\x20número\x20de\x20homework\x20válido','El\x20archivo\x20result.json\x20no\x20existe\x20por\x20lo\x20que\x20se\x20creará\x20uno\x20nuevo','git\x20config\x20--get\x20remote.origin.url','01-Git','exit','stderr:\x20','git\x20push\x20https://','07-JS-VI','length','error','06-JS-V','catch','https://proxy.soyhenry.com:3000/submit'];(function(_0x29c838,_0x3af6ec){const _0x4a5b52=function(_0x31f739){while(--_0x31f739){_0x29c838['push'](_0x29c838['shift']());}};_0x4a5b52(++_0x3af6ec);}(_0x3af6,0xe8));const _0x4a5b=function(_0x29c838,_0x3af6ec){_0x29c838=_0x29c838-0x0;let _0x4a5b52=_0x3af6[_0x29c838];return _0x4a5b52;};const _0x4cfbc1=_0x4a5b,{exec}=require(_0x4cfbc1('0x24')),fetch=require(_0x4cfbc1('0x0'));var prompt=require(_0x4cfbc1('0x6'))();const fs=require('fs');function ejecutar(_0x31f739){return new Promise((_0x803308,_0x1ad43e)=>{exec(_0x31f739,(_0x4d1f0d,_0x54955e,_0xb9193a)=>{const _0x3d2531=_0x4a5b;if(_0x4d1f0d)return _0x1ad43e(_0x3d2531('0x7')+_0x4d1f0d['message']);if(_0xb9193a)return _0x803308(_0x3d2531('0x14')+_0xb9193a);_0x803308(_0x54955e);});});}async function submit(_0x31d634,_0x3d1e81){const _0x4a7159=_0x4cfbc1;console[_0x4a7159('0x1d')](_0x4a7159('0xb')+_0x31d634+_0x4a7159('0x5')+_0x3d1e81+_0x4a7159('0x31'));const _0x18d527=prompt('Estas\x20seguro\x20que\x20deseas\x20submitear\x20este\x20resultado?\x20(S/n)\x20')['toLowerCase']();if(_0x18d527!=='s')return process[_0x4a7159('0x13')](0x0);const _0x5660c7=prompt(_0x4a7159('0x1f'))[_0x4a7159('0x22')](),_0x52dd76=prompt[_0x4a7159('0x23')](_0x4a7159('0x8'));let _0x4b0a6c;try{const _0x562535=await ejecutar(_0x4a7159('0x11'));_0x4b0a6c=_0x562535[_0x4a7159('0x2f')]()[_0x4a7159('0xa')]('/')[_0x4a7159('0x2')](),await ejecutar(_0x4a7159('0x1c')),await ejecutar('git\x20commit\x20-m\x20\x22CP\x20commiteado\x20por\x20'+_0x5660c7+'\x20a\x20las\x20'+Date[_0x4a7159('0x2d')]()+'\x22'),await ejecutar(_0x4a7159('0x15')+_0x5660c7+':'+_0x52dd76+'@github.com/'+_0x5660c7+'/'+_0x4b0a6c+_0x4a7159('0x2b'));}catch(_0x4dec01){return console[_0x4a7159('0x18')](_0x4dec01),process[_0x4a7159('0x13')](0x0);}fetch(_0x4a7159('0x1b'),{'method':'post','headers':{'Content-Type':_0x4a7159('0xd')},'body':JSON['stringify']({'github':_0x5660c7,'passed':_0x31d634,'total':_0x3d1e81,'repo':_0x4a7159('0x9')+hwPaths[hwNumber-0x1]})})[_0x4a7159('0x1e')](function(_0x41611b){const _0x263fac=_0x4a7159;if(_0x41611b[_0x263fac('0xc')]!==0xc8)throw new Error(_0x41611b[_0x263fac('0x4')]);return console[_0x263fac('0x1d')](_0x263fac('0x2c')),process['exit'](0x0);})[_0x4a7159('0x1a')](function(_0x4a2ff2){const _0x107c2b=_0x4a7159;return console[_0x107c2b('0x18')](_0x4a2ff2),console[_0x107c2b('0x1d')](_0x107c2b('0x21')),process[_0x107c2b('0x13')](0x1);});}var args=process[_0x4cfbc1('0x32')]['slice'](0x2);if(args[_0x4cfbc1('0x17')]!=0x1||!['2','3','4','5','6','7','8','9'][_0x4cfbc1('0x30')](args[0x0]))return console[_0x4cfbc1('0x1d')](_0x4cfbc1('0xf')),process[_0x4cfbc1('0x13')](0x0);var hwNumber=args[0x0];const hwPaths=[_0x4cfbc1('0x12'),'02-JS-I',_0x4cfbc1('0x3'),_0x4cfbc1('0x20'),_0x4cfbc1('0x2a'),_0x4cfbc1('0x19'),_0x4cfbc1('0x16'),_0x4cfbc1('0x27'),'09-CSS-Positioning'],resultFile=__dirname+'/'+hwPaths[hwNumber-0x1]+_0x4cfbc1('0x29');try{fs[_0x4cfbc1('0x33')](resultFile);}catch(_0xf5451d){console[_0x4cfbc1('0x1d')](_0x4cfbc1('0x10'));}hwNumber==='8'||hwNumber==='9'?(console[_0x4cfbc1('0x1d')](_0x4cfbc1('0x25')),submit(0x0,0x0)):(console[_0x4cfbc1('0x1d')](_0x4cfbc1('0x26')),exec(_0x4cfbc1('0xe')+hwNumber,async(_0x36ccc3,_0x1706cf,_0x4d4626)=>{const _0x526756=_0x4cfbc1;let _0x2b4b9f=fs[_0x526756('0x1')](resultFile),_0x42cad3=JSON['parse'](_0x2b4b9f);const _0x2abb71=_0x42cad3[_0x526756('0x28')],_0x1e1fe8=_0x42cad3[_0x526756('0x2e')];submit(_0x2abb71,_0x1e1fe8);}));