From e0d97298fb0bd75ff5aa1c4d73082cb247be195a Mon Sep 17 00:00:00 2001
From: tiago <70700766+tiagozip@users.noreply.github.com>
Date: Sun, 1 Mar 2026 15:03:13 +0000
Subject: [PATCH] fix: fix token sometimes not being returned (widget@0.1.40)
---
standalone/public/tester.html | 5 +++--
widget/src/cap.min.js | 2 +-
widget/src/package.json | 2 +-
widget/src/src/cap.js | 11 +++++++----
4 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/standalone/public/tester.html b/standalone/public/tester.html
index 740f2cb..6f804d1 100644
--- a/standalone/public/tester.html
+++ b/standalone/public/tester.html
@@ -64,10 +64,10 @@
-
+
-
+
@@ -122,6 +122,7 @@
try {
const result = await cap.solve();
log(`Solved in ${Date.now() - startTime}ms`);
+ console.log(result)
await validateToken(keyId, secretKey, result.token);
} catch (err) {
log(`Error during solve: ${err}`);
diff --git a/widget/src/cap.min.js b/widget/src/cap.min.js
index b5df719..840ccee 100644
--- a/widget/src/cap.min.js
+++ b/widget/src/cap.min.js
@@ -1 +1 @@
-(()=>{const e="vibrate"in navigator&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches;if("undefined"==typeof window)return;const t=(e,t={})=>window?.CAP_CUSTOM_FETCH?window.CAP_CUSTOM_FETCH(e,t):fetch(e,t);function r(e,t){let r=function(e){let t=2166136261;for(let r=0;r>>0}(e),n="";function s(){return r^=r<<13,r^=r>>>17,r^=r<<5,r>>>0}for(;n.length{const t=atob(e),r=new Uint8Array(t.length);for(let e=0;e{try{var n=new DecompressionStream("deflate-raw"),s=n.writable.getWriter(),i=n.readable.getReader(),o=[];i.read().then(function t(n){if(n.done){for(var s=0,a=0,l=0;l{s.close()}).catch(r)}catch(e){r(e)}});return new Promise(e=>{var t=setTimeout(()=>{i(),e({__timeout:!0})},2e4),n=document.createElement("iframe");n.setAttribute("sandbox","allow-scripts"),n.setAttribute("aria-hidden","true"),n.style.cssText="position:absolute;width:1px;height:1px;top:-9999px;left:-9999px;border:none;opacity:0;pointer-events:none;";var s=!1;function i(){s||(s=!0,clearTimeout(t),window.removeEventListener("message",o),n.parentNode&&n.parentNode.removeChild(n))}function o(t){var r=t.data;r&&"object"==typeof r&&("cap:instr"===r.type?(i(),r.blocked?e({__blocked:!0,blockReason:r.blockReason||"automated_browser"}):r.result?e(r.result):e({__timeout:!0})):"cap:error"===r.type&&(i(),e({__timeout:!0})))}window.addEventListener("message",o),n.srcdoc='