From 347f99adb607d2d1bdd3b199eda7e18220286e87 Mon Sep 17 00:00:00 2001 From: arabcoders Date: Tue, 8 Jul 2025 22:54:05 +0300 Subject: [PATCH 1/6] Set default value for auto_start in TaskForm component --- ui/components/TaskForm.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/components/TaskForm.vue b/ui/components/TaskForm.vue index 0e5c3a13..9b540c9a 100644 --- a/ui/components/TaskForm.vue +++ b/ui/components/TaskForm.vue @@ -328,6 +328,9 @@ onMounted(() => { if (!props.task?.preset || '' === props.task.preset) { form.preset = toRaw(config.app.default_preset) } + if (typeof form.auto_start === 'undefined' || form.auto_start === null) { + form.auto_start = true + } }) const checkInfo = async () => { From a8b318b40e0ba991ea0789929463b6186d73cead Mon Sep 17 00:00:00 2001 From: arabcoders Date: Wed, 9 Jul 2025 19:14:19 +0300 Subject: [PATCH 2/6] Refactor confirmation messages for consistency across components --- ui/@types/item.d.ts | 18 ++++++++++++++++++ ui/components/ConditionForm.vue | 2 +- ui/components/NotificationForm.vue | 2 +- ui/components/Queue.vue | 4 ++-- ui/components/TaskForm.vue | 2 +- ui/pages/index.vue | 9 +++++---- ui/pages/notifications.vue | 4 ++-- 7 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 ui/@types/item.d.ts diff --git a/ui/@types/item.d.ts b/ui/@types/item.d.ts new file mode 100644 index 00000000..51abcfff --- /dev/null +++ b/ui/@types/item.d.ts @@ -0,0 +1,18 @@ +export type item_request = { + /** URL of the item to download */ + url: string, + /** Preset to use for the download */ + preset?: string, + /** Where to save the downloaded item */ + folder?: string, + /** Output template for the downloaded item */ + template?: string, + /** Additional command line options for yt-dlp */ + cli?: string, + /** Cookies file for the download */ + cookies?: string, + /** Auto start the download */ + auto_start?: boolean, + /** Extras data for the item */ + extras?: Record, +} diff --git a/ui/components/ConditionForm.vue b/ui/components/ConditionForm.vue index 39619f5d..263acb22 100644 --- a/ui/components/ConditionForm.vue +++ b/ui/components/ConditionForm.vue @@ -330,7 +330,7 @@ const importItem = async () => { return } - if ((form.filter || form.cli) && false === box.confirm('This will overwrite the current data. Are you sure?', true)) { + if ((form.filter || form.cli) && false === box.confirm('Overwrite the current form fields?', true)) { return } diff --git a/ui/components/NotificationForm.vue b/ui/components/NotificationForm.vue index 81e06ffe..15599088 100644 --- a/ui/components/NotificationForm.vue +++ b/ui/components/NotificationForm.vue @@ -351,7 +351,7 @@ const importItem = async () => { } if (form.target) { - if (false === box.confirm('This will overwrite the current form fields. Are you sure?', true)) { + if (false === box.confirm('Overwrite the current form fields?', true)) { return } } diff --git a/ui/components/Queue.vue b/ui/components/Queue.vue index ce62eaaa..75ccf661 100644 --- a/ui/components/Queue.vue +++ b/ui/components/Queue.vue @@ -523,7 +523,7 @@ const updateProgress = (item) => { } const confirmCancel = item => { - if (true !== box.confirm(`Are you sure you want to cancel (${item.title})?`)) { + if (true !== box.confirm(`Cancel '${item.title}'?`)) { return false } cancelItems(item._id) @@ -531,7 +531,7 @@ const confirmCancel = item => { } const cancelSelected = () => { - if (true !== box.confirm('Are you sure you want to cancel selected items?')) { + if (true !== box.confirm(`Cancel '${selectedElms.value.length}' selected items?`)) { return false; } cancelItems(selectedElms.value) diff --git a/ui/components/TaskForm.vue b/ui/components/TaskForm.vue index 9b540c9a..bb7463d0 100644 --- a/ui/components/TaskForm.vue +++ b/ui/components/TaskForm.vue @@ -387,7 +387,7 @@ const importItem = async () => { } if (form.url || form.timer) { - if (false === box.confirm('This will overwrite the current form fields. Are you sure?', true)) { + if (false === box.confirm('Overwrite the current form fields?', true)) { return } } diff --git a/ui/pages/index.vue b/ui/pages/index.vue index 72f005fd..9e5d5e27 100644 --- a/ui/pages/index.vue +++ b/ui/pages/index.vue @@ -66,7 +66,7 @@ @@ -75,6 +75,7 @@ From dfe1acbec438bf8331bf77b75cf7d9242ca9bc04 Mon Sep 17 00:00:00 2001 From: arabcoders Date: Fri, 11 Jul 2025 19:46:41 +0300 Subject: [PATCH 6/6] minor design update --- ui/components/FloatingImage.vue | 82 ++++++++++----------- ui/components/GetInfo.vue | 72 ++++++++---------- ui/components/LateLoader.vue | 125 ++++++++++++++++---------------- ui/components/Message.vue | 82 ++++++++------------- ui/components/NewDownload.vue | 70 ++++++------------ ui/components/Settings.vue | 43 ++++++----- ui/pages/index.vue | 42 ++++++++--- ui/utils/utils.ts | 23 +++++- 8 files changed, 265 insertions(+), 274 deletions(-) diff --git a/ui/components/FloatingImage.vue b/ui/components/FloatingImage.vue index 2c346b57..ff49e122 100644 --- a/ui/components/FloatingImage.vue +++ b/ui/components/FloatingImage.vue @@ -19,40 +19,32 @@ - diff --git a/ui/components/GetInfo.vue b/ui/components/GetInfo.vue index d1dccd20..4dee4779 100644 --- a/ui/components/GetInfo.vue +++ b/ui/components/GetInfo.vue @@ -1,3 +1,9 @@ + + - diff --git a/ui/components/LateLoader.vue b/ui/components/LateLoader.vue index f3921e86..337494f7 100644 --- a/ui/components/LateLoader.vue +++ b/ui/components/LateLoader.vue @@ -1,76 +1,77 @@ - diff --git a/ui/components/Message.vue b/ui/components/Message.vue index 4209ce2d..ff4293be 100644 --- a/ui/components/Message.vue +++ b/ui/components/Message.vue @@ -1,67 +1,45 @@ - diff --git a/ui/pages/index.vue b/ui/pages/index.vue index 9e5d5e27..af30088a 100644 --- a/ui/pages/index.vue +++ b/ui/pages/index.vue @@ -18,27 +18,28 @@

-

-

-

@@ -47,6 +48,7 @@ @click="() => changeDisplay()"> + {{ display_style === 'cards' ? 'Cards' : 'List' }}

@@ -70,6 +72,9 @@ @getItemInfo="(id: string) => view_info(`/api/history/${id}`, true)" @clear_search="query = ''" /> + @@ -91,9 +96,16 @@ const info_view = ref({ preset: '', useUrl: false, }) as Ref<{ url: string, preset: string, useUrl: boolean }> -const item_form = ref({}) +const item_form = ref({}) const query = ref() const toggleFilter = ref(false) +const dialog_confirm = ref({ + visible: false, + title: 'Confirm Action', + confirm: () => { }, + html_message: '', + options: [], +}) watch(toggleFilter, () => { if (!toggleFilter.value) { @@ -123,12 +135,18 @@ watch(() => stateStore.queue, () => { useHead({ title: `YTPTube: ( ${Object.keys(stateStore.queue).length || 0}/${config.app.max_workers} | ${Object.keys(stateStore.history).length || 0} )` }) }, { deep: true }) -const pauseDownload = () => { - if (false === box.confirm('Pause all non-active downloads?')) { - return false - } - socket.emit('pause', {}) +const pauseDownload = () => { + dialog_confirm.value.visible = true + dialog_confirm.value.html_message = `Pause All non-active downloads?
+ + + This will not stop downloads that are currently in progress. + ` + dialog_confirm.value.confirm = () => { + socket.emit('pause', {}) + dialog_confirm.value.visible = false + } } const close_info = () => { diff --git a/ui/utils/utils.ts b/ui/utils/utils.ts index e873864d..5a840bba 100644 --- a/ui/utils/utils.ts +++ b/ui/utils/utils.ts @@ -1,5 +1,26 @@ import type { convert_args_response } from "~/@types/responses"; +const separators = [ + { name: 'Comma', value: ',', }, + { name: 'Semicolon', value: ';', }, + { name: 'Colon', value: ':', }, + { name: 'Pipe', value: '|', }, + { name: 'Space', value: ' ', } +] + +/** + * Get the name of a separator based on its value + * + * @param {string} value - The separator value + * + * @returns {string} The name of the separator, or 'Unknown' if not found + */ +const getSeparatorsName = (value: string): string => { + const sep = separators.find(s => s.value === value) + return sep ? `${sep.name} (${value})` : 'Unknown' +} + + /** * Convert options to JSON * @@ -21,4 +42,4 @@ const convertCliOptions = async (opts: string): Promise = return data } -export { convertCliOptions } +export { convertCliOptions, separators, getSeparatorsName }