🗃️ Committing everything that changed 🗃️

This commit is contained in:
casjay 2023-03-16 03:01:45 -04:00
parent 3563933e2e
commit e58cbdedc7
No known key found for this signature in database
GPG Key ID: 4F765975C1F0EE5F
5 changed files with 17 additions and 24 deletions

View File

@ -40,7 +40,7 @@ get_config="$(find "$www_dir/js" -name 'aria-ng-*.min.js' | grep -v 'f1dd57abb9.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# use this function to update config files - IE: change port # use this function to update config files - IE: change port
__update_conf_files() { __update_conf_files() {
local port="${SERVICE_PORT:-${ARIA2RPCPORT:-8000}}" local port="${SERVICE_PORT:-8000}"
[ -d "$etc_dir" ] || mkdir -p "$etc_dir" [ -d "$etc_dir" ] || mkdir -p "$etc_dir"
[ -d "$data_dir" ] || mkdir -p "$data_dir" [ -d "$data_dir" ] || mkdir -p "$data_dir"
[ -d "/data/logs/aria2" ] || mkdir -p "/data/logs/aria2" [ -d "/data/logs/aria2" ] || mkdir -p "/data/logs/aria2"
@ -50,16 +50,17 @@ __update_conf_files() {
rm -Rf "$get_config" rm -Rf "$get_config"
ln -sf "$etc_dir/aria-ng.config.js" "$get_config" ln -sf "$etc_dir/aria-ng.config.js" "$get_config"
ln -sf "$etc_dir/aria-ng.config.js" "$www_dir/js/aria-ng-f1dd57abb9.min.js" ln -sf "$etc_dir/aria-ng.config.js" "$www_dir/js/aria-ng-f1dd57abb9.min.js"
__replace "127.0.0.1" "0.0.0.0" "$etc_dir/aria-ng.config.js"
fi fi
if [ -n "$RPC_SECRET" ]; then if [ -n "$RPC_SECRET" ]; then
echo "Changing rpc secret to $RPC_SECRET" echo "Changing rpc secret to $RPC_SECRET"
if grep -sq "rpc-secret=*" "$etc_dir/aria2.conf"; then if grep -sq "rpc-secret=" "$etc_dir/aria2.conf"; then
sed -i "s|secret: '',|secret: ''$RPC_SECRET'',|g" "$www_dir/js/aria-ng.config.js" __replace "REPLACE_RPC_SECRET" "$RPC_SECRET" "$www_dir/js/aria-ng.config.js"
sed -i "s|rpc-secret=.*|rpc-secret=$RPC_SECRET|g" "$etc_dir/aria2.conf" __replace "REPLACE_RPC_SECRET" "$RPC_SECRET" "$etc_dir/aria2.conf"
else else
echo "rpc-secret=$RPC_SECRET" >>"$etc_dir/aria2.conf" echo "rpc-secret=$RPC_SECRET" >>"$etc_dir/aria2.conf"
fi fi
else
__replace "rpc-secret=" "#rpc-secret=" "$etc_dir/aria2.conf"
fi fi
return 0 return 0

View File

@ -25,7 +25,7 @@ done
WORKDIR="" # set working directory WORKDIR="" # set working directory
SERVICE_UID="0" # set the user id SERVICE_UID="0" # set the user id
SERVICE_USER="root" # execute command as another user SERVICE_USER="root" # execute command as another user
SERVICE_PORT="${PORT:-80}" # port which service is listening on SERVICE_PORT="80" # port which service is listening on
EXEC_CMD_BIN="nginx" # command to execute EXEC_CMD_BIN="nginx" # command to execute
EXEC_CMD_ARGS="-c /etc/nginx/nginx.conf" # command arguments EXEC_CMD_ARGS="-c /etc/nginx/nginx.conf" # command arguments
PRE_EXEC_MESSAGE="" # Show message before execute PRE_EXEC_MESSAGE="" # Show message before execute
@ -34,8 +34,9 @@ PRE_EXEC_MESSAGE="" # Show message before execute
data_dir="/data" data_dir="/data"
etc_dir="/etc/nginx" etc_dir="/etc/nginx"
conf_dir="/config/nginx" conf_dir="/config/nginx"
www_dir="${WWW_ROOT_DIR:-/data/htdocs}" www_dir="${WWW_ROOT_DIR:-/usr/local/share/ariang}"
nginx_bin="$(type -P 'nginx')" nginx_bin="$(type -P 'nginx')"
SERVICE_PORT="${ARIA2RPCPORT:-${PORT:-$SERVICE_PORT}}"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# use this function to update config files - IE: change port # use this function to update config files - IE: change port
__update_conf_files() { __update_conf_files() {
@ -44,12 +45,6 @@ __update_conf_files() {
chmod -Rf 777 "$data_dir/logs/nginx" chmod -Rf 777 "$data_dir/logs/nginx"
[ -d "$etc_dir" ] || mkdir -p "$etc_dir" [ -d "$etc_dir" ] || mkdir -p "$etc_dir"
[ -d "$conf_dir" ] && cp -Rf "$conf_dir/." "$etc_dir/" [ -d "$conf_dir" ] && cp -Rf "$conf_dir/." "$etc_dir/"
if [ "$SSL_ENABLED" = "true" ]; then
__file_copy "$conf_dir/nginx.ssl.conf" "$etc_dir/nginx.conf"
__file_copy "$conf_dir/vhosts.d/default.ssl.conf" "$etc_dir/vhosts.d/default.conf"
fi
[ -f "$etc_dir/nginx.ssl.conf" ] && rm -Rf "$etc_dir/nginx.ssl.conf"
[ -f "$etc_dir/vhosts.d/default.ssl.conf" ] && rm -Rf "$etc_dir/vhosts.d/default.ssl.conf"
# #
[ -d "$www_dir" ] || mkdir -p "$www_dir" [ -d "$www_dir" ] || mkdir -p "$www_dir"
[ -d "$www_dir/www/health" ] || mkdir -p "$www_dir/www/health" [ -d "$www_dir/www/health" ] || mkdir -p "$www_dir/www/health"
@ -58,12 +53,8 @@ __update_conf_files() {
# #
__replace "REPLACE_SERVER_PORT" "${SERVICE_PORT:-80}" "$etc_dir/nginx.conf" __replace "REPLACE_SERVER_PORT" "${SERVICE_PORT:-80}" "$etc_dir/nginx.conf"
__replace "REPLACE_SERVER_PORT" "${SERVICE_PORT:-80}" "$etc_dir/vhosts.d/default.conf" __replace "REPLACE_SERVER_PORT" "${SERVICE_PORT:-80}" "$etc_dir/vhosts.d/default.conf"
[ -f "$www_dir/www/index.php" ] && __replace "SERVER_SOFTWARE" "dns" "$www_dir/www/index.php" #
[ -f "$www_dir/www/index.html" ] && __replace "SERVER_SOFTWARE" "dns" "$www_dir/www/index.html" __replace "REPLACE_SERVER_PORT" "${SERVICE_PORT:-80}" "/etc/aria2/aria-ng.config.js"
if [ -z "$PHP_BIN_DIR" ]; then
[ -f "$www_dir/www/info.php" ] && echo "PHP support is not enabled" >"$www_dir/www/info.php"
[ -f "$etc_dir/conf.d/php-fpm.conf" ] && echo "# PHP support is not enabled" >"$etc_dir/conf.d/php-fpm.conf"
fi
return 0 return 0
} }

View File

@ -525,11 +525,11 @@
browserNotification: !1, browserNotification: !1,
rpcAlias: 'aria2', rpcAlias: 'aria2',
rpcHost: '127.0.0.1', rpcHost: '127.0.0.1',
rpcPort: '8000', rpcPort: 'REPLACE_SERVER_PORT',
rpcInterface: 'jsonrpc', rpcInterface: 'jsonrpc',
protocol: 'http', protocol: 'http',
httpMethod: 'POST', httpMethod: 'POST',
secret: '', secret: 'REPLACE_RPC_SECRET',
extendRpcServers: [], extendRpcServers: [],
globalStatRefreshInterval: 1e3, globalStatRefreshInterval: 1e3,
downloadTaskRefreshInterval: 1e3, downloadTaskRefreshInterval: 1e3,

View File

@ -4,9 +4,10 @@ log=/data/logs/aria2/aria2.log
input-file=/config/aria2/aria2.session input-file=/config/aria2/aria2.session
save-session=/config/aria2/aria2.session save-session=/config/aria2/aria2.session
enable-rpc=true enable-rpc=true
rpc-listen-port=8000 rpc-listen-port=6800
rpc-allow-origin-all=true rpc-allow-origin-all=true
rpc-listen-all=true rpc-listen-all=true
rpc-secret=REPLACE_RPC_SECRET
disable-ipv6=true disable-ipv6=true
max-concurrent-downloads=5 max-concurrent-downloads=5
continue=true continue=true

View File

@ -35,7 +35,7 @@ http {
add_header Content-Security-Policy "script-src 'self' 'unsafe-inline' 'unsafe-eval' *; frame-src 'self' *; object-src 'self'" always; add_header Content-Security-Policy "script-src 'self' 'unsafe-inline' 'unsafe-eval' *; frame-src 'self' *; object-src 'self'" always;
location /jsonrpc { location /jsonrpc {
proxy_pass http://127.0.0.1:8000/jsonrpc; proxy_pass http://127.0.0.1:6800/jsonrpc;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
@ -43,7 +43,7 @@ http {
} }
location /rpc { location /rpc {
proxy_pass http://127.0.0.1:8000/jsonrpc; proxy_pass http://127.0.0.1:6800/jsonrpc;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";