mirror of
https://gitgud.io/fatchan/haproxy-protection.git
synced 2025-05-09 02:05:37 +00:00
Move everything under paths like /.basedflare/ instead of putting stuff in paths where it might conflict
Move templates to own file instead of in main lua script Rename some stuff from "hcatpcha" to more correct "captcha" and "bot-check" because we no longer only have hcaptcha Clean some code and add a few comments
This commit is contained in:
@ -25,6 +25,7 @@ const wasmSupported = (() => {
|
||||
return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
return false;
|
||||
})();
|
||||
@ -37,7 +38,7 @@ function postResponse(powResponse, captchaResponse) {
|
||||
body['h-captcha-response'] = captchaResponse;
|
||||
body['g-recaptcha-response'] = captchaResponse;
|
||||
}
|
||||
fetch('/bot-check', {
|
||||
fetch('/.basedflare/bot-check', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -52,7 +53,7 @@ function postResponse(powResponse, captchaResponse) {
|
||||
return insertError('server responded with error.');
|
||||
}
|
||||
finishRedirect();
|
||||
}).catch(err => {
|
||||
}).catch(() => {
|
||||
insertError('failed to send challenge response.');
|
||||
});
|
||||
}
|
||||
@ -74,7 +75,7 @@ const powFinished = new Promise((resolve, reject) => {
|
||||
const eHashes = Math.pow(16, Math.floor(diff/8)) * ((diff%8)*2);
|
||||
const diffString = '0'.repeat(Math.floor(diff/8));
|
||||
const combined = pow;
|
||||
const [userkey, challenge, signature] = combined.split("#");
|
||||
const [userkey, challenge] = combined.split("#");
|
||||
const start = Date.now();
|
||||
if (window.Worker) {
|
||||
const cpuThreads = window.navigator.hardwareConcurrency;
|
||||
@ -117,7 +118,7 @@ const powFinished = new Promise((resolve, reject) => {
|
||||
} else {
|
||||
console.warn('No webworker support, running in main/UI thread!');
|
||||
let i = 0;
|
||||
let start = Date.now();
|
||||
const start = Date.now();
|
||||
while(true) {
|
||||
const hash = await argon2.hash({
|
||||
pass: challenge + i.toString(),
|
||||
|
Reference in New Issue
Block a user