From 67543e604455b74a9e9bd9e0087f8586391cefb5 Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Wed, 29 Jan 2025 16:32:53 +0300 Subject: [PATCH 1/2] revert changes to theme switch button. --- ui/layouts/default.vue | 53 ++++++++++++------------------------------ 1 file changed, 15 insertions(+), 38 deletions(-) diff --git a/ui/layouts/default.vue b/ui/layouts/default.vue index e08c4d54..047d9f1f 100644 --- a/ui/layouts/default.vue +++ b/ui/layouts/default.vue @@ -19,28 +19,6 @@ - - + + - All output template naming options can be found at this page. + + All output template naming options can be found at this page. @@ -80,33 +81,36 @@
- Some config fields are ignored like format cookiefile, paths, - and outtmpl etc. Available option can be found at - this page. Warning: Use with caution some of those options can break yt-dlp or the - frontend. + + Extends current global yt-dlp config with given options. Some fields are ignored like + format cookiefile, paths, and outtmpl etc. + Warning: Use with caution some of those options can break yt-dlp or the frontend.
- Use - flagCookies to extract cookies as JSON string. + + Use + flagCookies to extract cookies as JSON string.
@@ -157,25 +161,12 @@ const downloadPath = useStorage('downloadPath', null) const url = useStorage('downloadUrl', null) const showAdvanced = useStorage('show_advanced', false) const addInProgress = ref(false) +const convertInProgress = ref(false) const addDownload = async () => { // -- send request to convert cli options to JSON if (ytdlpConfig.value && !ytdlpConfig.value.trim().startsWith('{')) { - const response = await request('/api/yt-dlp/convert', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ args: ytdlpConfig.value }), - }); - - const data = await response.json() - if (200 !== response.status) { - toast.error(`Error: (${response.status}): ${data.error}`) - return - } - - ytdlpConfig.value = JSON.stringify(data, null, 2) + await convertOptions() } if (ytdlpConfig.value) { @@ -242,6 +233,21 @@ const unlockDownload = async stream => { } } +const convertOptions = async () => { + if (convertInProgress.value) { + return + } + + try { + convertInProgress.value = true + ytdlpConfig.value = await convertCliOptions(ytdlpConfig.value) + } catch (e) { + toast.error(e.message) + } finally { + convertInProgress.value = false + } +} + onMounted(() => { socket.on('status', statusHandler) socket.on('error', unlockDownload) diff --git a/ui/components/TaskForm.vue b/ui/components/TaskForm.vue index 2395122e..dc70f794 100644 --- a/ui/components/TaskForm.vue +++ b/ui/components/TaskForm.vue @@ -127,7 +127,8 @@