mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-07-03 11:22:31 +00:00
fix wasm bigint progress handler
This commit is contained in:
parent
f67fdf917e
commit
cba056aba6
@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||||
|
|
||||||
import { Work, ServiceWorkerMessage } from "./types";
|
import {Work, ServiceWorkerMessage} from "./types";
|
||||||
import fetchPoWConfig from "./fetchPoWConfig";
|
import fetchPoWConfig from "./fetchPoWConfig";
|
||||||
import sendWork from "./sendWork";
|
import sendWork from "./sendWork";
|
||||||
import sendToParent from "./sendToParent";
|
import sendToParent from "./sendToParent";
|
||||||
@ -94,7 +94,7 @@ export const solveCaptchaRunner = async (e: Event): Promise<void> => {
|
|||||||
}
|
}
|
||||||
if (resp.type === "progress") {
|
if (resp.type === "progress") {
|
||||||
if (width < 80) {
|
if (width < 80) {
|
||||||
width = Number(resp.nonce / max_recorded_nonce) * 100;
|
width = resp.nonce / max_recorded_nonce * 100;
|
||||||
setWidth(width);
|
setWidth(width);
|
||||||
}
|
}
|
||||||
console.log(`received nonce ${resp.nonce}`);
|
console.log(`received nonce ${resp.nonce}`);
|
||||||
|
@ -30,7 +30,7 @@ const prove = async (
|
|||||||
config.string,
|
config.string,
|
||||||
config.difficulty_factor,
|
config.difficulty_factor,
|
||||||
STEPS,
|
STEPS,
|
||||||
progress
|
(nonce: BigInt | number) => progress(Number(nonce))
|
||||||
);
|
);
|
||||||
const t1 = performance.now();
|
const t1 = performance.now();
|
||||||
time = t1 - t0;
|
time = t1 - t0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user