From 6e9a2344120abb1fa0b0e8cd415b115296945664 Mon Sep 17 00:00:00 2001 From: hamza zia Date: Sat, 31 May 2014 20:59:02 +0800 Subject: [PATCH] added a warning for insecure connections --- js/services/rpc/rpc.js | 7 +++++-- js/services/rpc/sockcall.js | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/js/services/rpc/rpc.js b/js/services/rpc/rpc.js index 51d478d..c3ff602 100644 --- a/js/services/rpc/rpc.js +++ b/js/services/rpc/rpc.js @@ -15,7 +15,7 @@ function(syscall, time, alerts, utils, rootScope, uri) { , timeout = null , forceNextUpdate = false; - if (['http', 'https'].indexOf(uri.protocol()) != -1) { + if (['http', 'https'].indexOf(uri.protocol()) != -1 && uri.host() != 'localhost') { console.log(uri.host()); configurations.unshift({ host: uri.host(), @@ -102,7 +102,10 @@ function(syscall, time, alerts, utils, rootScope, uri) { if (configurations.length) { // configuration worked, save it in cookie for next time and // delete the pipelined configurations!! - alerts.addAlert('Successfully connected to Aria2 through its remote RPC…', 'success'); + if (currentToken) + alerts.addAlert('Successfully connected to Aria2 through its remote RPC …', 'success'); + else + alerts.addAlert('Successfully connected to Aria2 through remote RPC, however the connection is still insecure. For complete security try adding an authorization secret token while starting Aria2 (through the flag --rpc-secret)'); configurations = []; } diff --git a/js/services/rpc/sockcall.js b/js/services/rpc/sockcall.js index 8e7a8e2..2e144a6 100644 --- a/js/services/rpc/sockcall.js +++ b/js/services/rpc/sockcall.js @@ -28,7 +28,6 @@ function(_, JSON, name, utils, alerts) { _.each(sockRPC.handles, function(h) { h.error() }); sockRPC.handles = []; sockRPC.initialized = false; - alerts.log('Cannot talk to aria2 over WebSockets. Switching to regular HTTP requests…'); }, onclose: function(ev) { if (sockRPC.handles && sockRPC.handles.length)