diff --git a/docs/widgets/services/deluge.md b/docs/widgets/services/deluge.md index 817ae8310..8b925a9af 100644 --- a/docs/widgets/services/deluge.md +++ b/docs/widgets/services/deluge.md @@ -14,4 +14,5 @@ widget: type: deluge url: http://deluge.host.or.ip password: password # webui password + enableLeechProgress: true # optional, defaults to false ``` diff --git a/src/utils/config/service-helpers.js b/src/utils/config/service-helpers.js index 1c37ad492..ad8742901 100644 --- a/src/utils/config/service-helpers.js +++ b/src/utils/config/service-helpers.js @@ -402,6 +402,9 @@ export function cleanServiceGroups(groups) { mappings, display, + // deluge, qbittorrent + enableLeechProgress, + // diskstation volume, @@ -479,9 +482,6 @@ export function cleanServiceGroups(groups) { // proxmox node, - // qbittorrent - enableLeechProgress, - // speedtest bitratePrecision, @@ -572,6 +572,9 @@ export function cleanServiceGroups(groups) { if (allowScrolling) widget.allowScrolling = allowScrolling; if (refreshInterval) widget.refreshInterval = refreshInterval; } + if (["deluge", "qbittorrent"].includes(type)) { + if (enableLeechProgress !== undefined) widget.enableLeechProgress = JSON.parse(enableLeechProgress); + } if (["opnsense", "pfsense"].includes(type)) { if (wan) widget.wan = wan; } @@ -674,9 +677,6 @@ export function cleanServiceGroups(groups) { if (type === "spoolman") { if (spoolIds !== undefined) widget.spoolIds = spoolIds; } - if (type === "qbittorrent") { - if (enableLeechProgress !== undefined) widget.enableLeechProgress = JSON.parse(enableLeechProgress); - } return widget; }); return cleanedService; diff --git a/src/widgets/deluge/component.jsx b/src/widgets/deluge/component.jsx index 0d7190d47..231f69ab7 100644 --- a/src/widgets/deluge/component.jsx +++ b/src/widgets/deluge/component.jsx @@ -1,5 +1,7 @@ import { useTranslation } from "next-i18next"; +import QueueEntry from "../../components/widgets/queue/queueEntry"; + import Container from "components/services/widget/container"; import Block from "components/services/widget/block"; import useWidgetAPI from "utils/proxy/use-widget-api"; @@ -32,21 +34,38 @@ export default function Component({ service }) { let rateDl = 0; let rateUl = 0; let completed = 0; + const leechTorrents = []; + for (let i = 0; i < keys.length; i += 1) { const torrent = torrents[keys[i]]; rateDl += torrent.download_payload_rate; rateUl += torrent.upload_payload_rate; completed += torrent.total_remaining === 0 ? 1 : 0; + if (torrent.state === "Downloading") { + leechTorrents.push(torrent); + } } const leech = keys.length - completed || 0; return ( - - - - - - + <> + + + + + + + {widget?.enableLeechProgress && + leechTorrents.map((queueEntry) => ( + + ))} + ); } diff --git a/src/widgets/deluge/proxy.js b/src/widgets/deluge/proxy.js index 613296978..0430a6ac8 100644 --- a/src/widgets/deluge/proxy.js +++ b/src/widgets/deluge/proxy.js @@ -17,6 +17,7 @@ const dataParams = [ "download_payload_rate", "upload_payload_rate", "total_remaining", + "eta", ], {}, ];