do not try default config if we have cookie
and fixed some wrong variable names
This commit is contained in:
parent
e05dd94c31
commit
ce84a36875
|
@ -6,10 +6,10 @@ angular
|
||||||
.factory('$rpc', [
|
.factory('$rpc', [
|
||||||
'$syscall', '$globalTimeout', '$alerts', '$utils',
|
'$syscall', '$globalTimeout', '$alerts', '$utils',
|
||||||
'$rootScope', '$location', '$authconf',
|
'$rootScope', '$location', '$authconf',
|
||||||
function(syscall, time, alerts, utils, rootScope, uri, authconf) {
|
function(syscall, globalTimeout, alerts, utils, rootScope, uri, authconf) {
|
||||||
|
|
||||||
var subscriptions = []
|
var subscriptions = []
|
||||||
, configurations = [authconf]
|
, configurations
|
||||||
, currentConf = {}
|
, currentConf = {}
|
||||||
, currentToken
|
, currentToken
|
||||||
, timeout = null
|
, timeout = null
|
||||||
|
@ -18,7 +18,7 @@ function(syscall, time, alerts, utils, rootScope, uri, authconf) {
|
||||||
var cookieConf = utils.getCookie('aria2conf');
|
var cookieConf = utils.getCookie('aria2conf');
|
||||||
|
|
||||||
// try at the start, so that it is presistant even when default authconf works
|
// try at the start, so that it is presistant even when default authconf works
|
||||||
if (cookieConf) configurations.push(cookieConf);
|
configurations = [cookieConf ? cookieConf : authconf];
|
||||||
|
|
||||||
if (['http', 'https'].indexOf(uri.protocol()) != -1 && uri.host() != 'localhost') {
|
if (['http', 'https'].indexOf(uri.protocol()) != -1 && uri.host() != 'localhost') {
|
||||||
console.log(uri.host());
|
console.log(uri.host());
|
||||||
|
@ -95,7 +95,7 @@ function(syscall, time, alerts, utils, rootScope, uri, authconf) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alerts.addAlert('<strong>Oh Snap!</strong> Could not connect to the aria2 RPC server. Will retry in 10 secs. You might want to check the connection settings by going to Settings > Connection Settings', 'error');
|
alerts.addAlert('<strong>Oh Snap!</strong> Could not connect to the aria2 RPC server. Will retry in 10 secs. You might want to check the connection settings by going to Settings > Connection Settings', 'error');
|
||||||
timeout = setTimeout(update, $globalTimeout);
|
timeout = setTimeout(update, globalTimeout);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ function(syscall, time, alerts, utils, rootScope, uri, authconf) {
|
||||||
|
|
||||||
if (failed) {
|
if (failed) {
|
||||||
alerts.addAlert('<strong>Oh Snap!</strong> Authentication failed while connecting to Aria2 RPC server. Will retry in 10 secs. You might want to confirm your authentication details by going to Settings > Connection Settings', 'error');
|
alerts.addAlert('<strong>Oh Snap!</strong> Authentication failed while connecting to Aria2 RPC server. Will retry in 10 secs. You might want to confirm your authentication details by going to Settings > Connection Settings', 'error');
|
||||||
timeout = setTimeout(update, $globalTimeout);
|
timeout = setTimeout(update, globalTimeout);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ function(syscall, time, alerts, utils, rootScope, uri, authconf) {
|
||||||
timeout = setTimeout(update, 0);
|
timeout = setTimeout(update, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
timeout = setTimeout(update, time);
|
timeout = setTimeout(update, globalTimeout);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: error
|
error: error
|
||||||
|
@ -161,7 +161,7 @@ function(syscall, time, alerts, utils, rootScope, uri, authconf) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// initiate the update loop
|
// initiate the update loop
|
||||||
timeout = setTimeout(update, time);
|
timeout = setTimeout(update, globalTimeout);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// conf can be configuration or array of configurations,
|
// conf can be configuration or array of configurations,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user