API: torrents: remove useless isMultiFile property

It is only used to determine whether to use .tar extension when
download is requested. However, server sent Content-Disposition
header which already tells the browser the filename and it is
more accurate.

As such, remove this useless property.
This commit is contained in:
Jesse Chan
2020-11-03 18:12:31 +08:00
parent 3040304ef4
commit 29c6fbeb3b
5 changed files with 7 additions and 15 deletions
@@ -55,19 +55,14 @@ class TorrentContents extends React.Component<WrappedComponentProps> {
event.preventDefault();
const {baseURI} = ConfigStore;
const link = document.createElement('a');
const {name} = TorrentStore.torrents[hash] || {};
if (name == null) {
return;
}
link.download = `${name}.tar`;
link.download = '';
link.href = `${baseURI}api/torrents/${hash}/contents/${this.selectedIndices.join(',')}/data`;
link.style.display = 'none';
document.body.appendChild(link); // Fix for Firefox 58+
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
handleFormChange = (hash: string, {event}: {event: Event | React.FormEvent<HTMLFormElement>}): void => {
@@ -28,11 +28,14 @@ const handleTorrentDownload = (torrent: TorrentProperties, event: React.MouseEve
event.preventDefault();
const {baseURI} = ConfigStore;
const link = document.createElement('a');
link.download = torrent.isMultiFile ? `${torrent.name}.tar` : torrent.name;
link.download = '';
link.href = `${baseURI}api/torrents/${torrent.hash}/contents/all/data`;
link.style.display = 'none';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
const handleItemClick = (action: TorrentContextMenuAction, event: React.MouseEvent): void => {
@@ -278,7 +278,6 @@ class QBittorrentClientGatewayService extends ClientGatewayService {
downTotal: info.downloaded,
eta: info.eta >= 8640000 ? -1 : info.eta,
hash: info.hash,
isMultiFile: false,
isPrivate: false,
message: '', // in tracker method
name: info.name,
@@ -26,10 +26,6 @@ const torrentListMethodCallConfigs = {
methodCall: 'd.complete=',
transformValue: booleanTransformer,
},
isMultiFile: {
methodCall: 'd.is_multi_file=',
transformValue: booleanTransformer,
},
isPrivate: {
methodCall: 'd.is_private=',
transformValue: booleanTransformer,
-1
View File
@@ -39,7 +39,6 @@ export interface TorrentProperties {
// Torrent ETA (seconds), -1 means infinity
eta: number;
hash: string;
isMultiFile: boolean;
isPrivate: boolean;
message: string;
name: string;