update URL for streams
This commit is contained in:
parent
da3e199c91
commit
ea2dfd0500
7 changed files with 25 additions and 8 deletions
|
|
@ -166,7 +166,11 @@ export interface RqbitAPI {
|
|||
listTorrents: () => Promise<ListTorrentsResponse>;
|
||||
getTorrentDetails: (index: number) => Promise<TorrentDetails>;
|
||||
getTorrentStats: (index: number) => Promise<TorrentStats>;
|
||||
getTorrentStreamUrl: (index: number, file_id: number) => string | null;
|
||||
getTorrentStreamUrl: (
|
||||
index: number,
|
||||
file_id: number,
|
||||
filename?: string | null,
|
||||
) => string | null;
|
||||
uploadTorrent: (
|
||||
data: string | File,
|
||||
opts?: AddTorrentOptions,
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ const FileTreeComponent: React.FC<{
|
|||
torrentId != null &&
|
||||
/\.(mp4|mkv|avi)$/.test(file.filename)
|
||||
) {
|
||||
return API.getTorrentStreamUrl(torrentId, file.id);
|
||||
return API.getTorrentStreamUrl(torrentId, file.id, file.filename);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,15 @@ export const API: RqbitAPI & { getVersion: () => Promise<string> } = {
|
|||
const r = await makeRequest("GET", "/");
|
||||
return r.version;
|
||||
},
|
||||
getTorrentStreamUrl: (index: number, file_id: number) => {
|
||||
return apiUrl + `/torrents/${index}/stream/${file_id}`;
|
||||
getTorrentStreamUrl: (
|
||||
index: number,
|
||||
file_id: number,
|
||||
filename?: string | null,
|
||||
) => {
|
||||
let url = apiUrl + `/torrents/${index}/stream/${file_id}`;
|
||||
if (!!filename) {
|
||||
url += `/${filename}`;
|
||||
}
|
||||
return url;
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue