From 81e4e398785557d56d38863d587d8f9f7069b274 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 10 Jun 2012 20:15:57 +0300 Subject: [PATCH] Web UI: Stop using absolute URLs in ajax requests (closes #1011226) --- src/webui/html/addtrackers.html | 2 +- src/webui/html/confirmdeletion.html | 4 ++-- src/webui/html/downloadlimit.html | 6 +++--- src/webui/html/preferences_content.html | 2 +- src/webui/html/prop-files.html | 2 +- src/webui/html/upload.html | 2 +- src/webui/html/uploadlimit.html | 6 +++--- src/webui/scripts/download.js | 2 +- src/webui/scripts/mocha-init.js | 14 +++++++------- src/webui/scripts/parametrics.js | 8 ++++---- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/webui/html/addtrackers.html b/src/webui/html/addtrackers.html index 64a5264b0..5b6af3184 100644 --- a/src/webui/html/addtrackers.html +++ b/src/webui/html/addtrackers.html @@ -12,7 +12,7 @@ $('addTrackersButton').addEvent('click', function(e){ new Event(e).stop(); 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() { window.parent.document.getElementById('trackersPage').parentNode.removeChild(window.parent.document.getElementById('trackersPage')); } diff --git a/src/webui/html/confirmdeletion.html b/src/webui/html/confirmdeletion.html index 5668d2a89..e43b28629 100644 --- a/src/webui/html/confirmdeletion.html +++ b/src/webui/html/confirmdeletion.html @@ -45,9 +45,9 @@ window.addEvent('domready', function(){ }); $('confirmBtn').addEvent('click', function(e){ new Event(e).stop(); - var cmd = '/command/delete'; + var cmd = 'command/delete'; if($('deleteFromDiskCB').get('checked')) - cmd = '/command/deletePerm'; + cmd = 'command/deletePerm'; new Request({url: cmd, method: 'post', data: {hashes: hashes.join('|')}, diff --git a/src/webui/html/downloadlimit.html b/src/webui/html/downloadlimit.html index 011206018..1cf3ae6e5 100644 --- a/src/webui/html/downloadlimit.html +++ b/src/webui/html/downloadlimit.html @@ -25,7 +25,7 @@ setDlLimit = function() { var limit = $("dllimitUpdatevalue").get('html').toInt() * 1024; if(hash == "global") { - new Request({url: '/command/setGlobalDlLimit', + new Request({url: 'command/setGlobalDlLimit', method: 'post', data: {'limit': limit}, onComplete: function() { @@ -33,7 +33,7 @@ } }).send(); } else { - new Request({url: '/command/setTorrentDlLimit', + new Request({url: 'command/setTorrentDlLimit', method: 'post', data: {'hash': hash, 'limit': limit}, onComplete: function() { @@ -51,4 +51,4 @@ - \ No newline at end of file + diff --git a/src/webui/html/preferences_content.html b/src/webui/html/preferences_content.html index af81a648f..49e967d77 100644 --- a/src/webui/html/preferences_content.html +++ b/src/webui/html/preferences_content.html @@ -1043,7 +1043,7 @@ applyPreferences = function() { // Send it to qBT var json_str = JSON.encode(settings); - new Request({url: '/command/setPreferences', + new Request({url: 'command/setPreferences', method: 'post', data: {'json': json_str, }, diff --git a/src/webui/html/prop-files.html b/src/webui/html/prop-files.html index e54eb2c50..fbf84eb81 100644 --- a/src/webui/html/prop-files.html +++ b/src/webui/html/prop-files.html @@ -88,7 +88,7 @@ var allCBUnchecked = function() { var setFilePriority = function(id, priority) { 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 if(priority > 0) { $('comboPrio'+id).set("value", 1); diff --git a/src/webui/html/upload.html b/src/webui/html/upload.html index 836ec3d03..178f27d56 100644 --- a/src/webui/html/upload.html +++ b/src/webui/html/upload.html @@ -15,7 +15,7 @@ function hideAll() {

_(Download local torrent)

-
+

diff --git a/src/webui/html/uploadlimit.html b/src/webui/html/uploadlimit.html index 43c57070f..bc6134c88 100644 --- a/src/webui/html/uploadlimit.html +++ b/src/webui/html/uploadlimit.html @@ -25,7 +25,7 @@ setUpLimit = function() { var limit = $("uplimitUpdatevalue").get('html').toInt() * 1024; if(hash == "global") { - new Request({url: '/command/setGlobalUpLimit', + new Request({url: 'command/setGlobalUpLimit', method: 'post', data: {'limit': limit}, onComplete: function() { @@ -33,7 +33,7 @@ } }).send(); }else { - new Request({url: '/command/setTorrentUpLimit', + new Request({url: 'command/setTorrentUpLimit', method: 'post', data: {'hash': hash, 'limit': limit}, onComplete: function() { @@ -51,4 +51,4 @@ - \ No newline at end of file + diff --git a/src/webui/scripts/download.js b/src/webui/scripts/download.js index d2853d5dc..9a1de37f1 100644 --- a/src/webui/scripts/download.js +++ b/src/webui/scripts/download.js @@ -25,7 +25,7 @@ window.addEvent('domready', function(){ $('urls').focus(); $('downButton').addEvent('click', function(e){ 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() { window.parent.document.getElementById('downloadPage').parentNode.removeChild(window.parent.document.getElementById('downloadPage')); } diff --git a/src/webui/scripts/mocha-init.js b/src/webui/scripts/mocha-init.js index bcca88600..c87fe641e 100644 --- a/src/webui/scripts/mocha-init.js +++ b/src/webui/scripts/mocha-init.js @@ -152,7 +152,7 @@ initializeWindows = function(){ var h = myTable.selectedIds(); /*if(h.length && confirm('_(Are you sure you want to delete the selected torrents from the transfer list?)')) { 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) { @@ -180,7 +180,7 @@ initializeWindows = function(){ var h = myTable.selectedIds(); if(h.length){ 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(); if(h.length){ 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(); if(h.length){ 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(); if(h.length){ 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){ 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) { var h = myTable.selectedIds(); 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(); } } diff --git a/src/webui/scripts/parametrics.js b/src/webui/scripts/parametrics.js index 3454202ef..edab6c1bf 100644 --- a/src/webui/scripts/parametrics.js +++ b/src/webui/scripts/parametrics.js @@ -22,7 +22,7 @@ MochaUI.extend({ // Get global upload limit var maximum = 500; var req = new Request({ - url: '/command/getGlobalUpLimit', + url: 'command/getGlobalUpLimit', method: 'post', data: {}, onSuccess: function(data) { @@ -64,7 +64,7 @@ MochaUI.extend({ } } else { var req = new Request({ - url: '/command/getTorrentUpLimit', + url: 'command/getTorrentUpLimit', method: 'post', data: {hash: hash}, onSuccess: function(data) { @@ -109,7 +109,7 @@ MochaUI.extend({ // Get global upload limit var maximum = 500; var req = new Request({ - url: '/command/getGlobalDlLimit', + url: 'command/getGlobalDlLimit', method: 'post', data: {}, onSuccess: function(data) { @@ -151,7 +151,7 @@ MochaUI.extend({ } } else { var req = new Request({ - url: '/command/getTorrentDlLimit', + url: 'command/getTorrentDlLimit', method: 'post', data: {hash: hash}, onSuccess: function(data) {