diff --git a/app/routes/api/history.py b/app/routes/api/history.py index 1255f9fe..31d57015 100644 --- a/app/routes/api/history.py +++ b/app/routes/api/history.py @@ -1,6 +1,6 @@ import asyncio import logging -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Any from aiohttp import web from aiohttp.web import Request, Response @@ -375,15 +375,18 @@ async def items_add(request: Request, queue: DownloadQueue, encoder: Encoder) -> except ValueError as e: return web.json_response(data={"error": str(e), "data": item}, status=web.HTTPBadRequest.status_code) - status: list = await asyncio.wait_for( + status: list[dict] = await asyncio.wait_for( fut=asyncio.gather(*[queue.add(item=item) for item in items]), timeout=None, ) - response: list = [] + response: list[dict[str, Any]] = [] for i, item in enumerate(items): - response.append({"item": item, "status": "ok" == status[i].get("status"), "msg": status[i].get("msg")}) + it = {"item": item, "status": "ok" == status[i].get("status"), "msg": status[i].get("msg")} + if status[i].get("hidden"): + it["hidden"] = True + response.append(it) return web.json_response(data=response, status=web.HTTPOk.status_code, dumps=encoder.encode) diff --git a/ui/app/components/NewDownload.vue b/ui/app/components/NewDownload.vue index 7976d408..75af3ad7 100644 --- a/ui/app/components/NewDownload.vue +++ b/ui/app/components/NewDownload.vue @@ -9,7 +9,7 @@ URLs separated by newlines or {{ getSeparatorsName(separator) - }} + }}
@@ -474,8 +474,14 @@ const addDownload = async () => { if (false !== item.status) { return } - toast.error(`Error: ${item.msg || 'Failed to add download.'}`) + had_errors = true + + if (item?.hidden) { + return + } + + toast.error(`Error: ${item.msg || 'Failed to add download.'}`) }) if (false === had_errors) {