Replace the tree with upstream TecharoHQ/anubis v1.28.2 (a1384fbf42e3). Masyunis customizations are re-applied in the following commits.
27 lines
643 B
TypeScript
27 lines
643 B
TypeScript
import {
|
|
ProgressCallback,
|
|
ProcessOptions,
|
|
ProcessResult,
|
|
defaultThreads,
|
|
runWorkers,
|
|
} from "@lib/worker";
|
|
|
|
export default async function process(
|
|
options: ProcessOptions,
|
|
data: string,
|
|
difficulty: number = 5,
|
|
signal: AbortSignal | null = null,
|
|
progressCallback?: ProgressCallback,
|
|
threads: number = defaultThreads(),
|
|
): Promise<ProcessResult> {
|
|
console.debug("fast algo");
|
|
|
|
return runWorkers({
|
|
webWorkerURL: `${options.basePrefix}/.within.website/x/cmd/anubis/static/js/worker/sha256.mjs?cacheBuster=${options.version}`,
|
|
message: { data, difficulty },
|
|
threads,
|
|
signal,
|
|
progressCallback,
|
|
});
|
|
}
|