From cea5f8bd12fa19a8d036347791476c3dfcddace4 Mon Sep 17 00:00:00 2001 From: Nils Maier Date: Sat, 17 May 2014 17:41:00 +0200 Subject: [PATCH] Implement --rpc-secret support --- index.html | 10 +++++++++ js/services/rpc/jsoncall.js | 4 ++-- js/services/rpc/rpc.js | 45 +++++++++++++++++++++++++++---------- js/services/rpc/syscall.js | 1 + 4 files changed, 46 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index a3fe5dd..a21019d 100755 --- a/index.html +++ b/index.html @@ -754,6 +754,16 @@ http://ex1.com/f2.mp4 http://ex2.com/f2.mp4

Enable SSL/TLS encryption.

+ +
+ +
+
Oh Snap! Could not connect to the aria2 RPC server. Will retry in ' + time / 1000 + ' secs. You might want to check the connection settings by going to Settings > Connection Settings', 'error'); + timeout = setTimeout(update, time); + } + }; + syscall.invoke({ name: 'system.multicall', params: [params], success: function(data) { + var failed = _.any(data.result, function(d) { + return d.code && d.message === "Unauthorized"; + }); + if (failed) { + error(); + return; + } + if (configurations.length) { // configuration worked, save it in cookie for next time and // delete the pipelined configurations!! @@ -104,17 +135,7 @@ function(syscall, time, alerts, utils, rootScope, uri) { timeout = setTimeout(update, time); } }, - error: function() { - // If some proposed configurations are still in the pipeline then retry - if (configurations.length) { - alerts.log("The last connection attempt was unsuccessful. Trying another configuration"); - timeout = setTimeout(update, 0); - } - else { - alerts.addAlert('Oh Snap! Could not connect to the aria2 RPC server. Will retry in ' + time / 1000 + ' secs. You might want to check the connection settings by going to Settings > Connection Settings', 'error'); - timeout = setTimeout(update, time); - } - } + error: error }); }; diff --git a/js/services/rpc/syscall.js b/js/services/rpc/syscall.js index bbaa3fb..00ea1cb 100644 --- a/js/services/rpc/syscall.js +++ b/js/services/rpc/syscall.js @@ -13,6 +13,7 @@ function(log, jsonRPC, sockRPC, alerts) { // port (number): port number for the aria2 server // encrypt (boolean, optional): true if encryption is enabled in the aria2 server // auth (optional): { + // token (string): secret token for authentication (--rpc-secret) // user (string): username for http authentication if enabled // pass (string): password for the http authentication if enabled // }