After modifying the rpc secret, it need to refresh the page to take effect
This commit is contained in:
parent
3594cf8c50
commit
127f9a457d
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
angular.module('ariaNg').factory('aria2RpcService', ['$q', 'aria2RpcConstants', 'ariaNgCommonService', 'ariaNgSettingService', 'aria2HttpRpcService', 'aria2WebSocketRpcService', function ($q, aria2RpcConstants, ariaNgCommonService, ariaNgSettingService, aria2HttpRpcService, aria2WebSocketRpcService) {
|
angular.module('ariaNg').factory('aria2RpcService', ['$q', 'aria2RpcConstants', 'ariaNgCommonService', 'ariaNgSettingService', 'aria2HttpRpcService', 'aria2WebSocketRpcService', function ($q, aria2RpcConstants, ariaNgCommonService, ariaNgSettingService, aria2HttpRpcService, aria2WebSocketRpcService) {
|
||||||
var protocol = ariaNgSettingService.getProtocol();
|
var protocol = ariaNgSettingService.getProtocol();
|
||||||
|
var secret = ariaNgSettingService.getSecret();
|
||||||
|
|
||||||
var checkIsSystemMethod = function (methodName) {
|
var checkIsSystemMethod = function (methodName) {
|
||||||
return methodName.indexOf(aria2RpcConstants.rpcSystemServiceName + '.') == 0;
|
return methodName.indexOf(aria2RpcConstants.rpcSystemServiceName + '.') == 0;
|
||||||
|
@ -14,11 +15,10 @@
|
||||||
|
|
||||||
var invoke = function (method, context) {
|
var invoke = function (method, context) {
|
||||||
var isSystemMethod = checkIsSystemMethod(method);
|
var isSystemMethod = checkIsSystemMethod(method);
|
||||||
var rpcSecretToken = ariaNgSettingService.getSecret();
|
|
||||||
var finalParams = [];
|
var finalParams = [];
|
||||||
|
|
||||||
if (rpcSecretToken && !isSystemMethod) {
|
if (secret && !isSystemMethod) {
|
||||||
finalParams.push(aria2RpcConstants.rpcTokenPrefix + rpcSecretToken);
|
finalParams.push(aria2RpcConstants.rpcTokenPrefix + secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (angular.isArray(context.params) && context.params.length > 0) {
|
if (angular.isArray(context.params) && context.params.length > 0) {
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="setting-key setting-key-without-desc col-sm-4">
|
<div class="setting-key setting-key-without-desc col-sm-4">
|
||||||
<span translate>Aria2 RPC Secret Token</span>
|
<span translate>Aria2 RPC Secret Token</span>
|
||||||
|
<span class="asterisk">*</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-value col-sm-8">
|
<div class="setting-value col-sm-8">
|
||||||
<input class="form-control" type="password" ng-model="settings.secret" ng-change="settingService.setSecret(settings.secret)"/>
|
<input class="form-control" type="password" ng-model="settings.secret" ng-change="settingService.setSecret(settings.secret)"/>
|
||||||
|
|
Reference in a new issue