moveTorrents: Allow hash check to be skipped by user

Signed-off-by: Jesse Chan <jc@linux.com>
This commit is contained in:
Jesse Chan
2020-08-04 13:12:56 +08:00
parent c7f69407dd
commit 0eae92faf5
4 changed files with 26 additions and 8 deletions
+13 -7
View File
@@ -227,7 +227,7 @@ const client = {
moveTorrents(user, services, data, callback) {
const destinationPath = data.destination;
const {isBasePath, hashes, filenames, moveFiles, sourcePaths} = data;
const {isBasePath, hashes, filenames, moveFiles, sourcePaths, isCheckHash} = data;
const mainRequest = new ClientRequest(user, services);
const hashesToRestart = hashes.filter(
@@ -247,12 +247,18 @@ const client = {
afterCheckHash = callback;
}
const checkHash = () => {
const checkHashRequest = new ClientRequest(user, services);
checkHashRequest.checkHash({hashes});
checkHashRequest.onComplete(afterCheckHash);
checkHashRequest.send();
};
let checkHash;
if (isCheckHash) {
checkHash = () => {
const checkHashRequest = new ClientRequest(user, services);
checkHashRequest.checkHash({hashes});
checkHashRequest.onComplete(afterCheckHash);
checkHashRequest.send();
};
} else {
checkHash = afterCheckHash;
}
const moveTorrents = () => {
const moveTorrentsRequest = new ClientRequest(user, services);