Add global stats to UI (not desktop yet)

This commit is contained in:
Igor Katson 2024-08-21 12:58:15 +01:00
parent ae606fac4a
commit 61b7a643aa
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
6 changed files with 89 additions and 11 deletions

View file

@ -3,6 +3,7 @@ import {
ErrorDetails,
ListTorrentsResponse,
RqbitAPI,
SessionStats,
TorrentDetails,
TorrentStats,
} from "./api-types";
@ -82,6 +83,9 @@ export const API: RqbitAPI & { getVersion: () => Promise<string> } = {
getTorrentStats: (index: number): Promise<TorrentStats> => {
return makeRequest("GET", `/torrents/${index}/stats/v1`);
},
stats: (): Promise<SessionStats> => {
return makeRequest("GET", "/stats");
},
uploadTorrent: (data, opts): Promise<AddTorrentResponse> => {
let url = "/torrents?&overwrite=true";
@ -152,6 +156,6 @@ export const API: RqbitAPI & { getVersion: () => Promise<string> } = {
return url;
},
getPlaylistUrl: (index: number) => {
return (apiUrl || window.origin) + `/torrents/${index}/playlist`;
return (apiUrl || window.origin) + `/torrents/${index}/playlist`;
},
};