From 9e152e3876ae73323c65e4912be606edaca0e06b Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Mon, 3 Feb 2025 12:30:22 +0000 Subject: [PATCH] custom_html for serving whatever html you like fixes: https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder/issues/177 --- README.md | 4 ++ rootfs/etc/s6-overlay/scripts/tar1090-update | 40 ++++++++++--------- .../s6-overlay/startup.d/07-nginx-configure | 4 ++ 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index e5ec939..61237c6 100644 --- a/README.md +++ b/README.md @@ -303,6 +303,10 @@ docker exec -it ultrafeeder bash /tar1090-install.sh /run/readsb webroot /usr/lo After this has finished a simple reload in the browser should do the trick. +Another option is to bind / mount a folder to /var/custom_html in the container and set +CUSTOM_HTML=true, be aware no cache busting will be done, nor will any of the tar1090 configuration +settings be applied. The folder will be served as is with aircraft data available as usual at /data. + #### `tar1090` `config.js` Configuration - Title | Environment Variable | Purpose | Default | diff --git a/rootfs/etc/s6-overlay/scripts/tar1090-update b/rootfs/etc/s6-overlay/scripts/tar1090-update index 7574fb7..26cc393 100755 --- a/rootfs/etc/s6-overlay/scripts/tar1090-update +++ b/rootfs/etc/s6-overlay/scripts/tar1090-update @@ -7,17 +7,6 @@ if ! chk_enabled "${UPDATE_TAR1090}" || chk_enabled "${TAR1090_DISABLE}"; then stop_service fi -OVERRIDE_GIT_SOURCE="/var/tar1090_git_source" - -if [[ -d "${OVERRIDE_GIT_SOURCE}/html" ]]; then - "${s6wrap[@]}" echo "USING LOCALLY MODIFIED TAR1090 from ${OVERRIDE_GIT_SOURCE}" - "${s6wrap[@]}" bash /tar1090-install.sh /run/readsb webroot "${TAR1090_INSTALL_DIR}" "${OVERRIDE_GIT_SOURCE}" - TAR1090_VERSION="$(cat "${OVERRIDE_GIT_SOURCE}/version") LOCALLY MODIFIED" -else - "${s6wrap[@]}" bash /tar1090-install.sh /run/readsb webroot "${TAR1090_INSTALL_DIR}" - TAR1090_VERSION=$(cat "${TAR1090_UPDATE_DIR}/git/version") -fi - # aircraft-db if chk_enabled "$TAR1090_ENABLE_AC_DB" && curl --connect-timeout 10 --silent --show-error "https://raw.githubusercontent.com/wiedehopf/tar1090-db/csv/version" > "/run/aircraft.csv.gz.version.new"; then if ! diff -q "${TAR1090_UPDATE_DIR}/aircraft.csv.gz.version" "/run/aircraft.csv.gz.version.new" &>/dev/null; then @@ -30,15 +19,28 @@ if chk_enabled "$TAR1090_ENABLE_AC_DB" && curl --connect-timeout 10 --silent --s fi fi -# Print tar1090 version -TAR1090_DB_VERSION=$(cat "${TAR1090_UPDATE_DIR}/git-db/version") -"${s6wrap[@]}" echo "tar1090 version: ${TAR1090_VERSION} tar1090-db version: ${TAR1090_DB_VERSION}" -export TAR1090_VERSION +if ! chk_enabled "${CUSTOM_HTML}"; then + OVERRIDE_GIT_SOURCE="/var/tar1090_git_source" + + if [[ -d "${OVERRIDE_GIT_SOURCE}/html" ]]; then + "${s6wrap[@]}" echo "USING LOCALLY MODIFIED TAR1090 from ${OVERRIDE_GIT_SOURCE}" + "${s6wrap[@]}" bash /tar1090-install.sh /run/readsb webroot "${TAR1090_INSTALL_DIR}" "${OVERRIDE_GIT_SOURCE}" + TAR1090_VERSION="$(cat "${OVERRIDE_GIT_SOURCE}/version") LOCALLY MODIFIED" + else + "${s6wrap[@]}" bash /tar1090-install.sh /run/readsb webroot "${TAR1090_INSTALL_DIR}" + TAR1090_VERSION=$(cat "${TAR1090_UPDATE_DIR}/git/version") + fi + + # Print tar1090 version + TAR1090_DB_VERSION=$(cat "${TAR1090_UPDATE_DIR}/git-db/version") + "${s6wrap[@]}" echo "tar1090 version: ${TAR1090_VERSION} tar1090-db version: ${TAR1090_DB_VERSION}" + export TAR1090_VERSION -# call the necessary scripts to configure the newly created tar1090 html folder -# they were already run on container startup but there is no harm in running them again -"${s6wrap[@]}" bash /etc/s6-overlay/startup.d/04-tar1090-configure -"${s6wrap[@]}" bash /etc/s6-overlay/startup.d/06-range-outline + # call the necessary scripts to configure the newly created tar1090 html folder + # they were already run on container startup but there is no harm in running them again + "${s6wrap[@]}" bash /etc/s6-overlay/startup.d/04-tar1090-configure + "${s6wrap[@]}" bash /etc/s6-overlay/startup.d/06-range-outline +fi if (( UPDATE_TAR1090_DAYS == 0 )); then stop_service diff --git a/rootfs/etc/s6-overlay/startup.d/07-nginx-configure b/rootfs/etc/s6-overlay/startup.d/07-nginx-configure index 0d15e9f..ed1773d 100755 --- a/rootfs/etc/s6-overlay/startup.d/07-nginx-configure +++ b/rootfs/etc/s6-overlay/startup.d/07-nginx-configure @@ -45,3 +45,7 @@ sed -i -e 's|#sed_placeholder_API_proxy|location /re-api/ {\ else cp -Tf /etc/nginx.tar1090/sites-enabled/tar1090 /etc/nginx/sites-enabled/tar1090 fi + +if chk_enabled "${CUSTOM_HTML}"; then + sed -i -e 's#/usr/local/share/tar1090/html-webroot/#/var/custom_html/#' /etc/nginx/nginx-tar1090-webroot.conf +fi