From b833d9fd3cd0cbce081417784a1f2d97e40d8ed7 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Thu, 18 Dec 2025 10:36:56 +0100 Subject: [PATCH] Normalize Seafile URL configuration --- seafile/CHANGELOG.md | 3 +++ seafile/README.md | 2 +- seafile/config.yaml | 2 +- seafile/rootfs/etc/cont-init.d/99-run.sh | 29 ++++++++++++++++++++---- seafile/updater.json | 2 +- 5 files changed, 31 insertions(+), 7 deletions(-) diff --git a/seafile/CHANGELOG.md b/seafile/CHANGELOG.md index bbb889c2b..9bca56a89 100644 --- a/seafile/CHANGELOG.md +++ b/seafile/CHANGELOG.md @@ -2,6 +2,9 @@ - Added support for configuring extra environment variables via the `env_vars` add-on option alongside config.yaml. See https://github.com/alexbelgium/hassio-addons/wiki/Add-Environment-variables-to-your-Addon-2 for details. +## 12.0.15 (18-12-2025) +- Normalize `SERVICE_URL` and `FILE_SERVER_ROOT` values in `conf/seahub_settings.py` based on the add-on configuration to generate valid download links. + ## 12.0.14 (13-09-2025) - Update to latest version from franchetti/seafile-arm diff --git a/seafile/README.md b/seafile/README.md index b3a08b8f3..13947e27d 100644 --- a/seafile/README.md +++ b/seafile/README.md @@ -64,7 +64,7 @@ Webui can be found at (Seahub) and **File server URL**: The add-on now writes `SERVICE_URL` and `FILE_SERVER_ROOT` directly to `conf/seahub_settings.py` using `SERVER_IP` (default `homeassistant.local`), the web UI port `8000`, and the file server port (`PORT`, default `8082`). If you are not using a reverse proxy, keep `FILE_SERVER_ROOT` set to `http://:8082` so download links point to the correct file server endpoint. +> **File server URL**: The add-on now writes `SERVICE_URL` and `FILE_SERVER_ROOT` directly to `conf/seahub_settings.py`. `SERVICE_URL` uses the `url` option when set (otherwise `SERVER_IP` with port `8000`), while `FILE_SERVER_ROOT` follows the `FILE_SERVER_ROOT` option (defaulting to `http://:8082`). Keep `FILE_SERVER_ROOT` aligned with your accessible file server endpoint so download links resolve correctly. ### Options diff --git a/seafile/config.yaml b/seafile/config.yaml index 567ae0378..101336a62 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.14 +version: 12.0.15 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 c2c48bba4..81d31fd9e 100755 --- a/seafile/rootfs/etc/cont-init.d/99-run.sh +++ b/seafile/rootfs/etc/cont-init.d/99-run.sh @@ -71,11 +71,32 @@ sed -i "s|/shared|$DATA_LOCATION|g" /home/seafile/*.sh bashio::log.info "Configuring Seafile URLs" -DEFAULT_HOST=${SERVER_IP:-homeassistant.local} -DEFAULT_FILE_PORT=${PORT:-8082} +SERVER_IP_CONFIG=$(bashio::config 'SERVER_IP') +SERVICE_URL_CONFIG=$(bashio::config 'url') +FILE_SERVER_ROOT_CONFIG=$(bashio::config 'FILE_SERVER_ROOT') +FILE_PORT_CONFIG=$(bashio::config 'PORT') -SERVICE_URL_VALUE="http://${DEFAULT_HOST}:8000" -FILE_SERVER_ROOT_VALUE=${FILE_SERVER_ROOT:-"http://${DEFAULT_HOST}:${DEFAULT_FILE_PORT}"} +DEFAULT_HOST=${SERVER_IP_CONFIG:-homeassistant.local} +DEFAULT_FILE_PORT=${FILE_PORT_CONFIG:-8082} + +normalize_url() { + local raw_url="${1%/}" + local default_scheme="$2" + + if [[ -z "${raw_url}" || "${raw_url}" == "null" ]]; then + echo "" + return + fi + + if [[ "${raw_url}" =~ ^https?:// ]]; then + echo "${raw_url}" + else + echo "${default_scheme}://${raw_url}" + fi +} + +SERVICE_URL_VALUE=$(normalize_url "${SERVICE_URL_CONFIG:-${DEFAULT_HOST}:8000}" "http") +FILE_SERVER_ROOT_VALUE=$(normalize_url "${FILE_SERVER_ROOT_CONFIG:-${DEFAULT_HOST}:${DEFAULT_FILE_PORT}}" "http") SEAHUB_SETTINGS_FILE="${DATA_LOCATION}/conf/seahub_settings.py" mkdir -p "$(dirname "${SEAHUB_SETTINGS_FILE}")" diff --git a/seafile/updater.json b/seafile/updater.json index d385e56fb..b1147b1ed 100644 --- a/seafile/updater.json +++ b/seafile/updater.json @@ -1,6 +1,6 @@ { "github_fulltag": "true", - "last_update": "13-09-2025", + "last_update": "18-12-2025", "paused": false, "repository": "alexbelgium/hassio-addons", "slug": "seafile",