This commit is contained in:
Tiago
2025-04-20 11:16:06 +01:00
parent 3eacd413e4
commit a70ec5eb02
4 changed files with 13 additions and 10 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@cap.js/widget",
"version": "0.0.19",
"version": "0.0.20",
"description": "Cap widget",
"keywords": [
"captcha",
+10 -7
View File
@@ -138,15 +138,16 @@
})
).json();
if (!resp.success) throw new Error("Invalid solution");
this.dispatchEvent("progress", { progress: 100 });
this.dispatchEvent("solve", { token: resp.token });
this.#token = resp.token;
if (!resp.success) throw new Error("Invalid solution");
if (this.querySelector("input[name='cap-token']")) {
this.querySelector("input[name='cap-token']").value = resp.token;
}
this.dispatchEvent("solve", { token: resp.token });
this.#token = resp.token;
if (this.#resetTimer) clearTimeout(this.#resetTimer);
const expiresIn = new Date(resp.expires).getTime() - Date.now();
if (expiresIn > 0 && expiresIn < 24 * 60 * 60 * 1000) {
@@ -225,8 +226,8 @@
const maxWorkers = Math.min(navigator.hardwareConcurrency || 8, 16);
this.#workersCount =
!isNaN(parsedWorkers) &&
parsedWorkers > 0 &&
parsedWorkers <= maxWorkers
parsedWorkers > 0 &&
parsedWorkers <= maxWorkers
? parsedWorkers
: navigator.hardwareConcurrency || 8;
}
@@ -424,7 +425,9 @@
typeof WebAssembly.instantiate === "function"
)
) {
console.log("[cap] WASM not enabled, falling back to crypto.subtle\nThis is significanty slower than the WASM implementation");
console.log(
"[cap] WASM not enabled, falling back to crypto.subtle\nThis is significanty slower than the WASM implementation"
);
const targetBytes = new Uint8Array(target.length / 2);
for (let k = 0; k < targetBytes.length; k++) {