diff --git a/ui/components/NewDownload.vue b/ui/components/NewDownload.vue new file mode 100644 index 00000000..7ca8c00c --- /dev/null +++ b/ui/components/NewDownload.vue @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + Preset + + + + + + {{ item.text }} + + + + + + + + + + Download Path + + + + + + + + + + + + Add Link + + + + + + + + + + + + + + + Output Format + + + + + + All format options can be found at this page. + + + + + + + JSON yt-dlp config + + + + + + Some config fields are ignored like cookiefile, path, and output_format etc. + Available option can be found at this + page. + + + + + + + yt-dlp Cookies + + + + + + Use something like flagCookies + to extract cookies as JSON string. + + + + + + + + + + + Reset Local Configuration + + + + + + + + + + + + + + diff --git a/ui/layouts/default.vue b/ui/layouts/default.vue index 8dc6e6dd..a6f7abdb 100644 --- a/ui/layouts/default.vue +++ b/ui/layouts/default.vue @@ -1,5 +1,5 @@ - + @@ -20,15 +20,44 @@ - + + + + + + + + Console + + + + + + + Add + + + + + + + + + Tasks + + + + v-tooltip="'Switch to light theme'"> + v-tooltip="'Switch to dark theme'"> @@ -56,24 +85,25 @@ - + diff --git a/ui/pages/index.vue b/ui/pages/index.vue index 7a3fee60..95522b1c 100644 --- a/ui/pages/index.vue +++ b/ui/pages/index.vue @@ -1,5 +1,6 @@ + @@ -15,13 +16,24 @@ const config = useConfigStore() const runtimeConfig = useRuntimeConfig() const socket = ref() -const downloading = reactive({}) const cli_output = ref([]) const cli_isLoading = ref(false) const stateStore = useStateStore() -useHead({ title: 'Index' }) +bus.on((event, data) => { + console.log({ e: event, d: data }) + if (!['show_form'].includes(event)) { + return true; + } + + if ('show_form' === event) { + addForm.value = true; + setTimeout(() => bus.emit('task_edit', data), 500); + } +}) + +useHead({ title: 'Index' }) onMounted(() => { socket.value = io(runtimeConfig.public.wss, { path: document.location.pathname + 'socket.io', @@ -45,7 +57,7 @@ onMounted(() => { socket.value.on('added', stream => { const item = JSON.parse(stream); stateStore.add('queue', item); - toast.success(`Item queued successfully: ${downloading[item._id]?.title}`); + toast.success(`Item queued successfully: ${stateStore.get('queue', item._id)?.title}`); }); socket.value.on('error', stream => { @@ -69,8 +81,11 @@ onMounted(() => { return } - toast.info('Download canceled: ' + downloading[id]?.title); - delete downloading[id]; + toast.info('Download canceled: ' + stateStore.get('queue', id)?.title); + + if (true === stateStore.has('queue', id)) { + stateStore.remove('queue', id); + } }); socket.value.on('cleared', stream => { @@ -99,4 +114,6 @@ onMounted(() => { socket.value.on('cli_close', () => cli_isLoading.value = false); socket.value.on('cli_output', s => cli_output.value.push(s)); }); + + diff --git a/ui/store/ConfigStore.js b/ui/store/ConfigStore.js index 162e12b8..8c5f66d4 100644 --- a/ui/store/ConfigStore.js +++ b/ui/store/ConfigStore.js @@ -2,6 +2,9 @@ import { defineStore } from 'pinia'; const CONFIG_KEYS = { isConnected: false, + showForm: false, + showConsole: false, + showTasks: false, tasks: [], app: { host: '',