1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 07:18:08 +00:00

Web UI: Stop using absolute URLs in ajax requests (closes #1011226)

This commit is contained in:
Christophe Dumez 2012-06-10 20:15:57 +03:00
parent 55a6bc3855
commit 81e4e39878
10 changed files with 24 additions and 24 deletions

View File

@ -12,7 +12,7 @@
$('addTrackersButton').addEvent('click', function(e){ $('addTrackersButton').addEvent('click', function(e){
new Event(e).stop(); new Event(e).stop();
var hash = new URI().getData('hash'); var hash = new URI().getData('hash');
new Request({url: '/command/addTrackers', method: 'post', data: {hash: hash, urls: $('trackersUrls').value}, new Request({url: 'command/addTrackers', method: 'post', data: {hash: hash, urls: $('trackersUrls').value},
onComplete: function() { onComplete: function() {
window.parent.document.getElementById('trackersPage').parentNode.removeChild(window.parent.document.getElementById('trackersPage')); window.parent.document.getElementById('trackersPage').parentNode.removeChild(window.parent.document.getElementById('trackersPage'));
} }

View File

@ -45,9 +45,9 @@ window.addEvent('domready', function(){
}); });
$('confirmBtn').addEvent('click', function(e){ $('confirmBtn').addEvent('click', function(e){
new Event(e).stop(); new Event(e).stop();
var cmd = '/command/delete'; var cmd = 'command/delete';
if($('deleteFromDiskCB').get('checked')) if($('deleteFromDiskCB').get('checked'))
cmd = '/command/deletePerm'; cmd = 'command/deletePerm';
new Request({url: cmd, new Request({url: cmd,
method: 'post', method: 'post',
data: {hashes: hashes.join('|')}, data: {hashes: hashes.join('|')},

View File

@ -25,7 +25,7 @@
setDlLimit = function() { setDlLimit = function() {
var limit = $("dllimitUpdatevalue").get('html').toInt() * 1024; var limit = $("dllimitUpdatevalue").get('html').toInt() * 1024;
if(hash == "global") { if(hash == "global") {
new Request({url: '/command/setGlobalDlLimit', new Request({url: 'command/setGlobalDlLimit',
method: 'post', method: 'post',
data: {'limit': limit}, data: {'limit': limit},
onComplete: function() { onComplete: function() {
@ -33,7 +33,7 @@
} }
}).send(); }).send();
} else { } else {
new Request({url: '/command/setTorrentDlLimit', new Request({url: 'command/setTorrentDlLimit',
method: 'post', method: 'post',
data: {'hash': hash, 'limit': limit}, data: {'hash': hash, 'limit': limit},
onComplete: function() { onComplete: function() {

View File

@ -1043,7 +1043,7 @@ applyPreferences = function() {
// Send it to qBT // Send it to qBT
var json_str = JSON.encode(settings); var json_str = JSON.encode(settings);
new Request({url: '/command/setPreferences', new Request({url: 'command/setPreferences',
method: 'post', method: 'post',
data: {'json': json_str, data: {'json': json_str,
}, },

View File

@ -88,7 +88,7 @@ var allCBUnchecked = function() {
var setFilePriority = function(id, priority) { var setFilePriority = function(id, priority) {
if(current_hash == "") return; if(current_hash == "") return;
new Request({url: '/command/setFilePrio', method: 'post', data: {'hash': current_hash, 'id': id, 'priority': priority}}).send(); new Request({url: 'command/setFilePrio', method: 'post', data: {'hash': current_hash, 'id': id, 'priority': priority}}).send();
// Display or add combobox // Display or add combobox
if(priority > 0) { if(priority > 0) {
$('comboPrio'+id).set("value", 1); $('comboPrio'+id).set("value", 1);

View File

@ -15,7 +15,7 @@ function hideAll() {
<iframe id="upload_frame" name="upload_frame" style="width:1px;height:1px;border:0px;" src="javascript:false;"></iframe> <iframe id="upload_frame" name="upload_frame" style="width:1px;height:1px;border:0px;" src="javascript:false;"></iframe>
<center> <center>
<h1 class="vcenter"><img class="vcenter" title="Download local torrent" src="theme/list-add"/>_(Download local torrent)</h1> <h1 class="vcenter"><img class="vcenter" title="Download local torrent" src="theme/list-add"/>_(Download local torrent)</h1>
<form action="/command/upload" enctype="multipart/form-data" method="post" id="uploadForm" target="upload_frame"> <form action="command/upload" enctype="multipart/form-data" method="post" id="uploadForm" target="upload_frame">
<input type="file" name="torrentfile" id="torrentfile" size="40"/><br/><br/> <input type="file" name="torrentfile" id="torrentfile" size="40"/><br/><br/>
<input type="submit" value="_(Download)" id="upButton"/> <input type="submit" value="_(Download)" id="upButton"/>
</form> </form>

View File

@ -25,7 +25,7 @@
setUpLimit = function() { setUpLimit = function() {
var limit = $("uplimitUpdatevalue").get('html').toInt() * 1024; var limit = $("uplimitUpdatevalue").get('html').toInt() * 1024;
if(hash == "global") { if(hash == "global") {
new Request({url: '/command/setGlobalUpLimit', new Request({url: 'command/setGlobalUpLimit',
method: 'post', method: 'post',
data: {'limit': limit}, data: {'limit': limit},
onComplete: function() { onComplete: function() {
@ -33,7 +33,7 @@
} }
}).send(); }).send();
}else { }else {
new Request({url: '/command/setTorrentUpLimit', new Request({url: 'command/setTorrentUpLimit',
method: 'post', method: 'post',
data: {'hash': hash, 'limit': limit}, data: {'hash': hash, 'limit': limit},
onComplete: function() { onComplete: function() {

View File

@ -25,7 +25,7 @@ window.addEvent('domready', function(){
$('urls').focus(); $('urls').focus();
$('downButton').addEvent('click', function(e){ $('downButton').addEvent('click', function(e){
new Event(e).stop(); new Event(e).stop();
new Request({url: '/command/download', method: 'post', data: {urls: $('urls').value}, new Request({url: 'command/download', method: 'post', data: {urls: $('urls').value},
onComplete: function() { onComplete: function() {
window.parent.document.getElementById('downloadPage').parentNode.removeChild(window.parent.document.getElementById('downloadPage')); window.parent.document.getElementById('downloadPage').parentNode.removeChild(window.parent.document.getElementById('downloadPage'));
} }

View File

@ -152,7 +152,7 @@ initializeWindows = function(){
var h = myTable.selectedIds(); var h = myTable.selectedIds();
/*if(h.length && confirm('_(Are you sure you want to delete the selected torrents from the transfer list?)')) { /*if(h.length && confirm('_(Are you sure you want to delete the selected torrents from the transfer list?)')) {
h.each(function(item, index){ h.each(function(item, index){
new Request({url: '/command/delete', method: 'post', data: {hash: item}}).send(); new Request({url: 'command/delete', method: 'post', data: {hash: item}}).send();
}); });
}*/ }*/
if(h.length) { if(h.length) {
@ -180,7 +180,7 @@ initializeWindows = function(){
var h = myTable.selectedIds(); var h = myTable.selectedIds();
if(h.length){ if(h.length){
h.each(function(hash, index){ h.each(function(hash, index){
new Request({url: '/command/pause', method: 'post', data: {hash: hash}}).send(); new Request({url: 'command/pause', method: 'post', data: {hash: hash}}).send();
}); });
} }
}; };
@ -189,7 +189,7 @@ initializeWindows = function(){
var h = myTable.selectedIds(); var h = myTable.selectedIds();
if(h.length){ if(h.length){
h.each(function(hash, index){ h.each(function(hash, index){
new Request({url: '/command/resume', method: 'post', data: {hash: hash}}).send(); new Request({url: 'command/resume', method: 'post', data: {hash: hash}}).send();
}); });
} }
}; };
@ -198,7 +198,7 @@ initializeWindows = function(){
var h = myTable.selectedIds(); var h = myTable.selectedIds();
if(h.length){ if(h.length){
h.each(function(hash, index){ h.each(function(hash, index){
new Request({url: '/command/recheck', method: 'post', data: {hash: hash}}).send(); new Request({url: 'command/recheck', method: 'post', data: {hash: hash}}).send();
}); });
} }
}; };
@ -209,14 +209,14 @@ initializeWindows = function(){
var h = myTable.selectedIds(); var h = myTable.selectedIds();
if(h.length){ if(h.length){
h.each(function(hash, index){ h.each(function(hash, index){
new Request({url: '/command/'+item, method: 'post', data: {hash: hash}}).send(); new Request({url: 'command/'+item, method: 'post', data: {hash: hash}}).send();
}); });
} }
}); });
addClickEvent(item+'All', function(e){ addClickEvent(item+'All', function(e){
new Event(e).stop(); new Event(e).stop();
new Request({url: '/command/'+item+'all'}).send(); new Request({url: 'command/'+item+'all'}).send();
}); });
}); });
@ -230,7 +230,7 @@ initializeWindows = function(){
setPriorityFN = function(cmd) { setPriorityFN = function(cmd) {
var h = myTable.selectedIds(); var h = myTable.selectedIds();
if(h.length) { if(h.length) {
new Request({url: '/command/'+cmd, method: 'post', data: {hashes: h.join("|")}}).send(); new Request({url: 'command/'+cmd, method: 'post', data: {hashes: h.join("|")}}).send();
} }
} }

View File

@ -22,7 +22,7 @@ MochaUI.extend({
// Get global upload limit // Get global upload limit
var maximum = 500; var maximum = 500;
var req = new Request({ var req = new Request({
url: '/command/getGlobalUpLimit', url: 'command/getGlobalUpLimit',
method: 'post', method: 'post',
data: {}, data: {},
onSuccess: function(data) { onSuccess: function(data) {
@ -64,7 +64,7 @@ MochaUI.extend({
} }
} else { } else {
var req = new Request({ var req = new Request({
url: '/command/getTorrentUpLimit', url: 'command/getTorrentUpLimit',
method: 'post', method: 'post',
data: {hash: hash}, data: {hash: hash},
onSuccess: function(data) { onSuccess: function(data) {
@ -109,7 +109,7 @@ MochaUI.extend({
// Get global upload limit // Get global upload limit
var maximum = 500; var maximum = 500;
var req = new Request({ var req = new Request({
url: '/command/getGlobalDlLimit', url: 'command/getGlobalDlLimit',
method: 'post', method: 'post',
data: {}, data: {},
onSuccess: function(data) { onSuccess: function(data) {
@ -151,7 +151,7 @@ MochaUI.extend({
} }
} else { } else {
var req = new Request({ var req = new Request({
url: '/command/getTorrentDlLimit', url: 'command/getTorrentDlLimit',
method: 'post', method: 'post',
data: {hash: hash}, data: {hash: hash},
onSuccess: function(data) { onSuccess: function(data) {