diff --git a/seafile/CHANGELOG.md b/seafile/CHANGELOG.md index ed83def92..7b21add42 100644 --- a/seafile/CHANGELOG.md +++ b/seafile/CHANGELOG.md @@ -1,4 +1,7 @@ +## 12.0.18-2 (2026-02-22) +- Fix download URLs containing incorrect `/seafhttp` prefix on first run by re-applying URL configuration after upstream init scripts complete. + ## 12.0.18 (2026-03-20) - Fix `env_vars` handling so extra environment variables are exported correctly. diff --git a/seafile/config.yaml b/seafile/config.yaml index 87bd0b172..4cca056bb 100644 --- a/seafile/config.yaml +++ b/seafile/config.yaml @@ -128,5 +128,5 @@ services: slug: seafile udev: true url: https://github.com/alexbelgium/hassio-addons/tree/master/seafile -version: "12.0.18" +version: "12.0.18-2" webui: http://[HOST]:[PORT:8000] diff --git a/seafile/rootfs/etc/cont-init.d/99-run.sh b/seafile/rootfs/etc/cont-init.d/99-run.sh index c7985af08..d0e08cc72 100755 --- a/seafile/rootfs/etc/cont-init.d/99-run.sh +++ b/seafile/rootfs/etc/cont-init.d/99-run.sh @@ -155,6 +155,27 @@ done bashio::log.info "SERVICE_URL set to ${SERVICE_URL_VALUE}" bashio::log.info "FILE_SERVER_ROOT set to ${FILE_SERVER_ROOT_VALUE}" +# The upstream write_config.sh hardcodes /seafhttp in FILE_SERVER_ROOT and +# overwrites our settings on first run. Create a helper that re-applies the +# addon's URL configuration right before Seafile services start, so it always +# takes effect regardless of what the upstream init/setup scripts wrote. +cat > /home/seafile/apply_addon_urls.sh << URLEOF +#!/bin/bash +for _CONF in "${DATA_LOCATION}/conf/seahub_settings.py" "${DATA_LOCATION}/seafile/conf/seahub_settings.py"; do + if [ -f "\$_CONF" ]; then + sed -i '/^SERVICE_URL *=/d' "\$_CONF" + sed -i '/^FILE_SERVER_ROOT *=/d' "\$_CONF" + echo 'SERVICE_URL = "${SERVICE_URL_VALUE}"' >> "\$_CONF" + echo 'FILE_SERVER_ROOT = "${FILE_SERVER_ROOT_VALUE}"' >> "\$_CONF" + fi +done +URLEOF +chmod +x /home/seafile/apply_addon_urls.sh +sed -i '/print "Launching seafile"/i /home/seafile/apply_addon_urls.sh' /home/seafile/launch.sh +if ! grep -q 'apply_addon_urls.sh' /home/seafile/launch.sh 2>/dev/null; then + bashio::log.warning "Could not inject URL configuration into launch.sh; URLs may use upstream defaults" +fi + ################### # Define database # ###################