update URL for streams
This commit is contained in:
parent
da3e199c91
commit
ea2dfd0500
7 changed files with 25 additions and 8 deletions
1
TODO.md
1
TODO.md
|
|
@ -97,3 +97,4 @@ Streaming:
|
|||
Other:
|
||||
|
||||
- [ ] keepalive is useless, the tieout is 120s, and read timeout is 10s. Need to send keepalive only if nothing was done recently.
|
||||
- [x] url should have the filename
|
||||
|
|
|
|||
|
|
@ -281,7 +281,11 @@ impl HttpApi {
|
|||
.route("/torrents/:id/stats", get(torrent_stats_v0))
|
||||
.route("/torrents/:id/stats/v1", get(torrent_stats_v1))
|
||||
.route("/torrents/:id/peer_stats", get(peer_stats))
|
||||
.route("/torrents/:id/stream/:file_id", get(torrent_stream_file));
|
||||
.route("/torrents/:id/stream/:file_id", get(torrent_stream_file))
|
||||
.route(
|
||||
"/torrents/:id/stream/:file_id/*filename",
|
||||
get(torrent_stream_file),
|
||||
);
|
||||
|
||||
if !self.opts.read_only {
|
||||
app = app
|
||||
|
|
|
|||
4
crates/librqbit/webui/dist/assets/index.js
vendored
4
crates/librqbit/webui/dist/assets/index.js
vendored
File diff suppressed because one or more lines are too long
2
crates/librqbit/webui/dist/manifest.json
vendored
2
crates/librqbit/webui/dist/manifest.json
vendored
|
|
@ -11,7 +11,7 @@
|
|||
"css": [
|
||||
"assets/index-74bd798d.css"
|
||||
],
|
||||
"file": "assets/index-80d6e7c6.js",
|
||||
"file": "assets/index-fcae4638.js",
|
||||
"isEntry": true,
|
||||
"src": "index.html"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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