Merge pull request #2517 from alexbelgium/copilot/fix-download-urls-issue

Fix Seafile download URLs containing incorrect /seafhttp prefix
https://github.com/alexbelgium/hassio-addons/issues/1753#issuecomment-3941848766
This commit is contained in:
Alexandre
2026-02-23 00:15:54 +01:00
committed by GitHub
3 changed files with 25 additions and 1 deletions

View File

@@ -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.

View File

@@ -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]

View File

@@ -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 #
###################