mirror of
https://github.com/zoriya/flood.git
synced 2026-06-12 06:00:44 +00:00
API: rename /file-priority API
This commit is contained in:
@@ -227,12 +227,12 @@ class ClientRequest {
|
||||
}
|
||||
|
||||
setFilePriority(options) {
|
||||
const fileIndices = getEnsuredArray(options.fileIndices);
|
||||
const indices = getEnsuredArray(options.indices);
|
||||
const hashes = getEnsuredArray(options.hashes);
|
||||
|
||||
hashes.forEach((hash) => {
|
||||
fileIndices.forEach((fileIndex) => {
|
||||
this.requests.push(getMethodCall('f.priority.set', [`${hash}:f${fileIndex}`, options.priority]));
|
||||
indices.forEach((index) => {
|
||||
this.requests.push(getMethodCall('f.priority.set', [`${hash}:f${index}`, options.priority]));
|
||||
});
|
||||
this.requests.push(getMethodCall('d.update_priorities', [hash]));
|
||||
});
|
||||
|
||||
@@ -218,11 +218,10 @@ const client = {
|
||||
},
|
||||
|
||||
setFilePriority(user, services, hashes, data, callback) {
|
||||
// TODO Add support for multiple hashes.
|
||||
const {fileIndices} = data;
|
||||
const {indices, priority} = data;
|
||||
const request = new ClientRequest(user, services);
|
||||
|
||||
request.setFilePriority({hashes, fileIndices, priority: data.priority});
|
||||
request.setFilePriority({hashes, indices, priority});
|
||||
request.onComplete((response, error) => {
|
||||
services.torrentService.fetchTorrentList();
|
||||
callback(response, error);
|
||||
|
||||
Reference in New Issue
Block a user