Merge pull request #367 from ziahamza/master

Release
This commit is contained in:
hamza zia 2017-07-27 09:26:33 +05:00 committed by GitHub
commit 2450b26301
3 changed files with 51 additions and 2 deletions

View File

@ -13,7 +13,10 @@ aria2c --enable-rpc --rpc-listen-all
If aria2 is not installed in your local machine then head on to https://aria2.github.io/ and follow the instructions there.
Then download the webui, you can either do that by downloading this repository and running index.html in the browser. Or you could just head on to https://ziahamza.github.io/webui-aria2/ and just start downloading files! After that you can also save it for offline use by saving from the browser save page as option.
Then download the webui, you can either do that by downloading this repository and running index.html in the browser. Or you could just head on to https://ziahamza.github.io/webui-aria2/ and just start downloading files! After that you can also save it for offline use by saving from the browser save page as option. You can also use node js to create simple server by using the following command from the download folder.
````bash
node node-server.js
````
Tips
====

View File

@ -79,7 +79,17 @@ angular
parse: function() {
return _
.chain(this.uris.trim().split(/\r?\n/g))
.map(function(d) { return d.trim().split(/\s+/g) })
.map(function(d) {
return _(d)
.replace(/("[^"]*")/g, function(c) {
return c.replace('%','%25').replace(' ','%20');
})
.trim()
.split(/\s+/g)
.map(function(c) {
return c.replace('%20',' ').replace('%25','%').replace(/"/g,'');
});
})
.filter(function(d) { return d.length })
.value();
}

36
node-server.js Normal file
View File

@ -0,0 +1,36 @@
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname,
filename = path.join(process.cwd(), uri);
fs.exists(filename, function(exists) {
if(!exists) {
response.writeHead(404, {"Content-Type": "text/plain"});
response.write("404 Not Found\n");
response.end();
return;
}
if (fs.statSync(filename).isDirectory()) filename += '/index.html';
fs.readFile(filename, "binary", function(err, file) {
if(err) {
response.writeHead(500, {"Content-Type": "text/plain"});
response.write(err + "\n");
response.end();
return;
}
response.writeHead(200);
response.write(file, "binary");
response.end();
});
});
}).listen(parseInt(port, 10));
console.log("WebUI Aria2 Server is running on http://localhost:" + port );