Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
FROM alpine:3.16.0 as builder

ARG ARIANG_VERSION=1.3.6
RUN apk update
RUN apk add npm git
RUN npm install -g gulp

ADD https://github.com/mayswind/AriaNg/archive/refs/tags/${ARIANG_VERSION}.zip /ariang.zip
RUN mkdir -p /ariang
RUN unzip -x /ariang.zip -d /ariang

COPY ./patchs /patchs

WORKDIR /ariang/AriaNg-${ARIANG_VERSION}
RUN git apply /patchs/*.patch
RUN npm install
RUN gulp clean build

FROM alpine:3.16.0

ARG ARIANG_VERSION
ARG ARIANG_VERSION=1.3.6
ARG BUILD_DATE
ARG VCS_REF

ENV ARIA2RPCPORT=8080

LABEL maintainer="hurlenko" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="aria2-ariang" \
Expand All @@ -25,11 +41,7 @@ RUN apk update \
# AriaNG
WORKDIR /usr/local/www/ariang

RUN wget --no-check-certificate https://github.com/mayswind/AriaNg/releases/download/${ARIANG_VERSION}/AriaNg-${ARIANG_VERSION}.zip \
-O ariang.zip \
&& unzip ariang.zip \
&& rm ariang.zip \
&& chmod -R 755 ./
COPY --from=builder /ariang/AriaNg-${ARIANG_VERSION}/dist ./

WORKDIR /aria2

Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ docker run -d \
-v /CONFIG_DIR:/aria2/conf \
-e PUID=1000 \
-e PGID=1000 \
-e ARIA2RPCPORT=443 \
-e RPC_SECRET=NOBODYKNOWSME \
hurlenko/aria2-ariang
```
Expand All @@ -92,7 +91,6 @@ services:
- PUID=1000
- PGID=1000
- RPC_SECRET=secret
- ARIA2RPCPORT=443
restart: always
```

Expand Down Expand Up @@ -131,7 +129,6 @@ location / {
- `EMBED_RPC_SECRET` - INSECURE: embeds `RPC_SECRET` into web ui js code. This allows you to skip entering the secret but everyone who has access to the webui will be able to see it. Only use this with some sort of authentication (e.g. basic auth)
- `BASIC_AUTH_USERNAME` - username for basic auth
- `BASIC_AUTH_PASSWORD` - password for basic auth
- `ARIA2RPCPORT` - The port that will be used for rpc calls to aria2. Usually you want to set it to the port your website is running on. For example if your AriaNg instance is accessible on `https://ariang.mysite.com` you need to set `ARIA2RPCPORT` to `443` (default https port), otherwise AriaNg won't be able to access aria2 rpc running on the default port `8080`. You can set the port in the web ui by going to `AriaNg Settings` > `Rpc` tab > `Aria2 RPC Address` field, and changing the default rpc port to whatever you need, but this has to be done per browser.

> Note, both `BASIC_AUTH_USERNAME` and `BASIC_AUTH_PASSWORD` must be set in order to enable basic authentication.

Expand Down
66 changes: 66 additions & 0 deletions patchs/0001-RPC.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From b98c68d13b120d2cd2bf83a4ec4d146909e294bc Mon Sep 17 00:00:00 2001
From: FindlayFeng <i@fengch.me>
Date: Sat, 24 Jun 2023 20:33:53 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20RPC=E8=BF=9E=E6=8E=A5?=
=?UTF-8?q?=E7=9A=84=E9=BB=98=E8=AE=A4=E5=80=BC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: FindlayFeng <i@fengch.me>
---
src/scripts/services/ariaNgSettingService.js | 31 +++++++++++++++++---
1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/scripts/services/ariaNgSettingService.js b/src/scripts/services/ariaNgSettingService.js
index 2d9b633..2a6f818 100644
--- a/src/scripts/services/ariaNgSettingService.js
+++ b/src/scripts/services/ariaNgSettingService.js
@@ -134,6 +134,31 @@
return ariaNgConstants.defaultHost;
};

+ var getDefaultRpcProtocol = function () {
+ if (isInsecureProtocolDisabled()) {
+ return ariaNgConstants.defaultSecureProtocol;
+ }
+
+ return "http";
+ }
+
+ var getDefaultRpcPort = function () {
+ var currentPort = window.location.port;
+
+ if (currentPort) {
+ return currentPort;
+ }
+
+ switch (getDefaultRpcProtocol()) {
+ case "https":
+ return "443";
+ case "http":
+ return "80";
+ default:
+ return "6800";
+ }
+ }
+
var setOptions = function (options) {
return ariaNgStorageService.set(ariaNgConstants.optionStorageKey, options);
};
@@ -194,10 +219,8 @@

var initRpcSettingWithDefaultHostAndProtocol = function (setting) {
setting.rpcHost = getDefaultRpcHost();
-
- if (isInsecureProtocolDisabled()) {
- setting.protocol = ariaNgConstants.defaultSecureProtocol;
- }
+ setting.rpcPort= getDefaultRpcPort();
+ setting.protocol = getDefaultRpcProtocol();
};

var cloneRpcSetting = function (setting) {
--
2.41.0

5 changes: 0 additions & 5 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ fi

touch $conf_path/aria2.session

if [[ -n "$ARIA2RPCPORT" ]]; then
echo "Changing rpc request port to $ARIA2RPCPORT"
sed -i "s/6800/${ARIA2RPCPORT}/g" $ariang_js_path
fi

userid="$(id -u)" # 65534 - nobody, 0 - root
groupid="$(id -g)"

Expand Down