added custom aria2 rpc path setting. Fixes #161

This commit is contained in:
hamza zia 2015-09-12 16:55:02 +08:00
parent 7255e42cc4
commit 34b6d97be6
5 changed files with 26 additions and 4 deletions

View File

@ -5,6 +5,7 @@ angular
.constant('$pageSize', 11) // number of downloads shown before pagination kicks in
.constant('$authconf', { // default authentication configuration, never fill it in case the webui is hosted in public IP as it can be compromised
host: 'localhost',
path: '/jsonrpc',
port: 6800,
encrypt: false,
auth: { // either add the token field or the user and pass field, not both.

View File

@ -944,6 +944,20 @@ http://ex1.com/f2.mp4 http://ex2.com/f2.mp4 --out=file2.mp4
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Enter the rpc path:</label>
<div class="col-sm-9 controls">
<div class="input-group">
<span class="input-group-addon">http(s)://{{connection.conf.host + ':' + connection.conf.port}}</span>
<input type="text" class="form-control input-xlarge"
ng-model="connection.conf.path"/>
</div>
<p class="help-block">
Enter path for the aria2 rpc endpoint (default = /jsonrpc)
</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">SSL/TLS encryption:</label>
<div class="col-sm-9 controls">

View File

@ -35,7 +35,7 @@ angular
var rpc = this;
var scheme = rpc.serverConf.encrypt ? 'https' : 'http';
rpc.ariaRequest(
scheme + '://' + rpc.serverConf.host + ':' + rpc.serverConf.port + '/jsonrpc',
scheme + '://' + rpc.serverConf.host + ':' + rpc.serverConf.port + (rpc.serverConf.path || '/jsonrpc'),
opts.name,
opts.params,
opts.success,
@ -51,7 +51,7 @@ angular
rpc.serverConf.auth.user + ":" +
rpc.serverConf.auth.pass + "@" +
rpc.serverConf.host + ':' +
rpc.serverConf.port + '/jsonrpc';
rpc.serverConf.port + (rpc.serverConf.path || '/jsonrpc');
// hack is to basically inject an image with same uri as the aria2 rpc url,
// most browsers will then cache the authentication details and we dont have

View File

@ -24,8 +24,15 @@ function(syscall, time, alerts, utils, rootScope, uri, authconf) {
console.log(uri.host());
configurations.push({
host: uri.host(),
path: '/jsonrpc',
port: 6800,
encrypt: false
},
{
host: uri.host(),
port: uri.port(),
path: '/jsonrpc',
encrypt: ( uri.protocol() == 'https' )
});
console.log(configurations);
}

View File

@ -94,13 +94,13 @@ function(_, JSON, name, utils, alerts) {
}
try {
var authUrl = sockRPC.scheme + '://' + conf.host + ':' + conf.port + '/jsonrpc';
var authUrl = sockRPC.scheme + '://' + conf.host + ':' + conf.port + (conf.path || '/jsonrpc');
if (sockRPC.conf.auth && sockRPC.conf.auth.user && sockRPC.conf.auth.pass) {
authUrl = sockRPC.scheme + '://' +
sockRPC.conf.auth.user + ":" +
sockRPC.conf.auth.pass + "@" +
sockRPC.conf.host + ':' +
sockRPC.conf.port + '/jsonrpc';
sockRPC.conf.port + (conf.path || '/jsonrpc');
}
sockRPC.sock = new WebSocket(authUrl);