feat(qbittorrent): add configurable server-side sort order as widget option

This commit is contained in:
Thomas Camlong committed 2026-07-15 16:51:48 +02:00
1 parent 9ced0ab7d0
commit 064d1842de
7 files changed
+84 -8

No files matched your search

@@ -27,10 +27,18 @@ export class QBitTorrentIntegration extends Integration implements IDownloadClie
};
}
public async getClientJobsAndStatusAsync(input: { limit: number }): Promise<DownloadClientJobsAndStatus> {
public async getClientJobsAndStatusAsync(input: {
limit: number;
qbittorrentSort?: string;
qbittorrentSortReverse?: boolean;
}): Promise<DownloadClientJobsAndStatus> {
const type = "torrent";
const client = await this.getClientAsync();
const torrents = await client.listTorrents({ limit: input.limit });
const torrents = await client.listTorrents({
limit: input.limit,
sort: input.qbittorrentSort,
reverse: input.qbittorrentSortReverse,
});
const rates = torrents.reduce(
({ down, up }, { dlspeed, upspeed }) => ({ down: down + dlspeed, up: up + upspeed }),
{ down: 0, up: 0 },
@@ -3,7 +3,11 @@ import type { DownloadClientItem } from "./download-client-items";
export interface IDownloadClientIntegration {
/** Get download client's status and list of all of it's items */
getClientJobsAndStatusAsync(input: { limit: number }): Promise<DownloadClientJobsAndStatus>;
getClientJobsAndStatusAsync(input: {
limit: number;
qbittorrentSort?: string;
qbittorrentSortReverse?: boolean;
}): Promise<DownloadClientJobsAndStatus>;
/** Pauses the client or all of it's items */
pauseQueueAsync(): Promise<void>;
/** Pause a single item using it's ID */