Skip to content

Commit

Permalink
custom_html for serving whatever html you like (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedehopf authored Feb 3, 2025
1 parent b9c69aa commit a6bc8cc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
40 changes: 21 additions & 19 deletions rootfs/etc/s6-overlay/scripts/tar1090-update
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions rootfs/etc/s6-overlay/startup.d/07-nginx-configure
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a6bc8cc

Please sign in to comment.