This commit is contained in:
Alexandre
2020-12-14 17:39:09 +01:00
2 changed files with 9 additions and 24 deletions

View File

@@ -4,30 +4,8 @@ FROM $BUILD_FROM
# Copy root filesystem
COPY rootfs /
# Small hack needed for ingress support
#
# Transmission always uses "transmission" as a subdirectory in the URL, so the web interface can for instance be found at:
#
# http://<server>/transmission/web/
#
# The same goes for the RPC API, which is exposed under /transmission/rpc. When using ingress, this is not the case however
# and "transmission" directory is not part of the URL. So transmission is basically served under the root (/), e.g.:
#
# http://10.0.10.110:8123/api/hassio_ingress/rQEi5X4zJFTmZ82ghplDjsx2AoK3r2lqx0zZHHjZ69Q/
#
# As the web UI uses a relative path when resolving the RPC endpoint, it basically becomes:
#
# http://10.0.10.110:8123/api/hassio_ingress/rQEi5X4zJFTmZ82ghplDjsx2AoK3r2lqx0zZHHjZ69Q/../rpc
#
# which obviously is:
#
# http://10.0.10.110:8123/api/hassio_ingress
#
# This will not work. The sed statement below changes the way the RPC endpoint is determined by keeping the regular endpoint
# when accessing transmission as usual, but stripping the relative part when using ingress.
RUN sed -i 's|'"'"'\.\./rpc'"'"'|window.location.pathname.endsWith("/web/") ? "../rpc" : "rpc"|' /usr/share/transmission/web/javascript/remote.js
# MOFIFY DATA PATH
RUN sed -i "s|config|share/transmission|g" /etc/services.d/transmission/run
RUN sed -i "s|config|share/transmission|g" /etc/services.d/transmission/run \
&& sed -i "s|config|share/transmission|g" /etc/cont-init.d/20-config
VOLUME [ "/data" ]

View File

@@ -2,6 +2,7 @@
# ==============================================================================
declare CONFIG
declare SYSCTL
declare incomplete_bool
declare download_dir
declare incomplete_dir
@@ -28,3 +29,9 @@ CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-host-whitelist-enabled\"=false")
CONFIG=$(bashio::jq "${CONFIG}" ".\"bind-address-ipv4\"=\"0.0.0.0\"")
echo "${CONFIG}" > /share/transmission/settings.json
# Adapt UDP
SYSCTL=$(</etc/sysctl.conf)
SYSCTL=$(bashio::jq "${SYSCTL}" ".\"net.core.rmem_max\"=\"4194304")
SYSCTL=$(bashio::jq "${SYSCTL}" ".\"net.core.wmem_max\"=\"1048576")
echo "${SYSCTL}" > /etc/sysctl.conf