diff --git a/app/Utils.py b/app/Utils.py
index 4448896e..866e6965 100644
--- a/app/Utils.py
+++ b/app/Utils.py
@@ -342,6 +342,9 @@ class Notifier:
async def error(self, dl: dict, message: str):
await self.emit('error', (dl, message))
+ async def warning(self, message: str):
+ await self.emit('error', message)
+
async def emit(self, event: str, data):
tasks = []
tasks.append(self.sio.emit(event, self.serializer.encode(data)))
diff --git a/app/main.py b/app/main.py
index d7c41959..aa82ff2f 100644
--- a/app/main.py
+++ b/app/main.py
@@ -688,6 +688,49 @@ class Main:
})
await self.sio.emit('cli_close', {'exitcode': -1})
+ @self.sio.event()
+ async def add_url(sid, post: dict):
+ url: str = post.get('url')
+ quality: str = post.get('quality')
+
+ if not url:
+ self.notifier.warning('No URL provided.')
+ return
+
+ format: str = post.get('format')
+ folder: str = post.get('folder')
+ ytdlp_cookies: str = post.get('ytdlp_cookies')
+ ytdlp_config: dict = post.get('ytdlp_config')
+ output_template: str = post.get('output_template')
+ if ytdlp_config is None:
+ ytdlp_config = {}
+
+ status = await self.add(
+ url=url,
+ quality=quality,
+ format=format,
+ folder=folder,
+ ytdlp_cookies=ytdlp_cookies,
+ ytdlp_config=ytdlp_config,
+ output_template=output_template
+ )
+ await self.sio.emit('status', self.serializer.encode(status))
+
+ @self.sio.event
+ async def cancel_items(sid, post: dict):
+ ids = post.get('ids')
+ identifier: str = post.get('identifier')
+
+ if not ids:
+ await self.notifier.warning('Invalid request.')
+ return
+
+ status: dict[str, str] = {}
+ status = await self.queue.cancel(ids)
+ status.update({'identifier': identifier})
+
+ await self.sio.emit('cancel_items', self.serializer.encode(status))
+
@self.sio.event()
async def archive_item(sid, data):
if not isinstance(data, dict) or 'url' not in data or not self.config.keep_archive:
diff --git a/ui/assets/css/style.css b/ui/assets/css/style.css
index 63c2ed20..4492540d 100644
--- a/ui/assets/css/style.css
+++ b/ui/assets/css/style.css
@@ -188,3 +188,22 @@ hr {
background-color: #087363;
}
}
+
+.vue-notification {
+ background: unset;
+ border-left: none;
+}
+
+.notification-title {
+ font-size: 1.5em;
+ font-weight: bold;
+}
+
+.notification-content {
+ font-size: 1.2em;
+}
+
+.vue-notification-wrapper {
+ cursor: pointer;
+ padding-top: 0.5em;
+}
diff --git a/ui/components/Queue.vue b/ui/components/Queue.vue
index f1f935b7..2edcacc7 100644
--- a/ui/components/Queue.vue
+++ b/ui/components/Queue.vue
@@ -4,7 +4,7 @@
- Queue ({{ getTotal }})
+ Queue ({{ stateStore.count('queue') }})
@@ -35,7 +35,7 @@
-
@@ -76,7 +76,7 @@
-