diff --git a/epic-games.js b/epic-games.js index 735b101..70a379d 100644 --- a/epic-games.js +++ b/epic-games.js @@ -14,7 +14,7 @@ const db = await jsonDb('epic-games.json'); db.data ||= {}; // https://www.nopecha.com extension source from https://github.com/NopeCHA/NopeCHA/releases/tag/0.1.16 -const ext = path.resolve('nopecha'); // used in Chromium, currently not needed in Firefox +// const ext = path.resolve('nopecha'); // used in Chromium, currently not needed in Firefox // https://playwright.dev/docs/auth#multi-factor-authentication const context = await firefox.launchPersistentContext(dirs.browser, { @@ -153,7 +153,8 @@ try { const captcha = iframe.locator('#h_captcha_challenge_checkout_free_prod iframe'); captcha.waitFor().then(async () => { // don't await, since element may not be shown - console.info(' Got hcaptcha challenge! NopeCHA extension will likely solve it.') + // console.info(' Got hcaptcha challenge! NopeCHA extension will likely solve it.') + console.error(' Got hcaptcha challenge! Lost trust due to too many login attempts? You can solve the captcha in the browser or get a new IP address.') // await page.waitForTimeout(2000); // const p = path.resolve(dirs.screenshots, 'epic-games', 'captcha', `${filenamify(datetime())}.png`); // await captcha.screenshot({ path: p }); @@ -167,7 +168,8 @@ try { context.setDefaultTimeout(cfg.timeout); } catch (e) { console.log(e); - console.error(' Failed to claim! Try again if NopeCHA timed out. Click the extension to see if you ran out of credits (refill after 24h). To avoid captchas try to get a new IP or set a cookie from https://www.hcaptcha.com/accessibility'); + // console.error(' Failed to claim! Try again if NopeCHA timed out. Click the extension to see if you ran out of credits (refill after 24h). To avoid captchas try to get a new IP or set a cookie from https://www.hcaptcha.com/accessibility'); + console.error(' Failed to claim! To avoid captchas try to get a new IP address.'); const p = path.resolve(dirs.screenshots, 'epic-games', 'failed', `${game_id}_${filenamify(datetime())}.png`); await page.screenshot({ path: p, fullPage: true }); db.data[user][game_id].status = 'failed'; diff --git a/nopecha/background.js b/nopecha/background.js deleted file mode 100644 index df00fce..0000000 --- a/nopecha/background.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{function a(t){return JSON.parse(JSON.stringify(t))}class s{static cache={};static async set({tab_id:t,data:{name:a,value:e,tab_specific:c}}){return c&&(a=t+"_"+a),s.cache[a]=e,s.cache[a]}static async get({tab_id:t,data:{name:a,tab_specific:e}}){return e&&(a=t+"_"+a),s.cache[a]}static async remove({tab_id:t,data:{name:a,tab_specific:e}}){e&&(a=t+"_"+a);e=s.cache[a];return delete s.cache[a],e}static async append({tab_id:t,data:{name:a,value:e,tab_specific:c}}){return(a=c?t+"_"+a:a)in s.cache||(s.cache[a]=[]),s.cache[a].push(e),s.cache[a]}static async empty({tab_id:t,data:{name:a,tab_specific:e}}){e&&(a=t+"_"+a);e=s.cache[a];return s.cache[a]=[],e}static async inc({tab_id:t,data:{name:a,tab_specific:e}}){return(a=e?t+"_"+a:a)in s.cache||(s.cache[a]=0),s.cache[a]++,s.cache[a]}static async dec({tab_id:t,data:{name:a,tab_specific:e}}){return(a=e?t+"_"+a:a)in s.cache||(s.cache[a]=0),s.cache[a]--,s.cache[a]}static async zero({tab_id:t,data:{name:a,tab_specific:e}}){return e&&(a=t+"_"+a),s.cache[a]=0,s.cache[a]}}class n{static reloads={};static _reload({tab_id:a}){return new Promise(t=>chrome.tabs.reload(a,{bypassCache:!0},t))}static async reload({tab_id:t,data:{delay:a,overwrite:e}={delay:0,overwrite:!0}}){a=parseInt(a);let c=n.reloads[t]?.delay-(Date.now()-n.reloads[t]?.start);return c=isNaN(c)||c<0?0:c,!!(e||0==c||a<=c)&&(clearTimeout(n.reloads[t]?.timer),n.reloads[t]={delay:a,start:Date.now(),timer:setTimeout(()=>n._reload({tab_id:t}),a)},!0)}static close({tab_id:a}){return new Promise(t=>chrome.tabs.remove(a,t))}static async open({data:{url:t}}){chrome.tabs.create({url:t})}static info({tab_id:t}){return new Promise(a=>{try{chrome.tabs.get(t,t=>a(t))}catch(t){a(!1)}})}}class e{static DEFAULT={version:2,hcaptcha_auto_solve:!0,hcaptcha_solve_delay:3e3,hcaptcha_auto_open:!0,hcaptcha_open_delay:1e3,recaptcha_auto_solve:!0,recaptcha_solve_delay:1e3,recaptcha_auto_open:!0,recaptcha_open_delay:1e3,recaptcha_solve_method:"image",debug:!1};static data={};static _save(){return new Promise(t=>chrome.storage.sync.set({settings:e.data},t))}static load(){return new Promise(a=>{chrome.storage.sync.get(["settings"],async({settings:t})=>{t?(e.data=t,e.data.version!==e.DEFAULT.version&&await e.reset()):await e.reset(),a()})})}static async get(){return e.data}static async set({data:{id:t,value:a}}){e.data[t]=a,await e._save()}static async reset(){e.data=a(e.DEFAULT);var t=chrome.runtime.getManifest();t.key&&(e.data.key=t.key),await e._save()}}class r{static inject({tab_id:t,data:{func:a,args:e}}){const c={target:{tabId:t,allFrames:!0},world:"MAIN",injectImmediately:!0,func:a,args:e};return new Promise(t=>chrome.scripting.executeScript(c,t))}}class t{static async reset({tab_id:t}){return await r.inject({tab_id:t,data:{func:function(){try{window.grecaptcha?.reset()}catch{}},args:[]}}),!0}static fetch({tab_id:t}){return new Promise(async a=>{const e="recaptcha_response",c=(await r.inject({tab_id:t,data:{func:function(t){window.grecaptcha&&window.postMessage({method:"set_cache",data:{name:t,value:window.grecaptcha.getResponse()}})},args:[e]}}),setInterval(async()=>{var t=await s.get({data:{name:e}});if(t)return clearInterval(c),await s.remove({data:{name:e}}),a(t)},1e3))})}}class i{static STATUS_URL="https://api.nopecha.com/status?v="+chrome.runtime.getManifest().version;static STATUS_CHECK_INTERVAL=1e4;static status="Online";static checking_status=!1;static async run_status_check(){return setInterval(()=>{i.check_status()},i.STATUS_CHECK_INTERVAL),!0}static async check_status(){if(i.checking_status)return!1;i.checking_status=!0;let t="Offline";try{const a=await fetch(i.STATUS_URL);t=await a.text()}catch{}return await i.set_status({data:{status:t}}),i.checking_status=!1,t}static async set_status({data:{status:c}}){if(i.status!==c){let t,a=[0,0,0,0],e="";if("Online"===(i.status=c))t={16:"icon/16.png",32:"icon/32.png",48:"icon/48.png",128:"icon/128.png"};else if("Offline"===c)t={16:"icon/16.png",32:"icon/32.png",48:"icon/48.png",128:"icon/128.png"},e="Off",a="#a44";else if("Slow"===c)t={16:"icon/16.png",32:"icon/32.png",48:"icon/48.png",128:"icon/128.png"},e="Slow",a="#f8d66d";else{if("Update Required"!==c)return!1;t={16:"icon/16.png",32:"icon/32.png",48:"icon/48.png",128:"icon/128.png"},e="Update",a="#f8d66d"}return chrome.action.setIcon({path:t}),chrome.action.setBadgeText({text:e}),chrome.action.setBadgeBackgroundColor({color:a}),!0}}static async get_status(){return await i.check_status(),i.status}static async check_plan({data:{key:t}}){if(i.checking_plan)return!1;i.checking_plan=!0;let a={plan:"free",credit:0};try{"undefined"===t&&(t="");const e=await fetch(i.STATUS_URL+"&k="+t);a=JSON.parse(await e.text())}catch{}return i.checking_plan=!1,a}static async get_plan({data:{key:t}}){return await i.check_plan({data:{key:t}})}}const o={set_cache:s.set,get_cache:s.get,remove_cache:s.remove,append_cache:s.append,empty_cache:s.empty,inc_cache:s.inc,dec_cache:s.dec,zero_cache:s.zero,fetch:class{static async fetch({data:{url:t,options:a}}){try{const e=await fetch(t,a);return await e.text()}catch{return null}}}.fetch,reload_tab:n.reload,close_tab:n.close,open_tab:n.open,info_tab:n.info,get_settings:e.get,set_settings:e.set,reset_settings:e.reset,reset_recaptcha:t.reset,fetch_recaptcha:t.fetch,translate:class d{static base_url="https://translate.googleapis.com/translate_a/single";static async translate({data:{from:t,to:a,text:e}}){let c=await fetch(d.base_url+`?client=gtx&sl=${t}&tl=${a}&dt=t&q=`+encodeURI(e)).then(t=>t.json());return c=c&&c[0]&&c[0][0]&&c[0].map(t=>t[0]).join("")}}.translate,get_server_plan:i.get_plan};(async()=>{chrome.declarativeNetRequest.updateDynamicRules({addRules:[{id:1,priority:1,action:{type:"redirect",redirect:{transform:{queryTransform:{addOrReplaceParams:[{key:"hl",value:"en-US"}]}}}},condition:{regexFilter:"^https://[^\\.]*\\.(google|recaptcha)\\.(com|net)/recaptcha",resourceTypes:["sub_frame","script"]}}],removeRuleIds:[1]}),await e.load(),chrome.runtime.onMessage.addListener((t,a,e)=>{const c=!["get_settings","set_settings","set_cache"].includes(t.method);return c,o[t.method]({tab_id:a?.tab?.id,data:t.data}).then(t=>{c;try{e(t)}catch(t){}}),!0})})()})(); \ No newline at end of file diff --git a/nopecha/hcaptcha.js b/nopecha/hcaptcha.js deleted file mode 100644 index e35f1f2..0000000 --- a/nopecha/hcaptcha.js +++ /dev/null @@ -1 +0,0 @@ -(async()=>{class d{static time(){return Date.now||(Date.now=()=>(new Date).getTime()),Date.now()}static sleep(t=1e3){return new Promise(e=>setTimeout(e,t))}static async random_sleep(e,t){t=Math.floor(Math.random()*(t-e)+e);return d.sleep(t)}static pad(e){var t=2-String(e).length+1;return 0{try{chrome.runtime.sendMessage({method:e,data:a},t)}catch(e){t()}})}}class h{static async fetch(e,t){return p.exec("fetch",{url:e,options:t})}}class g{static INFERENCE_URL="https://api.nopecha.com";static MAX_WAIT_POST=60;static MAX_WAIT_GET=60;static ERRORS={UNKNOWN:9,INVALID_REQUEST:10,RATE_LIIMTED:11,BANNED_USER:12,NO_JOB:13,INCOMPLETE_JOB:14,INVALID_KEY:15,NO_CREDIT:16,UPDATE_REQUIRED:17};static async post({captcha_type:e,task:t,image_urls:a,grid:r,key:n}){for(var i=Date.now(),c=await p.exec("info_tab");!(Date.now()-i>1e3*g.MAX_WAIT_POST);){const u={type:e,task:t,image_urls:a,v:chrome.runtime.getManifest().version,key:n,url:c.url};r&&(u.grid=r);var o=await h.fetch(g.INFERENCE_URL,{method:"POST",body:JSON.stringify(u),headers:{"Content-Type":"application/json"}});try{var s=JSON.parse(o);if("error"in s){if(s.error===g.ERRORS.RATE_LIMITED){await d.sleep(2e3);continue}if(s.error===g.ERRORS.INVALID_KEY)break;if(s.error===g.ERRORS.NO_CREDIT)break;break}var l="id"in s?s.id:s.data;return await g.get({job_id:l,key:n})}catch(e){break}}return{job_id:null,clicks:null}}static async get({key:e,job_id:t}){for(var a=Date.now();!(Date.now()-a>1e3*g.MAX_WAIT_GET);){await d.sleep(500);var r=await h.fetch(g.INFERENCE_URL+`?id=${t}&key=`+e);try{var n=JSON.parse(r);if("error"in n){if(n.error!==g.ERRORS.INCOMPLETE_JOB)return{job_id:t,clicks:null};continue}return{job_id:t,clicks:n.data}}catch(e){break}}return{job_id:t,clicks:null}}}function u(e){const t=e?.style.background?.trim()?.match(/(?!^)".*?"/g);return t&&0!==t.length?t[0].replaceAll('"',""):null}async function y(){let e=document.querySelector("h2.prompt-text")?.innerText?.replace(/\s+/g," ")?.trim();if(!e)return null;var t={"0430":"a","0441":"c","0501":"d","0435":"e","04bb":"h","0456":"i","0458":"j","04cf":"l","03bf":"o","043e":"o","0440":"p","0455":"s","0445":"x","0443":"y","0065":"e","0069":"i","30fc":"一","571f":"士"};const a=[];for(const i of e){var r=function(e,t,a){for(;(""+e).length{let s=!1;const l=setInterval(async()=>{if(!s){s=!0;var e=await y();if(e){var t=document.querySelector(".challenge-example > .image > .image"),t=u(t);if(t&&""!==t){var a=document.querySelectorAll(".task-image");if(9!==a.length)s=!1;else{const n=[],i=[];for(const c of a){var r=c.querySelector("div.image");if(!r)return void(s=!1);r=u(r);if(!r||""===r)return void(s=!1);n.push(c),i.push(r)}a=JSON.stringify(i);if(f!==a)return f=a,clearInterval(l),s=!1,o({task:e,task_url:t,cells:n,urls:i});s=!1}}else s=!1}else s=!1}},n)});var n,i=d.time(),c=(await g.post({captcha_type:"hcaptcha",task:t,image_urls:r,key:e.key}))["clicks"];if(c){e=e.hcaptcha_solve_delay-(d.time()-i);0{let a=null,t=!1,r=!1;function n(e,t,r=!1){e&&(r||a!==e)&&(!0===t&&"false"===e.getAttribute("aria-pressed")||!1===t&&"true"===e.getAttribute("aria-pressed"))&&e.click()}document.addEventListener("mousedown",e=>{"false"===e?.target?.parentNode?.getAttribute("aria-pressed")?(t=!0,r=!0):"true"===e?.target?.parentNode?.getAttribute("aria-pressed")&&(t=!0,r=!1),a=e?.target?.parentNode}),document.addEventListener("mouseup",e=>{t=!1,a=null}),document.addEventListener("mousemove",e=>{t&&(a!==e?.target?.parentNode&&null!==a&&n(a,r,!0),n(e?.target?.parentNode,r))})})(); \ No newline at end of file diff --git a/nopecha/hcaptcha_language.js b/nopecha/hcaptcha_language.js deleted file mode 100644 index a757835..0000000 --- a/nopecha/hcaptcha_language.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{let e;function t(){var e=navigator.language.split("-")[0];for(const t of document.querySelectorAll('script[src*=".hcaptcha.com/1/api.js"]')){const r=new URL(t.src);"en"!==(r.searchParams.get("hl")||e)&&(r.searchParams.set("hl","en"),t.src=r.toString())}}e=new MutationObserver(t),setTimeout(()=>{t(),e.observe(document.head,{childList:!0})},0)})(); \ No newline at end of file diff --git a/nopecha/icon/128.png b/nopecha/icon/128.png deleted file mode 100644 index b002b52..0000000 Binary files a/nopecha/icon/128.png and /dev/null differ diff --git a/nopecha/icon/16.png b/nopecha/icon/16.png deleted file mode 100644 index 1dd1d1e..0000000 Binary files a/nopecha/icon/16.png and /dev/null differ diff --git a/nopecha/icon/32.png b/nopecha/icon/32.png deleted file mode 100644 index b485def..0000000 Binary files a/nopecha/icon/32.png and /dev/null differ diff --git a/nopecha/icon/48.png b/nopecha/icon/48.png deleted file mode 100644 index 4269b6d..0000000 Binary files a/nopecha/icon/48.png and /dev/null differ diff --git a/nopecha/manifest.json b/nopecha/manifest.json deleted file mode 100644 index b9e77e9..0000000 --- a/nopecha/manifest.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "NopeCHA: ReCAPTCHA & hCAPTCHA Solver", "action": {"default_title": "NopeCHA: ReCAPTCHA & hCAPTCHA Solver", "default_icon": "icon/16.png", "default_popup": "popup.html"}, "manifest_version": 3, "version": "0.1.16", "description": "Automatically solve CAPTCHAs using AI.", "permissions": ["declarativeNetRequest", "storage", "scripting"], "background": {"service_worker": "background.js"}, "content_scripts": [{"matches": ["*://*.hcaptcha.com/captcha/*"], "js": ["hcaptcha.js"], "all_frames": true, "run_at": "document_end"}, {"matches": ["*://*.hcaptcha.com/captcha/*"], "js": ["hcaptcha_fast.js"], "all_frames": true, "run_at": "document_start"}, {"matches": [""], "js": ["recaptcha.js", "recaptcha_voice.js"], "all_frames": true, "run_at": "document_end"}, {"matches": [""], "js": ["hcaptcha_language.js"], "all_frames": true, "run_at": "document_end"}, {"matches": ["*://*.google.com/recaptcha/*", "*://*.recaptcha.net/recaptcha/*", "*://recaptcha.net/recaptcha/*"], "js": ["recaptcha_fast.js"], "all_frames": true, "run_at": "document_start"}, {"matches": ["*://nopecha.com/setup"], "js": ["setup.js"], "all_frames": true, "run_at": "document_end"}], "host_permissions": [""], "icons": {"16": "icon/16.png", "32": "icon/32.png", "48": "icon/48.png", "128": "icon/128.png"}} \ No newline at end of file diff --git a/nopecha/popup.css b/nopecha/popup.css deleted file mode 100644 index e3f2991..0000000 --- a/nopecha/popup.css +++ /dev/null @@ -1,289 +0,0 @@ -:root { - --input_scale_x: 1; - --input_scale_y: 0.8; -} - -html * { - font-family: monospace, monospaSFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; - font-size: 12px; -} - -html, body { - margin: 0; - padding: 0; - - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.hidden { - display: none !important; - opacity: 0; -} - -.light { - font-size: 0.9em; - opacity: 0.5; -} -.green { - /* color: #8cd47e; */ - color: #1a73e8; -} -.red { - color: #ff6961; -} -.yellow { - color: #ca1; -} -.clickable { - cursor: pointer; - transition: 250ms all; -} -.clickable:hover { - opacity: 0.8; -} - -#main { - padding: 8px 16px; -} - -#footer { - margin-top: 8px; - width: 100%; - text-align: center; - color: #999; - height: 20px; -} - -#manage { - width: 100%; - text-align: center; - background-color: #1a73e8; - color: #fff; - height: 20px; - line-height: 20px; - border-radius: 4px; - border: 1px solid #1a73e8; - padding: 8px; - font-size: 1.2em; - transition: 200ms all; -} -#manage:hover { - color: #1a73e8; - background-color: transparent; -} - -.vspace { - min-height: 8px; -} - -.settings_group { - width: 280px; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - padding: 6px 4px; -} -.settings_group.vertical { - flex-direction: column; -} -.settings_group > .label { - flex-grow: 1; - font-size: 1.2em; - line-height: calc(34px * var(--input_scale_y)); - padding-right: 16px; -} -.settings_group > .value { - font-size: 1.2em; - line-height: calc(34px * var(--input_scale_y)); -} -.settings_group > input { - border-radius: 0; -} -.settings_group > input[type="text"], -.settings_group > input[type="button"], -.settings_group > select { - font-size: 0.9em; - outline: none; - border: 1px solid #999; - width: calc(60px * var(--input_scale_x)); - height: calc(34px * var(--input_scale_y)); -} -.settings_group > input[type="button"] { - background-color: #f0f0f0; - cursor: pointer; - transition: 200ms all; -} -.settings_group > input[type="button"]:hover { - background-color: #fff; -} - -.switch { - position: relative; - display: inline-block; - width: calc(60px * var(--input_scale_x)); - height: calc(34px * var(--input_scale_y)); -} -.switch input { - opacity: 0; - width: 0; - height: 0; -} -.slider { - position: absolute; - cursor: pointer; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: #ccc; - -webkit-transition: .4s; - transition: .4s; -} -.slider:before { - position: absolute; - content: ""; - height: calc(26px * var(--input_scale_y)); - width: calc(26px * var(--input_scale_x)); - left: calc(4px * var(--input_scale_x)); - bottom: calc(4px * var(--input_scale_y)); - background-color: white; - -webkit-transition: .4s; - transition: .4s; -} -input:checked + .slider { - background-color: #2196F3; -} -input:focus + .slider { - box-shadow: 0 0 1px #2196F3; -} -input:checked + .slider:before { - -webkit-transform: translateX(calc(26px * var(--input_scale_x))); - -ms-transform: translateX(calc(26px * var(--input_scale_x))); - transform: translateX(calc(26px * var(--input_scale_x))); -} - -#key { - padding: 4px; - border-radius: 2px; -} - -.loading { - display: inline-block; - position: relative; - width: 40px; - height: 100%; -} -.loading div { - position: absolute; - top: 8px; - width: 6px; - height: 6px; - border-radius: 50%; - background: #777; - animation-timing-function: cubic-bezier(0, 1, 1, 0); -} -.loading div:nth-child(1) { - left: 4px; - animation: loading1 0.6s infinite; -} -.loading div:nth-child(2) { - left: 4px; - animation: loading2 0.6s infinite; -} -.loading div:nth-child(3) { - left: 16px; - animation: loading2 0.6s infinite; -} -.loading div:nth-child(4) { - left: 28px; - animation: loading3 0.6s infinite; -} -@keyframes loading1 { - 0% { - transform: scale(0); - } - 100% { - transform: scale(1); - } -} -@keyframes loading3 { - 0% { - transform: scale(1); - } - 100% { - transform: scale(0); - } -} -@keyframes loading2 { - 0% { - transform: translate(0, 0); - } - 100% { - transform: translate(12px, 0); - } -} - -.tab_btn_row { - background-color: #efefef; - display: flex; - flex-direction: row; - flex-wrap: nowrap; -} -.tab_btn_row .tab_btn { - flex-grow: 1; - padding: 4px 8px; - border-top: 1px solid transparent; - border-left: 1px solid transparent; - border-right: 1px solid transparent; - border-bottom: 1px solid #ccc; - border-radius: 4px 4px 0 0; - text-align: center; - font-size: 1.2em; - transition: 200ms all; -} -.tab_btn:not(.active):hover { - background-color: #fafafa; -} -.tab_btn.active { - background-color: #fff; - border-top: 1px solid #ccc; - border-left: 1px solid #ccc; - border-right: 1px solid #ccc; - border-bottom: 1px solid transparent; -} - -.content { - margin: 6px 0; - padding: 4px 8px 0 8px; - border-top: 1px solid #ccc; - border-left: 1px solid #ccc; - border-right: 1px solid #ccc; - border-bottom: 1px solid #ccc; -} -.tab_content.bordered { - padding: 16px 8px 8px 8px; - border-top: 1px solid transparent; - border-left: 1px solid #ccc; - border-right: 1px solid #ccc; - border-bottom: 1px solid #ccc; - border-radius: 0 0 4px 4px; -} - -.footer_group { - width: 296px; -} - -.warning_box { - border-color: #FCD62E; - border-radius: 0.25rem; - border-width: 0.125rem; - padding: 0 0.5rem; - margin: 0 4px; - background-color: #FEF9C3; - border-style: solid; -} diff --git a/nopecha/popup.html b/nopecha/popup.html deleted file mode 100644 index 5957b1c..0000000 --- a/nopecha/popup.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - -
- - -
-
-
Manage Subscription
-
- -
- - -
- - - -
-
Subscription
-
-
-
-
- -
-
Credits
-
-
-
-
- -
-
Refills
-
-
-
-
-
- -
- -
-
hCaptcha
-
reCAPTCHA
-
- -
- -
-
-
Auto Solve
- -
- -
-
Solve Delay (ms)
- -
- -
-
Auto Open
- -
- -
-
Open Delay (ms)
- -
-
- - - -
- - - - -
- - - \ No newline at end of file diff --git a/nopecha/popup.js b/nopecha/popup.js deleted file mode 100644 index 5688306..0000000 --- a/nopecha/popup.js +++ /dev/null @@ -1 +0,0 @@ -Date.now||(Date.now=function(){return(new Date).getTime()});class BG{static exec(t,n){return new Promise(e=>{try{chrome.runtime.sendMessage({method:t,data:n},e)}catch{e()}})}}class Util{static sleep(t){return new Promise(e=>setTimeout(e,t))}static pad_left(e,t,n){for(;(""+e).lengtht(s.id,s.checked));for(const c of document.querySelectorAll('.settings_group input[type="text"]'))c.addEventListener("input",()=>n(c.id,c.value));for(const l of document.querySelectorAll(".settings_group select"))l.addEventListener("change",()=>a(l.id,l.value));document.querySelector("#manage").addEventListener("click",async()=>{await BG.exec("open_tab",{url:"https://nopecha.com/manage"})}),document.querySelector("#footer").addEventListener("click",async()=>{await BG.exec("open_tab",{url:"https://nopecha.com/discord"})});let i=null;document.querySelector("#key").addEventListener("input",()=>{clearTimeout(i),i=setTimeout(check_plan,500)});for(const d of document.querySelectorAll(".tab_btn")){d.dataset.target;d.addEventListener("click",()=>{for(const e of document.querySelectorAll(".tab"))e.classList.add("hidden");for(const t of document.querySelectorAll(".tab_btn"))t.classList.remove("active");d.classList.add("active"),document.querySelector(d.dataset.target).classList.remove("hidden")})}}async function render_plan(){var t=await BG.exec("get_settings");if(t&&plan&&!rendering_server_plan){rendering_server_plan=!0;const a=document.querySelector("#plan"),i=document.querySelector("#credit"),r=document.querySelector("#refills"),s=document.querySelector("#incorrect_key"),c=document.querySelector("#ipbanned_warning");var n=Date.now()/1e3;let e=null;plan.lastreset&&plan.duration&&(e=Math.floor(Math.max(0,plan.duration-(n-plan.lastreset)))),a.innerHTML=plan.plan,"free"===plan.plan?(""!==t.key?s.classList.remove("hidden"):s.classList.add("hidden"),a.classList.remove("green"),a.classList.add("red")):(s.classList.add("hidden"),a.classList.remove("red"),a.classList.add("green")),plan.plan.includes("Banned")?c.classList.remove("hidden"):c.classList.add("hidden"),0===e?(i.classList.remove("green"),i.classList.remove("red"),i.innerHTML='
'):(i.innerHTML=plan.credit+" / "+plan.quota,0===plan.credit?(i.classList.remove("green"),i.classList.add("red")):(i.classList.remove("red"),i.classList.add("green"))),e?(n=Util.time_to_hms(e),r.innerHTML=""+n):r.innerHTML='
',0!==plan.duration&&0===e&&await check_plan(),rendering_server_plan=!1}}async function main(){await initialize_ui(),await check_plan(),await render_plan(),setInterval(render_plan,250)}document.addEventListener("DOMContentLoaded",main); \ No newline at end of file diff --git a/nopecha/recaptcha.js b/nopecha/recaptcha.js deleted file mode 100644 index 26c7ce1..0000000 --- a/nopecha/recaptcha.js +++ /dev/null @@ -1 +0,0 @@ -(async()=>{class _{static time(){return Date.now||(Date.now=()=>(new Date).getTime()),Date.now()}static sleep(t=1e3){return new Promise(e=>setTimeout(e,t))}static async random_sleep(e,t){t=Math.floor(Math.random()*(t-e)+e);return _.sleep(t)}static pad(e){var t=2-String(e).length+1;return 0{try{chrome.runtime.sendMessage({method:e,data:a},t)}catch(e){t()}})}}class d{static async fetch(e,t){return g.exec("fetch",{url:e,options:t})}}class m{static INFERENCE_URL="https://api.nopecha.com";static MAX_WAIT_POST=60;static MAX_WAIT_GET=60;static ERRORS={UNKNOWN:9,INVALID_REQUEST:10,RATE_LIIMTED:11,BANNED_USER:12,NO_JOB:13,INCOMPLETE_JOB:14,INVALID_KEY:15,NO_CREDIT:16,UPDATE_REQUIRED:17};static async post({captcha_type:e,task:t,image_urls:a,grid:r,key:c}){for(var i=Date.now(),n=await g.exec("info_tab");!(Date.now()-i>1e3*m.MAX_WAIT_POST);){const u={type:e,task:t,image_urls:a,v:chrome.runtime.getManifest().version,key:c,url:n.url};r&&(u.grid=r);var l=await d.fetch(m.INFERENCE_URL,{method:"POST",body:JSON.stringify(u),headers:{"Content-Type":"application/json"}});try{var s=JSON.parse(l);if("error"in s){if(s.error===m.ERRORS.RATE_LIMITED){await _.sleep(2e3);continue}if(s.error===m.ERRORS.INVALID_KEY)break;if(s.error===m.ERRORS.NO_CREDIT)break;break}var o="id"in s?s.id:s.data;return await m.get({job_id:o,key:c})}catch(e){break}}return{job_id:null,clicks:null}}static async get({key:e,job_id:t}){for(var a=Date.now();!(Date.now()-a>1e3*m.MAX_WAIT_GET);){await _.sleep(500);var r=await d.fetch(m.INFERENCE_URL+`?id=${t}&key=`+e);try{var c=JSON.parse(r);if("error"in c){if(c.error!==m.ERRORS.INCOMPLETE_JOB)return{job_id:t,clicks:null};continue}return{job_id:t,clicks:c.data}}catch(e){break}}return{job_id:t,clicks:null}}}function a(){var e="true"===document.querySelector(".recaptcha-checkbox")?.getAttribute("aria-checked"),t=document.querySelector("#recaptcha-verify-button")?.disabled;return e||t}function y(c=15e3){return new Promise(async e=>{for(var t=_.time();;){var a=document.querySelectorAll(".rc-imageselect-tile"),r=document.querySelectorAll(".rc-imageselect-dynamic-selected");if(0c)return e(!1);await _.sleep(100)}})}async function w(e){let t=null;if(!(t=1{let f=!1;const h=setInterval(async()=>{if(!f){f=!0;var r=document.querySelector(".rc-imageselect-instructions")?.innerText?.split("\n"),c=await w(r);if(c){var r=3===r.length,i=document.querySelectorAll("table tr td");if(9!==i.length&&16!==i.length)f=!1;else{const s=[],o=Array(i.length).fill(null);let e=null,t=!1,a=0;for(const u of i){var n=u?.querySelector("img");if(!n)return void(f=!1);var l=n?.src?.trim();if(!l||""===l)return void(f=!1);300<=n.naturalWidth?e=l:100==n.naturalWidth&&(o[a]=l,t=!0),s.push(u),a++}t&&(e=null);i=JSON.stringify([e,o]);if(v!==i)return v=i,clearInterval(h),f=!1,d({task:c,is_hard:r,cells:s,background_url:e,urls:o});f=!1}}else f=!1}},t)}),o=9==n.length?3:4;const h=[];let e,a=[];if(null===l){e="1x1";for(let e=0;e{let i=null,n=!1,s=!1;function a(e){let t=e;for(;t&&!t.classList?.contains("rc-imageselect-tile");)t=t.parentNode;return t}function t(e,t,n=!1){!e||!n&&i===e||(!0===t&&e.classList.contains("rc-imageselect-tileselected")||!1===t&&!e.classList.contains("rc-imageselect-tileselected"))&&e.click()}document.addEventListener("mousedown",e=>{const t=a(e?.target);t&&(s=t.classList.contains("rc-imageselect-tileselected")?n=!0:!(n=!0),i=t)}),document.addEventListener("mouseup",e=>{n=!1,i=null}),document.addEventListener("mousemove",e=>{e=a(e?.target);n&&(i!==e&&null!==i&&t(i,s,!0),t(e,s))});window.addEventListener("load",function(e){const t=document.body.appendChild(document.createElement("style")).sheet;t.insertRule(".rc-imageselect-table-33, .rc-imageselect-table-42, .rc-imageselect-table-44 {transition-duration: 0.5s !important}",0),t.insertRule(".rc-imageselect-tile {transition-duration: 2s !important}",1),t.insertRule(".rc-imageselect-dynamic-selected {transition-duration: 1s !important}",2),t.insertRule(".rc-imageselect-progress {transition-duration: 0.5s !important}",3),t.insertRule(".rc-image-tile-overlay {transition-duration: 0.5s !important}",4),t.insertRule("#rc-imageselect img {pointer-events: none !important}",5)})})(); \ No newline at end of file diff --git a/nopecha/recaptcha_voice.js b/nopecha/recaptcha_voice.js deleted file mode 100644 index 8f3f9b8..0000000 --- a/nopecha/recaptcha_voice.js +++ /dev/null @@ -1 +0,0 @@ -(async()=>{class r{static time(){return Date.now||(Date.now=()=>(new Date).getTime()),Date.now()}static sleep(t=1e3){return new Promise(e=>setTimeout(e,t))}static async random_sleep(e,t){t=Math.floor(Math.random()*(t-e)+e);return r.sleep(t)}static pad(e){var t=2-String(e).length+1;return 0{try{chrome.runtime.sendMessage({method:e,data:a},t)}catch(e){t()}})}}class o{static async fetch(e,t){return n.exec("fetch",{url:e,options:t})}}function i(){var e,t;if(!l())return e="true"===document.querySelector(".recaptcha-checkbox")?.getAttribute("aria-checked"),t=document.querySelector("#recaptcha-verify-button")?.disabled,e||t}function l(){return"Try again later"===document.querySelector(".rc-doscaptcha-header")?.innerText}async function e(e){i()||(await r.sleep(e.recaptcha_open_delay),document.querySelector("#recaptcha-anchor")?.click())}async function t(t){var a=await n.exec("get_cache",{name:"recaptcha_visible",tab_specific:!0});if(!0===a&&!i())if(l())await n.exec("reset_recaptcha");else{a=document.querySelector(".rc-audiochallenge-tdownload-link")?.href,a=(fetch(a),document.querySelector("#audio-source")?.src?.replace("recaptcha.net","google.com"));let e=document.querySelector("html")?.getAttribute("lang")?.trim();e&&0!==e.length||(e="en");var c=r.time(),a=await o.fetch("https://engageub.pythonanywhere.com",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"input="+encodeURIComponent(a)+"&lang="+e}),a=(document.querySelector("#audio-response").value=a,t.recaptcha_solve_delay-(r.time()-c));0{try{chrome.runtime.sendMessage({method:e,data:n},t)}catch(e){t()}})}}document.location.hash?(document.body.innerText="Loading...",BG.exec("set_settings",{id:"key",value:document.location.hash.substring(1)}).then(()=>document.body.innerText="Key set!")):document.body.innerText="Missing key. Please set the hash and reload the page.\nExample: https://nopecha.com/setup#sub_testkey1234"; \ No newline at end of file diff --git a/nopecha/utils.js b/nopecha/utils.js deleted file mode 100644 index 1590e0e..0000000 --- a/nopecha/utils.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";class Type{static _string_constructor="string".constructor;static _array_constructor=[].constructor;static _object_constructor={}.constructor;static of(e){return null===e?"null":void 0===e?"undefined":e.constructor===Type._string_constructor?"string":e.constructor===Type._array_constructor?"array":e.constructor===Type._object_constructor?"object":""}}class Logger{static debug=!0;static log(e=0){const t=new Array(...arguments).map(e=>["array","object"].includes(Type.of(e))?JSON.stringify(e,null,4):""+e);t.join(" ")}}class Time{static time(){return Date.now||(Date.now=()=>(new Date).getTime()),Date.now()}static sleep(t=1e3){return new Promise(e=>setTimeout(e,t))}static async random_sleep(e,t){t=Math.floor(Math.random()*(t-e)+e);return Time.sleep(t)}static pad(e){var t=2-String(e).length+1;return 0{try{chrome.runtime.sendMessage({method:e,data:r},t)}catch(e){t()}})}}class Net{static async fetch(e,t){return BG.exec("fetch",{url:e,options:t})}}class Image{static encode(t){return new Promise(r=>{if(null===t)return r(null);const e=new XMLHttpRequest;e.onload=()=>{const t=new FileReader;t.onloadend=()=>{let e=t.result;if(e.startsWith("data:text/html;base64,"))return r(null);e=e.replace("data:image/jpeg;base64,",""),r(e)},t.readAsDataURL(e.response)},e.onerror=()=>{r(null)},e.onreadystatechange=()=>{4==this.readyState&&200!=this.status&&r(null)},e.open("GET",t),e.responseType="blob",e.send()})}}class NopeCHA{static INFERENCE_URL="https://api.nopecha.com";static MAX_WAIT_POST=60;static MAX_WAIT_GET=60;static ERRORS={UNKNOWN:9,INVALID_REQUEST:10,RATE_LIIMTED:11,BANNED_USER:12,NO_JOB:13,INCOMPLETE_JOB:14,INVALID_KEY:15,NO_CREDIT:16,UPDATE_REQUIRED:17};static async post({captcha_type:e,task:t,image_urls:r,grid:a,key:n}){for(var o=Date.now(),s=await BG.exec("info_tab");!(Date.now()-o>1e3*NopeCHA.MAX_WAIT_POST);){const u={type:e,task:t,image_urls:r,v:chrome.runtime.getManifest().version,key:n,url:s.url};a&&(u.grid=a);var i=await Net.fetch(NopeCHA.INFERENCE_URL,{method:"POST",body:JSON.stringify(u),headers:{"Content-Type":"application/json"}});try{var c=JSON.parse(i);if("error"in c){if(c.error===NopeCHA.ERRORS.RATE_LIMITED){await Time.sleep(2e3);continue}if(c.error===NopeCHA.ERRORS.INVALID_KEY)break;if(c.error===NopeCHA.ERRORS.NO_CREDIT)break;break}var l="id"in c?c.id:c.data;return await NopeCHA.get({job_id:l,key:n})}catch(e){break}}return{job_id:null,clicks:null}}static async get({key:e,job_id:t}){for(var r=Date.now();!(Date.now()-r>1e3*NopeCHA.MAX_WAIT_GET);){await Time.sleep(500);var a=await Net.fetch(NopeCHA.INFERENCE_URL+`?id=${t}&key=`+e);try{var n=JSON.parse(a);if("error"in n){if(n.error!==NopeCHA.ERRORS.INCOMPLETE_JOB)return{job_id:t,clicks:null};continue}return{job_id:t,clicks:n.data}}catch(e){break}}return{job_id:t,clicks:null}}}function oep(a,n=1,e=100){return new Promise(t=>{const r=setInterval(()=>{var e=document.querySelectorAll(a);if(e.length===n)return clearInterval(r),t(1===n?e[0]:e)},e)})}export{Type,Logger,Time,BG,Net,Image,NopeCHA,oep}; \ No newline at end of file