Pass back peers from Web UI when adding a magnet in attempt to speed it up

This commit is contained in:
Igor Katson 2023-12-01 09:30:23 +00:00
parent 21b1bd9e7d
commit f337ab1837
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
8 changed files with 77 additions and 27 deletions

View file

@ -22,6 +22,7 @@ export interface TorrentDetails {
export interface AddTorrentResponse {
id: number | null;
details: TorrentDetails;
seen_peers?: Array<string>;
}
export interface ListTorrentsResponse {
@ -147,7 +148,10 @@ export const API = {
},
uploadTorrent: (data: string | File, opts?: {
listOnly?: boolean, selectedFiles?: Array<number>, unpopularTorrent?: boolean,
listOnly?: boolean,
selectedFiles?: Array<number>,
unpopularTorrent?: boolean,
initialPeers?: Array<string>,
}): Promise<AddTorrentResponse> => {
opts = opts || {};
let url = '/torrents?&overwrite=true';
@ -160,6 +164,9 @@ export const API = {
if (opts.unpopularTorrent) {
url += '&peer_connect_timeout=20&peer_read_write_timeout=60';
}
if (opts.initialPeers) {
url += `&initial_peers=${opts.initialPeers.join(',')}`;
}
return makeRequest('POST', url, data)
},