Enter the ip or dns name of the server on which the
@@ -643,8 +645,7 @@ http://ex1.com/f2.mp4 http://ex2.com/f2.mp4
+ ng-model="connection.conf.port"/>
Enter the port of the server on which the rpc for
aria2 is running (default = 6800)
@@ -653,14 +654,17 @@ http://ex1.com/f2.mp4 http://ex2.com/f2.mp4
-
+
+ Enable encryption connection to aria2
+
Enable SSL/TLS encryption.
diff --git a/js/ctrls/alert.js b/js/ctrls/alert.js
index 65b26a2..df5e8cf 100644
--- a/js/ctrls/alert.js
+++ b/js/ctrls/alert.js
@@ -13,12 +13,10 @@ angular.module('webui.ctrls.alert', [
var obj = { msg: msg, type: type };
scope.pendingAlerts.push(obj);
- /*
setTimeout(function() {
var ind = scope.pendingAlerts.indexOf(obj);
if (ind != -1) scope.removeAlert(ind);
}, 5000);
- */
scope.$digest();
});
diff --git a/js/ctrls/modal.js b/js/ctrls/modal.js
index d9c7095..29fff2f 100644
--- a/js/ctrls/modal.js
+++ b/js/ctrls/modal.js
@@ -84,11 +84,14 @@ angular
scope.connection = {
shown: false,
- host: 'localhost',
- port: 6800,
- auth: {
- user: '',
- pass: ''
+ conf: {
+ host: 'localhost',
+ port: 6800,
+ encrypt: true,
+ auth: {
+ user: '',
+ pass: ''
+ }
},
init: function(defaults, cb) {
@@ -96,10 +99,15 @@ angular
this.open = this.shown = true;
},
success: function() {
+ console.log(this);
+
+ if (this.cb) {
+ this.cb(this.conf);
+ }
+
this.close();
},
close: function() {
- if (this.cb) this.cb();
this.cb = null;
this.open = this.shown = false;
}
diff --git a/js/ctrls/nav.js b/js/ctrls/nav.js
index 7f3f61f..64a15fb 100644
--- a/js/ctrls/nav.js
+++ b/js/ctrls/nav.js
@@ -58,9 +58,9 @@ angular
};
scope.changeCSettings = function() {
- modals.invoke('connection', {}, function(data) {
- console.log('connection modal closed, got back the follwing data', data);
- });
+ modals.invoke(
+ 'connection', rpc.getConfiguration(), _.bind(rpc.configure, rpc)
+ );
}
scope.changeGSettings = function() {
diff --git a/js/services/rpc/jsoncall.js b/js/services/rpc/jsoncall.js
index 77611bd..0a5c506 100644
--- a/js/services/rpc/jsoncall.js
+++ b/js/services/rpc/jsoncall.js
@@ -33,7 +33,7 @@ angular
},
invoke: function(opts) {
var rpc = this;
- var scheme = rpc.serverConf.encryption ? 'https' : 'http';
+ var scheme = rpc.serverConf.encrypt ? 'https' : 'http';
rpc.ariaRequest(
scheme + '://' + rpc.serverConf.host + ':' + rpc.serverConf.port + '/jsonrpc',
opts.name,
@@ -66,7 +66,10 @@ angular
authUrl,
opts.params,
opts.success,
- opts.error
+ function() {
+ console.log("jsonrpc disconnect!!!");
+ return opts.error();
+ }
);
}, rpc.avgTimeout);
}
diff --git a/js/services/rpc/rpc.js b/js/services/rpc/rpc.js
index 31f7611..52c3638 100644
--- a/js/services/rpc/rpc.js
+++ b/js/services/rpc/rpc.js
@@ -6,7 +6,7 @@ angular
function(syscall, time, alerts) {
var subscriptions = []
- , configurations = [{ host: 'localhost', port: 6800 }]
+ , configurations = [{ host: 'localhost', port: 6800, encrypt: false }]
, currentConf = {}
, timeout = null
, forceNextUpdate = false;
@@ -40,7 +40,6 @@ function(syscall, time, alerts) {
});
-
syscall.invoke({
name: 'system.multicall',
params: [params],
@@ -96,11 +95,18 @@ function(syscall, time, alerts) {
// each one will be tried one after the other till success,
// for all options for one conf read rpc/syscall.js
configure: function(conf) {
+ alerts.addAlert('Successfully changed aria2 connection configuration', 'success');
+
if (conf instanceof Array)
configurations = conf;
else
configurations = [conf];
+
},
+
+ // get current configuration being used
+ getConfiguration: function() { return currentConf },
+
// syscall is done only once, delay is optional
// and pass true to only dispatch it in the global timeout
// which can be used to batch up once calls
diff --git a/js/services/rpc/sockcall.js b/js/services/rpc/sockcall.js
index c312f54..83f0979 100644
--- a/js/services/rpc/sockcall.js
+++ b/js/services/rpc/sockcall.js
@@ -79,7 +79,7 @@ function(_, JSON, name, utils, alerts) {
}
sockRPC.conf = conf || sockRPC.conf;
- sockRPC.scheme = sockRPC.conf.encryption ? 'wss' : 'ws';
+ sockRPC.scheme = sockRPC.conf.encrypt ? 'wss' : 'ws';
if (sockRPC.sock) {
sockRPC.onopen = sockRPC.sock.onmessage = sockRPC.sock.onerror = sockRPC.sock.onclose = null;
diff --git a/js/services/rpc/syscall.js b/js/services/rpc/syscall.js
index 8c4a8da..a829a75 100644
--- a/js/services/rpc/syscall.js
+++ b/js/services/rpc/syscall.js
@@ -11,7 +11,7 @@ function(log, jsonRPC, sockRPC, alerts) {
// {
// host (string): host for the aria2 server
// port (number): port number for the aria2 server
- // encryption (boolean, optional): true if encryption is enabled in the aria2 server
+ // encrypt (boolean, optional): true if encryption is enabled in the aria2 server
// auth (optional): {
// user (string): username for http authentication if enabled
// pass (string): password for the http authentication if enabled
@@ -22,7 +22,7 @@ function(log, jsonRPC, sockRPC, alerts) {
host: 'localhost',
port: 6800
};
- conf.encryption = conf.encryption || false;
+ conf.encrypt = conf.encrypt || false;
jsonRPC.init(conf);
sockRPC.init(conf);