From 47484c2d35d1e31f11385c690259f393267e0016 Mon Sep 17 00:00:00 2001 From: arabcoders Date: Thu, 19 Jun 2025 20:40:51 +0300 Subject: [PATCH 1/4] make datastore.get key optional. --- app/library/DataStore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/library/DataStore.py b/app/library/DataStore.py index 96c64a3d..691f034f 100644 --- a/app/library/DataStore.py +++ b/app/library/DataStore.py @@ -46,7 +46,7 @@ class DataStore: return any((key and self.dict[i].info._id == key) or (url and self.dict[i].info.url == url) for i in self.dict) - def get(self, key: str, url: str | None = None) -> Download: + def get(self, key: str | None = None, url: str | None = None) -> Download: if not key and not url: msg = "key or url must be provided." raise KeyError(msg) From c4b8bf51d5c4767d10f03b5e562316b019a01378 Mon Sep 17 00:00:00 2001 From: arabcoders Date: Thu, 19 Jun 2025 23:07:29 +0300 Subject: [PATCH 2/4] Fix sio disconnect event --- app/library/HttpSocket.py | 4 +++- app/routes/socket/connection.py | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/library/HttpSocket.py b/app/library/HttpSocket.py index 190221ec..988608de 100644 --- a/app/library/HttpSocket.py +++ b/app/library/HttpSocket.py @@ -117,7 +117,9 @@ class HttpSocket: @staticmethod def _injector(func, event: str): - async def wrapper(sid, data, **kwargs): + async def wrapper(sid, data=None, **kwargs): + if not data: + data = {} return await Services.get_instance().handle_async(func, sid=sid, data=data, event=event, **kwargs) return wrapper diff --git a/app/routes/socket/connection.py b/app/routes/socket/connection.py index d1d49f9e..7977fe06 100644 --- a/app/routes/socket/connection.py +++ b/app/routes/socket/connection.py @@ -34,11 +34,12 @@ async def connect(config: Config, queue: DownloadQueue, notify: EventBus, sid: s @route(RouteType.SOCKET, "disconnect", "socket_disconnect") -async def disconnect(sid: str, data: str = None): +async def disconnect(sio: socketio.AsyncServer, sid: str, data: str = None): """ Handle client disconnection. Args: + sio (socketio.AsyncServer): The Socket.IO server instance. sid (str): The session ID of the client. data (str): The reason for disconnection. @@ -47,7 +48,7 @@ async def disconnect(sid: str, data: str = None): for event in _Data.subscribers: if sid in _Data.subscribers[event]: - await unsubscribe(sid=sid, data=event) + await unsubscribe(sio=sio, sid=sid, data=event) @route(RouteType.SOCKET, "subscribe", "socket_subscribe") From e02fedfe39be46242ad3e9953b4fa79293cee0be Mon Sep 17 00:00:00 2001 From: arabcoders Date: Fri, 20 Jun 2025 00:21:02 +0300 Subject: [PATCH 3/4] Improve tasks page for mass operations. --- ui/components/ConfirmDialog.vue | 7 +- ui/pages/tasks.vue | 232 ++++++++++++++++++++++++++++++-- ui/utils/index.js | 3 + 3 files changed, 229 insertions(+), 13 deletions(-) diff --git a/ui/components/ConfirmDialog.vue b/ui/components/ConfirmDialog.vue index 19998c26..04f2afe6 100644 --- a/ui/components/ConfirmDialog.vue +++ b/ui/components/ConfirmDialog.vue @@ -8,7 +8,8 @@