mirror of
https://github.com/transmission/transmission
synced 2025-02-02 12:32:54 +00:00
Add upload torrent by url to web interface
This commit is contained in:
parent
69404a8c36
commit
f00619bab7
4 changed files with 27 additions and 13 deletions
|
@ -255,8 +255,10 @@
|
|||
<form action="#" method="post" id="torrent_upload_form"
|
||||
enctype="multipart/form-data" target="torrent_upload_frame">
|
||||
<div class="dialog_message">
|
||||
Please select a torrent file to upload:
|
||||
<label for="torrent_upload_file">Please select a torrent file to upload:</label>
|
||||
<input type="file" name="torrent_file" id="torrent_upload_file"/>
|
||||
<label for="torrent_upload_url">Or enter a URL:</label>
|
||||
<input type="text" id="torrent_upload_url"/>
|
||||
</div>
|
||||
<a href="#upload" id="upload_confirm_button">Upload</a>
|
||||
<a href="#cancel" id="upload_cancel_button">Cancel</a>
|
||||
|
|
|
@ -1164,16 +1164,20 @@ Transmission.prototype =
|
|||
} else {
|
||||
var tr = this;
|
||||
var args = { };
|
||||
args.url = '/transmission/upload?paused=' + (this[Prefs._AutoStart] ? 'false' : 'true');
|
||||
args.type = 'POST';
|
||||
args.dataType = 'xml';
|
||||
args.iframe = true;
|
||||
args.success = function( data ) {
|
||||
tr.remote.loadTorrents( );
|
||||
tr.togglePeriodicRefresh( true );
|
||||
};
|
||||
this.togglePeriodicRefresh( false );
|
||||
$('#torrent_upload_form').ajaxSubmit( args );
|
||||
if ('' != $('#torrent_upload_url').val()) {
|
||||
tr.remote.addTorrentByUrl($('#torrent_upload_url').val(), { paused: !this[Prefs._Autostart] });
|
||||
} else {
|
||||
args.url = '/transmission/upload?paused=' + (this[Prefs._AutoStart] ? 'false' : 'true');
|
||||
args.type = 'POST';
|
||||
args.dataType = 'xml';
|
||||
args.iframe = true;
|
||||
args.success = function( data ) {
|
||||
tr.remote.loadTorrents( );
|
||||
tr.togglePeriodicRefresh( true );
|
||||
};
|
||||
this.togglePeriodicRefresh( false );
|
||||
$('#torrent_upload_form').ajaxSubmit( args );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -121,7 +121,15 @@ TransmissionRemote.prototype =
|
|||
removeTorrents: function( torrents ) {
|
||||
this.sendTorrentCommand( 'torrent-remove', torrents );
|
||||
},
|
||||
|
||||
addTorrentByUrl: function( url, options ) {
|
||||
this.sendRequest( RPC._Root, $.toJSON({
|
||||
method: 'torrent-add',
|
||||
arguments: {
|
||||
paused: (options.paused ? 'true' : 'false'),
|
||||
filename: url
|
||||
}
|
||||
}) );
|
||||
},
|
||||
savePrefs: function( args ) {
|
||||
var remote = this;
|
||||
var o = { };
|
||||
|
|
|
@ -726,7 +726,7 @@ div#upload_container div.dialog_window div.dialog_message label {
|
|||
|
||||
div#upload_container div.dialog_window div.dialog_message input {
|
||||
width: 249px;
|
||||
margin: 10px 0 0 0;
|
||||
margin: 3px 0 0 0;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue