A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.
perf(downloads): bound Transmission and Deluge item mapping (#7095)
Riccardoad15cfc3bf39
diff --git a/packages/integrations/src/download-client/deluge/deluge-integration.ts b/packages/integrations/src/download-client/deluge/deluge-integration.tsindex ded087724..a4a0c12d4 100644--- a/packages/integrations/src/download-client/deluge/deluge-integration.ts+++ b/packages/integrations/src/download-client/deluge/deluge-integration.ts@@ -76,29 +76,27 @@ export class DelugeIntegration extends Integration implements IDownloadClientInt},types: [type],};- const items = torrents- .map((torrent): DownloadClientItem => {- const state = DelugeIntegration.getTorrentState(torrent.state);- return {- type,- id: torrent.id,- index: torrent.queue,- name: torrent.name,- size: torrent.total_wanted,- sent: torrent.total_uploaded,- downSpeed: torrent.progress !== 100 ? torrent.download_payload_rate : undefined,- upSpeed: torrent.upload_payload_rate,- time:- torrent.progress === 100- ? Math.min((torrent.completed_time - dayjs().unix()) * 1000, -1)- : Math.max(torrent.eta * 1000, 0),- added: torrent.time_added * 1000,- state,- progress: torrent.progress / 100,- category: torrent.label,- };- })- .slice(0, input.limit);+ const items = torrents.slice(0, input.limit).map((torrent): DownloadClientItem => {+ const state = DelugeIntegration.getTorrentState(torrent.state);+ return {+ type,+ id: torrent.id,+ index: torrent.queue,+ name: torrent.name,+ size: torrent.total_wanted,+ sent: torrent.total_uploaded,+ downSpeed: torrent.progress !== 100 ? torrent.download_payload_rate : undefined,+ upSpeed: torrent.upload_payload_rate,+ time:+ torrent.progress === 100+ ? Math.min((torrent.completed_time - dayjs().unix()) * 1000, -1)+ : Math.max(torrent.eta * 1000, 0),+ added: torrent.time_added * 1000,+ state,+ progress: torrent.progress / 100,+ category: torrent.label,+ };+ });return { status, items };}diff --git a/packages/integrations/src/download-client/transmission/transmission-integration.ts b/packages/integrations/src/download-client/transmission/transmission-integration.tsindex 7b579b1bc..a1cd56ad0 100644--- a/packages/integrations/src/download-client/transmission/transmission-integration.ts+++ b/packages/integrations/src/download-client/transmission/transmission-integration.ts@@ -36,30 +36,28 @@ export class TransmissionIntegration extends Integration implements IDownloadCliconst paused =torrents.find(({ status }) => TransmissionIntegration.getTorrentState(status) !== "paused") === undefined;const status: DownloadClientStatus = { paused, rates, types: [type] };- const items = torrents- .map((torrent): DownloadClientItem => {- const state = TransmissionIntegration.getTorrentState(torrent.status);- return {- type,- id: torrent.hashString,- index: torrent.queuePosition,- name: torrent.name,- size: torrent.totalSize,- sent: torrent.uploadedEver,- received: torrent.downloadedEver,- downSpeed: torrent.percentDone !== 1 ? torrent.rateDownload : undefined,- upSpeed: torrent.rateUpload,- time:- torrent.percentDone === 1- ? Math.min(torrent.doneDate * 1000 - dayjs().valueOf(), -1)- : Math.max(torrent.eta * 1000, 0),- added: torrent.addedDate * 1000,- state,- progress: torrent.percentDone,- category: torrent.labels,- };- })- .slice(0, input.limit);+ const items = torrents.slice(0, input.limit).map((torrent): DownloadClientItem => {+ const state = TransmissionIntegration.getTorrentState(torrent.status);+ return {+ type,+ id: torrent.hashString,+ index: torrent.queuePosition,+ name: torrent.name,+ size: torrent.totalSize,+ sent: torrent.uploadedEver,+ received: torrent.downloadedEver,+ downSpeed: torrent.percentDone !== 1 ? torrent.rateDownload : undefined,+ upSpeed: torrent.rateUpload,+ time:+ torrent.percentDone === 1+ ? Math.min(torrent.doneDate * 1000 - dayjs().valueOf(), -1)+ : Math.max(torrent.eta * 1000, 0),+ added: torrent.addedDate * 1000,+ state,+ progress: torrent.percentDone,+ category: torrent.labels,+ };+ });return { status, items };}