web/DownloadButton: show a message about ongoing antibot check

This commit is contained in:
wukko
2024-09-20 15:20:53 +06:00
parent c99240339d
commit c0bb637480
2 changed files with 14 additions and 0 deletions

View File

@ -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) {