mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-05 21:15:47 +01:00
🐛 Crash with no default value for reduce
This commit is contained in:
@@ -2,20 +2,26 @@ import { Deluge } from '@ctrl/deluge';
|
|||||||
import { QBittorrent } from '@ctrl/qbittorrent';
|
import { QBittorrent } from '@ctrl/qbittorrent';
|
||||||
import { Transmission } from '@ctrl/transmission';
|
import { Transmission } from '@ctrl/transmission';
|
||||||
import { AllClientData } from '@ctrl/shared-torrent';
|
import { AllClientData } from '@ctrl/shared-torrent';
|
||||||
|
|
||||||
import Consola from 'consola';
|
import Consola from 'consola';
|
||||||
|
|
||||||
import { getCookie } from 'cookies-next';
|
import { getCookie } from 'cookies-next';
|
||||||
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { NextApiRequest, NextApiResponse } from 'next';
|
import { NextApiRequest, NextApiResponse } from 'next';
|
||||||
|
|
||||||
import { Client } from 'sabnzbd-api';
|
import { Client } from 'sabnzbd-api';
|
||||||
|
|
||||||
|
import { NzbgetClient } from '../usenet/nzbget/nzbget-client';
|
||||||
|
import { NzbgetQueueItem, NzbgetStatus } from '../usenet/nzbget/types';
|
||||||
|
import { ConfigAppType, IntegrationField } from '../../../../types/app';
|
||||||
import { getConfig } from '../../../../tools/config/getConfig';
|
import { getConfig } from '../../../../tools/config/getConfig';
|
||||||
|
import { UsenetQueueItem } from '../../../../widgets/useNet/types';
|
||||||
import {
|
import {
|
||||||
NormalizedDownloadAppStat,
|
NormalizedDownloadAppStat,
|
||||||
NormalizedDownloadQueueResponse,
|
NormalizedDownloadQueueResponse,
|
||||||
} from '../../../../types/api/downloads/queue/NormalizedDownloadQueueResponse';
|
} from '../../../../types/api/downloads/queue/NormalizedDownloadQueueResponse';
|
||||||
import { ConfigAppType, IntegrationField } from '../../../../types/app';
|
|
||||||
import { UsenetQueueItem } from '../../../../widgets/useNet/types';
|
|
||||||
import { NzbgetClient } from '../usenet/nzbget/nzbget-client';
|
|
||||||
import { NzbgetQueueItem, NzbgetStatus } from '../usenet/nzbget/types';
|
|
||||||
|
|
||||||
const Get = async (request: NextApiRequest, response: NextApiResponse) => {
|
const Get = async (request: NextApiRequest, response: NextApiResponse) => {
|
||||||
const configName = getCookie('config-name', { req: request });
|
const configName = getCookie('config-name', { req: request });
|
||||||
@@ -71,10 +77,10 @@ const GetDataFromClient = async (
|
|||||||
torrents: data.torrents,
|
torrents: data.torrents,
|
||||||
totalDownload: data.torrents
|
totalDownload: data.torrents
|
||||||
.map((torrent) => torrent.downloadSpeed)
|
.map((torrent) => torrent.downloadSpeed)
|
||||||
.reduce((acc, torrent) => acc + torrent),
|
.reduce((acc, torrent) => acc + torrent, 0),
|
||||||
totalUpload: data.torrents
|
totalUpload: data.torrents
|
||||||
.map((torrent) => torrent.uploadSpeed)
|
.map((torrent) => torrent.uploadSpeed)
|
||||||
.reduce((acc, torrent) => acc + torrent),
|
.reduce((acc, torrent) => acc + torrent, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
const findField = (app: ConfigAppType, field: IntegrationField) =>
|
const findField = (app: ConfigAppType, field: IntegrationField) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user