Merge pull request #1 from ziahamza/master

Merge from upstream
This commit is contained in:
0xDEADBEEF 2017-11-16 11:53:26 +08:00 committed by GitHub
commit 98b9f96ddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 23 deletions

View File

@ -1,19 +1,18 @@
FROM resin/rpi-raspbian FROM resin/rpi-raspbian
# less priviledge user, the id should map the user the downloaded files belongs to # less priviledge user, the id should map the user the downloaded files belongs to
RUN groupadd -r aria && useradd -r -g aria aria -u 1000 RUN groupadd -r aria && useradd -m -r -g aria aria -u 1000
# webui + aria2 # webui + aria2
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y busybox curl \ && apt-get install -y busybox curl git \
git \
make g++ libssl-dev nettle-dev libgmp-dev libssh2-1-dev libc-ares-dev libxml2-dev zlib1g-dev libsqlite3-dev pkg-config libxml2-dev libcppunit-dev autoconf automake autotools-dev autopoint libtool \ make g++ libssl-dev nettle-dev libgmp-dev libssh2-1-dev libc-ares-dev libxml2-dev zlib1g-dev libsqlite3-dev pkg-config libxml2-dev libcppunit-dev autoconf automake autotools-dev autopoint libtool \
&& ARIA2_VERSION="1.31.0" \ && ARIA2_VERSION="1.32.0" \
&& mkdir aria_build && cd aria_build \ && mkdir aria_build && cd aria_build \
&& curl -L https://github.com/aria2/aria2/releases/download/release-"$ARIA2_VERSION"/aria2-"$ARIA2_VERSION".tar.gz > aria2.tar.gz \ && curl -L https://github.com/aria2/aria2/releases/download/release-"$ARIA2_VERSION"/aria2-"$ARIA2_VERSION".tar.gz > aria2.tar.gz \
&& tar -xzf aria2.tar.gz \ && tar -xzf aria2.tar.gz \
&& cd aria2-$ARIA2_VERSION \ && cd aria2-$ARIA2_VERSION \
&& autoreconf -i && ./configure && make \ && autoreconf -i && ./configure && make \
&& mv src/aria2c /usr/bin/ \ && mv src/aria2c /usr/bin/ \
&& cd ../.. \ && cd ../.. \
&& rm -rf aria_build \ && rm -rf aria_build \
@ -30,7 +29,7 @@ RUN GITHUB_REPO="https://github.com/tianon/gosu" \
&& chmod +x /usr/local/bin/gosu && chmod +x /usr/local/bin/gosu
# goland install (compile source code for ARM since no version are currently available) # goland install (compile source code for ARM since no version are currently available)
RUN curl -L "https://storage.googleapis.com/golang/go1.8.linux-armv6l.tar.gz" > go.tar.gz \ RUN curl -L "https://storage.googleapis.com/golang/go1.9.1.linux-armv6l.tar.gz" > go.tar.gz \
&& tar -xzf go.tar.gz -C /usr/local \ && tar -xzf go.tar.gz -C /usr/local \
&& export GOROOT="/usr/local/go" && export GOPATH=`pwd` \ && export GOROOT="/usr/local/go" && export GOPATH=`pwd` \
&& $GOROOT/bin/go get github.com/mattn/goreman && $GOROOT/bin/go build -o /usr/local/bin/goreman github.com/mattn/goreman \ && $GOROOT/bin/go get github.com/mattn/goreman && $GOROOT/bin/go build -o /usr/local/bin/goreman github.com/mattn/goreman \
@ -39,10 +38,12 @@ RUN curl -L "https://storage.googleapis.com/golang/go1.8.linux-armv6l.tar.gz" >
&& unset GOROOT && unset GOPATH && unset GOROOT && unset GOPATH
# goreman setup # goreman setup
RUN echo "web: gosu aria /bin/busybox httpd -f -p 8080 -h /webui-aria2\nbackend: gosu aria /usr/bin/aria2c --conf-path=/data/.aria2/aria2.conf" > Procfile RUN echo "web: gosu aria /bin/busybox httpd -f -p 8080 -h /webui-aria2\nbackend: gosu aria /usr/bin/aria2c --conf-path=/home/aria/.aria2/aria2.conf /data/downloads/*.torrent" > Procfile
# aria2 downloads directory # aria2 downloads directory
VOLUME /data VOLUME /data/downloads
# aria2 conf directory
VOLUME /home/aria/.aria2
# aria2 RPC port, map as-is or reconfigure webui # aria2 RPC port, map as-is or reconfigure webui
EXPOSE 6800/tcp EXPOSE 6800/tcp

View File

@ -63,22 +63,27 @@ sudo docker run -v /Downloads:/data -p 6800:6800 -p 9100:8080 --name="webui-aria
This image contains both aria2 and webui-aria2. This image contains both aria2 and webui-aria2.
Build it (may take several hours due to the aria2 compilation process. Don't panic and grap a coffee) Build it (may take several hours due to the aria2 compilation process. Don't panic and grab a coffee)
``` ```
docker build -f Dockerfile.arm -t yourname/webui-aria2 . docker build -f Dockerfile.arm -t yourname/webui-aria2 .
``` ```
Prepare the host volume: Prepare the host volume:
This image required few file to be mounted in the container's `/data` folder. This image required few file to be mounted in the container.
``` ```
.aria2/session.txt (empty file) /home/aria/aria2/session.txt (empty file)
.aria2/aria2.log (empty file) /home/aria/aria2/aria2.log (empty file)
.aria2/aria2.conf (aria2 configuration file, not webui-aria2 conf) must contains at least `enable-rpc=true` and `rpc-listen-all=true` /home/aria/aria2/aria2.conf (aria2 configuration file, not webui-aria2 conf) must contains at least `enable-rpc=true` and `rpc-listen-all=true`
./downloads/ (where the downloaded files goes) /data/downloads/ (where the downloaded files goes)
``` ```
Run it Run it
``` ```
docker run --restart=always -d -v /home/<USER>/data/aria2:/data -p 6800:6800 -p 9100:8080 --name="webui-aria2" yourname/webui-aria2 docker run --restart=always \
-v /home/<USER>/data/aria2/downloads:/data/downloads \
-v /home/<USER>/data/aria2/.aria2:/home/aria/.aria2 \
-p 6800:6800 -p 9100:8080 \
--name="webui-aria2" \
-d yourname/webui-aria2
``` ```
Support Support

View File

@ -8,6 +8,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#0A8476">
<title ng-bind="$root.pageTitle">Aria2 WebUI</title> <title ng-bind="$root.pageTitle">Aria2 WebUI</title>

View File

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

View File

@ -107,7 +107,7 @@ function(syscall, globalTimeout, alerts, utils, rootScope, uri, authconf, filter
alerts.addAlert('<strong>' + filter('translate')('Oh Snap!') + '</strong> ' + alerts.addAlert('<strong>' + filter('translate')('Oh Snap!') + '</strong> ' +
filter('translate')('Could not connect to the aria2 RPC server. Will retry in 10 secs. You might want to check the connection settings by going to Settings > Connection Settings') filter('translate')('Could not connect to the aria2 RPC server. Will retry in 10 secs. You might want to check the connection settings by going to Settings > Connection Settings')
, 'error'); , 'error');
timeout = setTimeout(update, globalTimeout); // timeout = setTimeout(update, globalTimeout);
} }
}; };
@ -189,10 +189,9 @@ function(syscall, globalTimeout, alerts, utils, rootScope, uri, authconf, filter
else else
configurations = [conf]; configurations = [conf];
if (timeout) { if (timeout)
clearTimeout(timeout); clearTimeout(timeout);
timeout = setTimeout(update, 0); timeout = setTimeout(update, 0);
}
}, },
// get current configuration being used // get current configuration being used