diff --git a/web/i18n/en/error.json b/web/i18n/en/error.json index 6a730052..2b5e09c6 100644 --- a/web/i18n/en/error.json +++ b/web/i18n/en/error.json @@ -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!", diff --git a/web/src/components/save/buttons/DownloadButton.svelte b/web/src/components/save/buttons/DownloadButton.svelte index e8d24f0f..22ae8ccb 100644 --- a/web/src/components/save/buttons/DownloadButton.svelte +++ b/web/src/components/save/buttons/DownloadButton.svelte @@ -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) {