mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 04:18:39 +00:00
In Web Client, use jQuery.ajax() to upload files
If we use FormData and jQuery.ajax() calls to upload a torrent, we can stop bundling the jquery.form.js module. In addition, this simplifies passing arguments in the headers s.t. rpc-server.c doesn't have to look for the CSRF token as one of the multiparts. This changes the upload POST behavior, so give it a new name (upload2). The old function (upload) will be deprecated but kept until 2.90 so that third-party web clients using the old POST semantics will have time to update. Bug #5290 <https://trac.transmissionbt.com/ticket/5290>
This commit is contained in:
@@ -124,6 +124,18 @@ TransmissionRemote.prototype =
|
||||
});
|
||||
},
|
||||
|
||||
getFreeSpace: function(dir, callback, context) {
|
||||
var remote = this;
|
||||
var o = {
|
||||
method: 'free-space',
|
||||
arguments: { path: dir }
|
||||
};
|
||||
this.sendRequest(o, function(response) {
|
||||
var args = response['arguments'];
|
||||
callback.call (context, args.path, args['size-bytes']);
|
||||
});
|
||||
},
|
||||
|
||||
changeFileCommand: function(torrentId, fileIndices, command) {
|
||||
var remote = this,
|
||||
args = { ids: [torrentId] };
|
||||
|
||||
Reference in New Issue
Block a user