mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-28 02:26:10 +00:00
web/DownloadButton: show a message about ongoing antibot check
This commit is contained in:
parent
c99240339d
commit
c0bb637480
|
@ -8,6 +8,8 @@
|
|||
|
||||
"tunnel.probe": "couldn't verify whether you can download this file. try again in a few seconds!",
|
||||
|
||||
"captcha_ongoing": "still checking if you're not a bot. wait for the spinner to disappear and try again.\n\nif it takes too long, please let us know! we use cloudflare turnstile for bot protection and sometimes it blocks people for no reason.",
|
||||
|
||||
"api.auth.jwt.missing": "couldn't confirm whether you're not a robot because the processing server didn't receive the human access token. try again in a few seconds or reload the page!",
|
||||
"api.auth.jwt.invalid": "couldn't confirm whether you're not a robot because your human access token expired and wasn't renewed. try again in a few seconds or reload the page!",
|
||||
"api.auth.turnstile.missing": "couldn't confirm whether you're not a robot because the processing server didn't receive the human access token. try again in a few seconds or reload the page!",
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
import { createDialog } from "$lib/dialogs";
|
||||
import { downloadFile } from "$lib/download";
|
||||
|
||||
import { cachedInfo } from "$lib/api/server-info";
|
||||
import { turnstileLoaded } from "$lib/state/turnstile";
|
||||
|
||||
import type { DialogInfo } from "$lib/types/dialog";
|
||||
|
||||
export let url: string;
|
||||
|
@ -63,6 +66,15 @@
|
|||
export const download = async (link: string) => {
|
||||
changeDownloadButton("think");
|
||||
|
||||
if ($cachedInfo?.info?.cobalt?.turnstileSitekey && !$turnstileLoaded) {
|
||||
changeDownloadButton("error");
|
||||
|
||||
return createDialog({
|
||||
...defaultErrorPopup,
|
||||
bodyText: $t("error.captcha_ongoing"),
|
||||
});
|
||||
}
|
||||
|
||||
const response = await API.request(link);
|
||||
|
||||
if (!response) {
|
||||
|
|
Loading…
Reference in a new issue