After modifying the rpc secret, it need to refresh the page to take effect

This commit is contained in:
MaysWind 2016-06-05 14:40:13 +08:00
parent 3594cf8c50
commit 127f9a457d
2 changed files with 4 additions and 3 deletions

View file

@ -3,6 +3,7 @@
angular.module('ariaNg').factory('aria2RpcService', ['$q', 'aria2RpcConstants', 'ariaNgCommonService', 'ariaNgSettingService', 'aria2HttpRpcService', 'aria2WebSocketRpcService', function ($q, aria2RpcConstants, ariaNgCommonService, ariaNgSettingService, aria2HttpRpcService, aria2WebSocketRpcService) {
var protocol = ariaNgSettingService.getProtocol();
var secret = ariaNgSettingService.getSecret();
var checkIsSystemMethod = function (methodName) {
return methodName.indexOf(aria2RpcConstants.rpcSystemServiceName + '.') == 0;
@ -14,11 +15,10 @@
var invoke = function (method, context) {
var isSystemMethod = checkIsSystemMethod(method);
var rpcSecretToken = ariaNgSettingService.getSecret();
var finalParams = [];
if (rpcSecretToken && !isSystemMethod) {
finalParams.push(aria2RpcConstants.rpcTokenPrefix + rpcSecretToken);
if (secret && !isSystemMethod) {
finalParams.push(aria2RpcConstants.rpcTokenPrefix + secret);
}
if (angular.isArray(context.params) && context.params.length > 0) {

View file

@ -51,6 +51,7 @@
<div class="row">
<div class="setting-key setting-key-without-desc col-sm-4">
<span translate>Aria2 RPC Secret Token</span>
<span class="asterisk">*</span>
</div>
<div class="setting-value col-sm-8">
<input class="form-control" type="password" ng-model="settings.secret" ng-change="settingService.setSecret(settings.secret)"/>