feat: Replace aCAPTCHA with official ALTCHA (altcha.org) Proof-of-Work web component widget
This commit is contained in:
+168
@@ -0,0 +1,168 @@
|
||||
const noop = () => {
|
||||
};
|
||||
function safe_not_equal(a, b) {
|
||||
return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
|
||||
}
|
||||
function subscribe_to_store(store2, run, invalidate) {
|
||||
if (store2 == null) {
|
||||
run(void 0);
|
||||
return noop;
|
||||
}
|
||||
const unsub = untrack(
|
||||
() => store2.subscribe(
|
||||
run,
|
||||
// @ts-expect-error
|
||||
invalidate
|
||||
)
|
||||
);
|
||||
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
|
||||
}
|
||||
const subscriber_queue = [];
|
||||
function writable(value, start = noop) {
|
||||
let stop = null;
|
||||
const subscribers = /* @__PURE__ */ new Set();
|
||||
function set(new_value) {
|
||||
if (safe_not_equal(value, new_value)) {
|
||||
value = new_value;
|
||||
if (stop) {
|
||||
const run_queue = !subscriber_queue.length;
|
||||
for (const subscriber of subscribers) {
|
||||
subscriber[1]();
|
||||
subscriber_queue.push(subscriber, value);
|
||||
}
|
||||
if (run_queue) {
|
||||
for (let i = 0; i < subscriber_queue.length; i += 2) {
|
||||
subscriber_queue[i][0](subscriber_queue[i + 1]);
|
||||
}
|
||||
subscriber_queue.length = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function update(fn) {
|
||||
set(fn(
|
||||
/** @type {T} */
|
||||
value
|
||||
));
|
||||
}
|
||||
function subscribe(run, invalidate = noop) {
|
||||
const subscriber = [run, invalidate];
|
||||
subscribers.add(subscriber);
|
||||
if (subscribers.size === 1) {
|
||||
stop = start(set, update) || noop;
|
||||
}
|
||||
run(
|
||||
/** @type {T} */
|
||||
value
|
||||
);
|
||||
return () => {
|
||||
subscribers.delete(subscriber);
|
||||
if (subscribers.size === 0 && stop) {
|
||||
stop();
|
||||
stop = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
return { set, update, subscribe };
|
||||
}
|
||||
function get(store2) {
|
||||
let value;
|
||||
subscribe_to_store(store2, (_) => value = _)();
|
||||
return value;
|
||||
}
|
||||
let untracking = false;
|
||||
function untrack(fn) {
|
||||
var previous_untracking = untracking;
|
||||
try {
|
||||
untracking = true;
|
||||
return fn();
|
||||
} finally {
|
||||
untracking = previous_untracking;
|
||||
}
|
||||
}
|
||||
function store(defaultValue) {
|
||||
const scope = {
|
||||
get: (name) => {
|
||||
return get(scope.store)[name];
|
||||
},
|
||||
set: (name, value) => {
|
||||
if (typeof name === "string") {
|
||||
Object.assign(get(scope.store), {
|
||||
[name]: value
|
||||
});
|
||||
} else {
|
||||
Object.assign(get(scope.store), name);
|
||||
}
|
||||
scope.store.set(get(scope.store));
|
||||
},
|
||||
store: writable(defaultValue)
|
||||
};
|
||||
return scope;
|
||||
}
|
||||
globalThis.$altcha = globalThis.$altcha || {
|
||||
algorithms: /* @__PURE__ */ new Map(),
|
||||
defaults: store({}),
|
||||
i18n: store({}),
|
||||
instances: /* @__PURE__ */ new Set(),
|
||||
plugins: /* @__PURE__ */ new Set()
|
||||
};
|
||||
const i18n$2 = {
|
||||
ariaLinkLabel: "Altcha (site officiel)",
|
||||
enterCode: "Entrez le code",
|
||||
enterCodeAria: "Entrez le code que vous entendez. Appuyez sur la barre d'espace pour écouter l'audio.",
|
||||
error: "Échec de la vérification. Réessayez plus tard.",
|
||||
expired: "La vérification a expiré. Réessayez.",
|
||||
footer: 'Protégé par <a href="https://altcha.org/" tabindex="-1" target="_blank" aria-label="Altcha (site officiel)">ALTCHA</a>',
|
||||
getAudioChallenge: "Obtenir un défi audio",
|
||||
label: "Je ne suis pas un robot",
|
||||
loading: "Chargement...",
|
||||
reload: "Recharger",
|
||||
verify: "Vérifier",
|
||||
verificationRequired: "Vérification requise !",
|
||||
verified: "Vérifié",
|
||||
verifying: "Vérification en cours...",
|
||||
waitAlert: "Vérification en cours... veuillez patienter.",
|
||||
cancel: "Annuler",
|
||||
enterCodeFromImage: "Pour continuer, veuillez entrer le code de l'image ci-dessous."
|
||||
};
|
||||
globalThis.$altcha.i18n.set("fr-ca", i18n$2);
|
||||
const i18n$1 = {
|
||||
ariaLinkLabel: "Altcha (sitio web oficial)",
|
||||
enterCode: "Ingresa el código",
|
||||
enterCodeAria: "Ingresa el código que escuchas. Presiona Espacio para reproducir el audio.",
|
||||
error: "Falló la verificación. Por favor vuelve a intentarlo más tarde.",
|
||||
expired: "La verificación expiró. Por favor inténtalo de nuevo.",
|
||||
footer: 'Protegido por <a href="https://altcha.org/" tabindex="-1" target="_blank" aria-label="Altcha (sitio web oficial)">ALTCHA</a>',
|
||||
getAudioChallenge: "Obtener un reto de audio",
|
||||
label: "No soy un robot",
|
||||
loading: "Cargando...",
|
||||
reload: "Volver a cargar",
|
||||
verify: "Verificar",
|
||||
verificationRequired: "¡Verificación requerida!",
|
||||
verified: "Verificado",
|
||||
verifying: "Verificando...",
|
||||
waitAlert: "Verificando... por favor espera.",
|
||||
cancel: "Cancelar",
|
||||
enterCodeFromImage: "Para continuar, ingresa el código de la imagen a continuación."
|
||||
};
|
||||
globalThis.$altcha.i18n.set("es-419", i18n$1);
|
||||
const i18n = {
|
||||
ariaLinkLabel: "Altcha (site oficial)",
|
||||
enterCode: "Digite o código",
|
||||
enterCodeAria: "Digite o código que você ouve. Pressione Espaço para reproduzir o áudio.",
|
||||
error: "Falha na verificação. Por favor, tente novamente mais tarde.",
|
||||
expired: "Verificação expirada. Por favor, tente novamente.",
|
||||
footer: 'Protegido por <a href="https://altcha.org/" tabindex="-1" target="_blank" aria-label="Altcha (site oficial)">ALTCHA</a>',
|
||||
getAudioChallenge: "Obter desafio de áudio",
|
||||
label: "Eu não sou um robô",
|
||||
loading: "Carregando...",
|
||||
reload: "Recarregar",
|
||||
verify: "Verificar",
|
||||
verificationRequired: "Verificação necessária!",
|
||||
verified: "Verificado",
|
||||
verifying: "Verificando...",
|
||||
waitAlert: "Verificando... por favor aguarde.",
|
||||
cancel: "Cancelar",
|
||||
enterCodeFromImage: "Para prosseguir, digite o código da imagem abaixo."
|
||||
};
|
||||
globalThis.$altcha.i18n.set("pt-br", i18n);
|
||||
Reference in New Issue
Block a user