From 20d01ff21d1ec014a424f10c40dde5844f842820 Mon Sep 17 00:00:00 2001
From: Tiago Rangel
Date: Mon, 13 Jan 2025 20:09:04 +0000
Subject: [PATCH] Changes to the widget
---
TODO.md | 1 -
widget/src/cap.js | 3 ++-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/TODO.md b/TODO.md
index 25e87bf..60d1814 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,4 +1,3 @@
-* Wait until wasm-hashes is loaded before solving
* Better error handling
* More options
* Add support for other languages
\ No newline at end of file
diff --git a/widget/src/cap.js b/widget/src/cap.js
index 316de92..f1c1f87 100644
--- a/widget/src/cap.js
+++ b/widget/src/cap.js
@@ -45,6 +45,7 @@
}
async solve() {
+ await until(() => !!this.#workerUrl);
this.dispatchEvent("progress", { progress: 0 });
try {
@@ -494,7 +495,7 @@
setTimeout(async function () {
workerScript =
- (await (await fetch("https://cdn.jsdelivr.net/gh/tiagorangel1/cap/lib/wasm-hashes.min.js")).text()) +
+ (await (await fetch("https://cdn.jsdelivr.net/npm/@cap.js/widget/wasm-hashes.min.js")).text()) +
workerFunct
.toString()
.replace(/^function\s*\([^\)]*\)\s*{|\}$/g, "")