best way to save what you love
Svelte collaborationdownloaderinstagramjavascriptmusicredditsocial-mediasoundcloudsveltetiktoktwittertypescriptvideovimeovkwebappyoutubeyoutube-downloader
web/DownloadButton: check server info before main request
wukko819c7a4fa09f
diff --git a/web/src/components/save/buttons/DownloadButton.svelte b/web/src/components/save/buttons/DownloadButton.svelteindex 22ae8ccb..6437958e 100644--- a/web/src/components/save/buttons/DownloadButton.svelte+++ b/web/src/components/save/buttons/DownloadButton.svelte@@ -6,7 +6,7 @@import { createDialog } from "$lib/dialogs";import { downloadFile } from "$lib/download";- import { cachedInfo } from "$lib/api/server-info";+ import { cachedInfo, getServerInfo } from "$lib/api/server-info";import { turnstileLoaded } from "$lib/state/turnstile";import type { DialogInfo } from "$lib/types/dialog";@@ -66,6 +66,17 @@export const download = async (link: string) => {changeDownloadButton("think");+ await getServerInfo();++ if (!$cachedInfo) {+ changeDownloadButton("error");++ return createDialog({+ ...defaultErrorPopup,+ bodyText: $t("error.api.unreachable"),+ });+ }+if ($cachedInfo?.info?.cobalt?.turnstileSitekey && !$turnstileLoaded) {changeDownloadButton("error");