feat: Replace aCAPTCHA with official ALTCHA (altcha.org) Proof-of-Work web component widget

This commit is contained in:
Richard
2026-07-31 11:39:29 +02:00
parent 6ef74c7cf4
commit 83c782c469
417 changed files with 100543 additions and 317 deletions
+24
View File
@@ -0,0 +1,24 @@
class Mutex {
private mutex = Promise.resolve();
lock(): PromiseLike<() => void> {
let begin: (unlock: () => void) => void = () => {};
this.mutex = this.mutex.then(() => new Promise(begin));
return new Promise((res) => {
begin = res;
});
}
async dispatch<T>(fn: () => PromiseLike<T>): Promise<T> {
const unlock = await this.lock();
try {
return await Promise.resolve(fn());
} finally {
unlock();
}
}
}
export default Mutex;