commit
a497a08465
|
@ -23,6 +23,12 @@ Configuration
|
|||
=============
|
||||
Read and edit [configuration.js](configuration.js).
|
||||
|
||||
DirectURL
|
||||
---------
|
||||
If you are familiar with how webservers work, setup a location that points at the configured download directory, check permissions. Specify a full url: ```http://server:port/```
|
||||
|
||||
If the above is not obvious, keep reading what this is about in [directurl.md](directurl.md)
|
||||
|
||||
Dependencies
|
||||
============
|
||||
Well, you need aria2. And a web browser (if that even counts!)
|
||||
|
|
|
@ -12,7 +12,8 @@ angular
|
|||
/*-----------------------------*/
|
||||
// user: '*YOUR_USERNAME*',
|
||||
// pass: '*YOUR_SECRET_PASS*'
|
||||
}
|
||||
},
|
||||
directURL: '' // If supplied, links will be created to enable direct download from the aria2 server, requires appropriate webserver to be configured
|
||||
})
|
||||
.constant('$enable', {
|
||||
|
||||
|
|
|
@ -100,3 +100,6 @@
|
|||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.download-files a {
|
||||
color: #fff;
|
||||
}
|
||||
|
|
64
directurl.md
Normal file
64
directurl.md
Normal file
|
@ -0,0 +1,64 @@
|
|||
DirectURL
|
||||
=========
|
||||
Consider the following scenarios:
|
||||
|
||||
1. aria2 is running on a computer that is not locally accessible via the LAN and the files need to be copied from remote aria2 computer to the local computer
|
||||
2. aria2 is running locally somewhere and setting up samba/nfs/etc is "meh"
|
||||
|
||||
HTTP to the rescue, already in the browser right?
|
||||
|
||||
Simplest way is to use a straightforward Node.js library. In the below complete prescription [send](https://github.com/pillarjs/send) will be used.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
Node.js & NPM
|
||||
|
||||
Follow relevant section: [Installing Node.js via package manager](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager)
|
||||
|
||||
Steps
|
||||
-----
|
||||
1. as part of configuring aria2 to make life easier you will have set the global **dir** option to something like **/home/aria2/downloads**
|
||||
2. clearly this folder is owned by the user **aria2**
|
||||
3. open a shell session logged in as **aria2**
|
||||
4. run ```cd /home/aria2/downloads```
|
||||
5. run ```npm install send```
|
||||
6. run ```nano send.js``` or vi if that's your thing
|
||||
7. paste the content from below **send.js**
|
||||
8. save the file making changes where appropriate _(follow the comments)_
|
||||
9. run ```node send.js```
|
||||
10. webserver is now running on port 3000 and will serve files from the directory specified
|
||||
11. to test open up http://serverip:3000 - should get a response from the webserver, 2 lines of text, any browser errors and something hasn't been done properly, check IP/PORT etc
|
||||
12. go back to webui-aria2
|
||||
13. go to ```Settings > Connection Settings```
|
||||
14. scroll down to Direct Download and put ```http://serverip:3000/``` in base URL field _(make sure have the / on the end)_
|
||||
15. now that URL has been specified all the files will be converted into clickable links
|
||||
16. checkout the ```more info``` on a download and see for yourself
|
||||
17. if you click on files that aren't finished downloading ```you're going to have a bad day```
|
||||
|
||||
### send.js
|
||||
|
||||
```js
|
||||
var http = require('http');
|
||||
var send = require('send');
|
||||
var url = require('url');
|
||||
|
||||
var app = http.createServer(function(req, res){
|
||||
// this one allows the service to fail gracefully and give some feedback
|
||||
function error(err) {
|
||||
res.statusCode = err.status || 500;
|
||||
res.end(err.message);
|
||||
}
|
||||
|
||||
// this just makes sure everything is downloaded and not opened in the browser
|
||||
function headers(res, path, stat) {
|
||||
res.setHeader('Content-Disposition', 'attachment');
|
||||
}
|
||||
|
||||
// specify the same directory that aria2 is using to save files
|
||||
// not sure exactly how windows paths should be done, see if 'c:\downloads' works..
|
||||
send(req, url.parse(req.url).pathname, {root: '/home/aria2/downloads'})
|
||||
.on('error', error)
|
||||
.on('headers', headers)
|
||||
.pipe(res);
|
||||
}).listen(3000); // change this to .listen(3000,'127.0.0.1') to only respond to localhost requests then access via SSH tunnel or put stunnel in front of it etc
|
||||
```
|
21
index.html
21
index.html
|
@ -44,6 +44,7 @@
|
|||
<script src="js/directives/fselect.js"></script>
|
||||
|
||||
<script src="js/filters/bytes.js"></script>
|
||||
<script src="js/filters/url.js"></script>
|
||||
|
||||
<script src="js/services/deps.js"></script>
|
||||
<script src="js/services/base64.js"></script>
|
||||
|
@ -584,7 +585,10 @@
|
|||
<li class="label label-default" title="Download Path"><i class="fa fa-fw fa-folder-open"> </i> <span class="download-dir">{{download.dir}}</span></li>
|
||||
</ul>
|
||||
<ul class="download-files hidden-phone download-item">
|
||||
<li class="label label-default" ng-repeat="file in download.files" ng-class="{'label-success': file.selected}">{{file.relpath}} ({{file.fmtLength}})</li>
|
||||
<li class="label label-default" ng-repeat="file in download.files" ng-class="{'label-success': file.selected}">
|
||||
<a ng-if="hasDirectURL()" ng-click="$event.stopPropagation()" ng-href="{{getDirectURL()}}{{file.relpath | encodeURI}}" target="download">{{file.relpath}} ({{file.fmtLength}})</a>
|
||||
<span ng-if="!hasDirectURL()">{{file.relpath}} ({{file.fmtLength}})</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div ng-show="hasStatus(download, 'active')" class="download-item hidden-phone">
|
||||
<div class="download-graph" dspeed="download.downloadSpeed" uspeed="download.uploadSpeed" xticks="7" yticks="7" dgraph draw="!download.collapsed"></div>
|
||||
|
@ -988,6 +992,21 @@ http://ex1.com/f2.mp4 http://ex2.com/f2.mp4 --out=file2.mp4
|
|||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Direct Download</legend>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">Enter base URL (optional):</label>
|
||||
<div class="col-sm-9 controls">
|
||||
<input type="text" class="form-control input-xlarge"
|
||||
ng-model="connection.conf.directURL"/>
|
||||
<p class="help-block">
|
||||
If supplied, links will be created to enable direct download from the
|
||||
aria2 server, requires appropriate webserver to be configured
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
|
|
@ -357,6 +357,14 @@ function(
|
|||
return downloads;
|
||||
}
|
||||
|
||||
scope.hasDirectURL = function() {
|
||||
return rpc.getDirectURL() != '';
|
||||
}
|
||||
|
||||
scope.getDirectURL = function() {
|
||||
return rpc.getDirectURL();
|
||||
}
|
||||
|
||||
// convert the donwload form aria2 to once used by the view,
|
||||
// minor additions of some fields and checks
|
||||
scope.getCtx = function(d, ctx) {
|
||||
|
|
4
js/filters/url.js
Normal file
4
js/filters/url.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
angular.module('webui.filters.url', ["webui.services.utils"])
|
||||
.filter('encodeURI', function() {
|
||||
return window.encodeURIComponent;
|
||||
});
|
|
@ -3,7 +3,7 @@ var webui = angular.module('webui', [
|
|||
'webui.services.configuration', 'webui.services.rpc',
|
||||
'webui.services.modals', 'webui.services.alerts',
|
||||
'webui.services.settings', 'webui.services.settings.filters',
|
||||
'webui.filters.bytes',
|
||||
'webui.filters.bytes','webui.filters.url',
|
||||
'webui.directives.chunkbar', 'webui.directives.dgraph', 'webui.directives.fselect',
|
||||
'webui.ctrls.download', 'webui.ctrls.nav', 'webui.ctrls.modal', 'webui.ctrls.alert',
|
||||
'webui.ctrls.props',
|
||||
|
|
|
@ -171,6 +171,9 @@ function(syscall, time, alerts, utils, rootScope, uri, authconf) {
|
|||
// get current configuration being used
|
||||
getConfiguration: function() { return currentConf },
|
||||
|
||||
// get currently configured directURL
|
||||
getDirectURL : function() { return currentConf.directURL },
|
||||
|
||||
// syscall is done only once, delay is optional
|
||||
// and pass true to only dispatch it in the global timeout
|
||||
// which can be used to batch up once calls
|
||||
|
|
Loading…
Reference in New Issue
Block a user