Permalink
Browse files

remove port from options and simplify to require explicit URL only (a…

…llows proxied bases to work in 1.3 and saves some scheme/address/port confusion)
  • Loading branch information...
1 parent b42ebd8 commit 2af2d36c89bd3649814c7aac7741d2d9cd68a306 @mjtko committed with Mark J. Titorenko Jun 1, 2010
Showing with 8 additions and 47 deletions.
  1. +3 −20 background.html
  2. +2 −15 options.html
  3. +3 −12 torrent_status.html
View
@@ -12,15 +12,7 @@
* @see chrome.extension.sendRequest && chrome.extension.onRequest
*/
function add_torrent_from_url(request, sender, sendResponse) {
- var ADDRESS = localStorage.deluge_address;
- var PORT = localStorage.deluge_port;
-
- if(PORT) {
- var _port = ':' + PORT;
- } else {
- var _port = '';
- }
- var ENDPOINT = ADDRESS + _port + '/json';
+ var ENDPOINT = localStorage.deluge_address + '/json';
/**
* Fetches the configuration values needed to add the torrent before
@@ -126,16 +118,7 @@
* @param args.error Callback for connection failure to Deluge.
*/
function deluge_status_check(args) {
- var ADDRESS = localStorage.deluge_address;
- var PORT = localStorage.deluge_port;
- var PASSWORD = localStorage.deluge_password;
-
- if(PORT) {
- var _port = ':' + PORT;
- } else {
- var _port = '';
- }
- var ENDPOINT = ADDRESS + _port + '/json';
+ var ENDPOINT = localStorage.deluge_address + '/json';
/**
@@ -317,4 +300,4 @@
</head>
<body>
</body>
-</html>
+</html>
View
@@ -29,7 +29,7 @@ <h2>Configuration</h2>
</div>
<div class="chrome-sub-header">
<p>This extension requires an accessible version of Deluge web interface to be running. Please refer to the <a href="http://deluge-torrent.org/" target="_blank">Deluge documentation</a> on how to get this working.</p>
- <p>In order to connect to the web interface with need to know some details about the web interface. The address and port number used to access the interface (http://address:port) and finally the password used to login.</p>
+ <p>In order to connect to the web interface with need to know some details about the web interface. The address used to access the interface (http://address:port) and finally the password used to login.</p>
</div>
<div id="status-message"></div>
@@ -42,11 +42,6 @@ <h2>Configuration</h2>
<input type="text" name="address" id="address" style="width: 300px" placeholder="http://" />
</p>
- <p>
- <label>Port:</label>
- <input type="text" name="port" id="port" style="width: 40px" />
- </p>
-
<p>
<label>Password:</label>
<input type="password" name="password" id="password" />
@@ -78,7 +73,6 @@ <h2>Configuration</h2>
address = localStorage.deluge_address;
$('#address').val(address);
- $('#port').val(localStorage.deluge_port);
$('#password').val(localStorage.deluge_password);
if(localStorage.deluge_download_icon == 'true') {
$('#enable_download_torrent').attr('checked', 'checked');
@@ -90,7 +84,6 @@ <h2>Configuration</h2>
function save_options() {
var message = new Array();
var address = $('#address').val();
- var port = $('#port').val();
var password = $('#password').val();
var download_link = $('#enable_download_torrent').is(':checked');
@@ -100,12 +93,6 @@ <h2>Configuration</h2>
}
localStorage.deluge_address = address.replace(/\/$/, '');
}
- if(port) {
- if(localStorage.deluge_port != port) {
- message.push('Port updated.');
- }
- localStorage.deluge_port = port;
- }
if(password) {
if(localStorage.deluge_password != password) {
message.push('Password updated.');
@@ -159,4 +146,4 @@ <h2>Configuration</h2>
});
</script>
</body>
-</html>
+</html>
View
@@ -60,16 +60,7 @@
<script src="js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/Deluge.Formatters.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
- var ADDRESS = localStorage.deluge_address;
- var PORT = localStorage.deluge_port;
-
- if(PORT) {
- var _port = ':' + PORT;
- } else {
- var _port = '';
- }
- var WEBUI_URL = ADDRESS + _port;
- var ENDPOINT = WEBUI_URL + '/json';
+ var ENDPOINT = localStorage.deluge_address + '/json';
// Used to store the timer.
var INTERVAL_UI = 0;
@@ -328,7 +319,7 @@
$('#logo a').click(function() {
// TODO: Add a check to make sure it's not already open in a tab.
// Switch to that tab if it is.
- chrome.tabs.create({url: WEBUI_URL});
+ chrome.tabs.create({url: localStorage.deluge_address});
window.close();
return false;
});
@@ -355,4 +346,4 @@
});
</script>
</body>
-</html>
+</html>

0 comments on commit 2af2d36

Please sign in to comment.