support set rpc interface path

This commit is contained in:
MaysWind 2016-12-31 23:02:05 +08:00
parent d652b088fc
commit 2e18f5802b
5 changed files with 19 additions and 2 deletions

View file

@ -126,6 +126,7 @@ Page Title Refresh Interval=页面标题刷新间隔
Enable Browser Notification=启用浏览器通知
Aria2 RPC Host=Aria2 RPC 主机
Aria2 RPC Port=Aria2 RPC 端口
Aria2 RPC Interface=Aria2 RPC 接口
Aria2 RPC Protocol=Aria2 RPC 协议
Aria2 RPC Http Request Method=Aria2 RPC Http 请求方法
POST method only supports aria2 v1.15.2 and above.=POST 方法仅支持 aria2 v1.15.2 及以上.

View file

@ -22,6 +22,7 @@
browserNotification: false,
rpcHost: '',
rpcPort: '6800',
rpcInterface: 'jsonrpc',
protocol: 'http',
httpMethod: 'POST',
secret: '',

View file

@ -130,6 +130,7 @@
'Enable Browser Notification': 'Enable Browser Notification',
'Aria2 RPC Host': 'Aria2 RPC Host',
'Aria2 RPC Port': 'Aria2 RPC Port',
'Aria2 RPC Interface': 'Aria2 RPC Interface',
'Aria2 RPC Protocol': 'Aria2 RPC Protocol',
'Aria2 RPC Http Request Method': 'Aria2 RPC Http Request Method',
'POST method only supports aria2 v1.15.2 and above.': 'POST method only supports aria2 v1.15.2 and above.',

View file

@ -163,12 +163,13 @@
var protocol = getOption('protocol');
var rpcHost = getOption('rpcHost');
var rpcPort = getOption('rpcPort');
var rpcInterface = getOption('rpcInterface');
if (!rpcHost) {
rpcHost = getDefaultRpcHost();
}
return protocol + '://' + rpcHost + ':' + rpcPort + '/jsonrpc';
return protocol + '://' + rpcHost + ':' + rpcPort + '/' + rpcInterface;
},
setRpcHost: function (value) {
setOption('rpcHost', value);
@ -176,6 +177,9 @@
setRpcPort: function (value) {
setOption('rpcPort', Math.max(parseInt(value), 0));
},
setRpcInterface: function (value) {
setOption('rpcInterface', value);
},
getProtocol: function () {
return getOption('protocol');
},

View file

@ -117,7 +117,7 @@
<span class="input-group-addon" style="border-left: 0">:</span>
<span class="input-group-addon" ng-bind="context.settings.rpcPort" style="border-left: 0"></span>
<span class="input-group-addon" style="border-left: 0">/</span>
<span class="input-group-addon">jsonrpc</span>
<span class="input-group-addon" ng-if="context.settings.rpcInterface" ng-bind="context.settings.rpcInterface"></span>
</div>
</div>
</div>
@ -131,6 +131,16 @@
ng-change="settingService.setRpcPort(context.settings.rpcPort)"/>
</div>
</div>
<div class="row">
<div class="setting-key setting-key-without-desc col-sm-4">
<span translate>Aria2 RPC Interface</span>
<span class="asterisk">*</span>
</div>
<div class="setting-value col-sm-8">
<input class="form-control" type="text" ng-model="context.settings.rpcInterface"
ng-change="settingService.setRpcInterface(context.settings.rpcInterface)"/>
</div>
</div>
<div class="row">
<div class="setting-key setting-key-without-desc col-sm-4">
<span translate>Aria2 RPC Protocol</span>