Use download_token for file dl links
This commit is contained in:
parent
3de379d742
commit
6e059bf7c5
|
@ -28,7 +28,7 @@ import selectTorrent, {
|
||||||
import { updateResource } from '../actions/resources';
|
import { updateResource } from '../actions/resources';
|
||||||
import { formatBitrate } from '../bitrate';
|
import { formatBitrate } from '../bitrate';
|
||||||
|
|
||||||
const dlURI = (uri, password, id) => `${uri.replace('ws', 'http')}/dl/${id}?password=${encodeURIComponent(password)}`;
|
const dlURI = (uri, token, id) => `${uri.replace('ws', 'http')}/dl/${id}?password=${encodeURIComponent(token)}`;
|
||||||
|
|
||||||
function basename(path) {
|
function basename(path) {
|
||||||
const parts = path.split("/");
|
const parts = path.split("/");
|
||||||
|
@ -36,7 +36,8 @@ function basename(path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function File({ dispatch, file }) {
|
function File({ dispatch, file }) {
|
||||||
const { uri, password } = store.getState().socket;
|
const { uri } = store.getState().socket;
|
||||||
|
const { download_token } = store.getState().server;
|
||||||
return (
|
return (
|
||||||
<div className="file">
|
<div className="file">
|
||||||
<Progress
|
<Progress
|
||||||
|
@ -48,7 +49,7 @@ function File({ dispatch, file }) {
|
||||||
</Progress>
|
</Progress>
|
||||||
<div className="path" title={file.path}>
|
<div className="path" title={file.path}>
|
||||||
{file.progress === 1.0 ?
|
{file.progress === 1.0 ?
|
||||||
<a href={dlURI(uri, password, file.id)} target="_new">
|
<a href={dlURI(uri, download_token, file.id)} target="_new">
|
||||||
{basename(file.path)}
|
{basename(file.path)}
|
||||||
</a> : basename(file.path)}
|
</a> : basename(file.path)}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user