nextcloud - adjust COLLABORA_HOST logic

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2024-03-28 12:49:52 +01:00
parent a05269c773
commit 590012ae38

View file

@ -539,6 +539,11 @@ php /var/www/html/occ config:app:set notify_push base_endpoint --value="https://
# Collabora # Collabora
if [ "$COLLABORA_ENABLED" = 'yes' ]; then if [ "$COLLABORA_ENABLED" = 'yes' ]; then
set -x
if [ "$COLLABORA_HOST" = "nextcloud-.*-collabora" ]; then
COLLABORA_HOST="$NC_DOMAIN"
fi
set +x
if ! [ -d "/var/www/html/custom_apps/richdocuments" ]; then if ! [ -d "/var/www/html/custom_apps/richdocuments" ]; then
php /var/www/html/occ app:install richdocuments php /var/www/html/occ app:install richdocuments
elif [ "$(php /var/www/html/occ config:app:get richdocuments enabled)" != "yes" ]; then elif [ "$(php /var/www/html/occ config:app:get richdocuments enabled)" != "yes" ]; then
@ -546,10 +551,10 @@ if [ "$COLLABORA_ENABLED" = 'yes' ]; then
elif [ "$SKIP_UPDATE" != 1 ]; then elif [ "$SKIP_UPDATE" != 1 ]; then
php /var/www/html/occ app:update richdocuments php /var/www/html/occ app:update richdocuments
fi fi
php /var/www/html/occ config:app:set richdocuments wopi_url --value="https://$NC_DOMAIN/" php /var/www/html/occ config:app:set richdocuments wopi_url --value="https://$COLLABORA_HOST/"
# Make collabora more save # Make collabora more save
COLLABORA_IPv4_ADDRESS="$(dig "$NC_DOMAIN" A +short +search | grep '^[0-9.]\+$' | sort | head -n1)" COLLABORA_IPv4_ADDRESS="$(dig "$COLLABORA_HOST" A +short +search | grep '^[0-9.]\+$' | sort | head -n1)"
COLLABORA_IPv6_ADDRESS="$(dig "$NC_DOMAIN" AAAA +short +search | grep '^[0-9a-f:]\+$' | sort | head -n1)" COLLABORA_IPv6_ADDRESS="$(dig "$COLLABORA_HOST" AAAA +short +search | grep '^[0-9a-f:]\+$' | sort | head -n1)"
COLLABORA_ALLOW_LIST="$(php /var/www/html/occ config:app:get richdocuments wopi_allowlist)" COLLABORA_ALLOW_LIST="$(php /var/www/html/occ config:app:get richdocuments wopi_allowlist)"
if [ -n "$COLLABORA_IPv4_ADDRESS" ]; then if [ -n "$COLLABORA_IPv4_ADDRESS" ]; then
if ! echo "$COLLABORA_ALLOW_LIST" | grep -q "$COLLABORA_IPv4_ADDRESS"; then if ! echo "$COLLABORA_ALLOW_LIST" | grep -q "$COLLABORA_IPv4_ADDRESS"; then
@ -560,7 +565,7 @@ if [ "$COLLABORA_ENABLED" = 'yes' ]; then
fi fi
fi fi
else else
echo "Warning: No ipv4-address found for $NC_DOMAIN." echo "Warning: No ipv4-address found for $COLLABORA_HOST."
fi fi
if [ -n "$COLLABORA_IPv6_ADDRESS" ]; then if [ -n "$COLLABORA_IPv6_ADDRESS" ]; then
if ! echo "$COLLABORA_ALLOW_LIST" | grep -q "$COLLABORA_IPv6_ADDRESS"; then if ! echo "$COLLABORA_ALLOW_LIST" | grep -q "$COLLABORA_IPv6_ADDRESS"; then
@ -571,7 +576,7 @@ if [ "$COLLABORA_ENABLED" = 'yes' ]; then
fi fi
fi fi
else else
echo "No ipv6-address found for $NC_DOMAIN." echo "No ipv6-address found for $COLLABORA_HOST."
fi fi
if [ -n "$COLLABORA_ALLOW_LIST" ]; then if [ -n "$COLLABORA_ALLOW_LIST" ]; then
PRIVATE_IP_RANGES='127.0.0.1/8,192.168.0.0/16,172.16.0.0/12,10.0.0.0/8,fd00::/8,::1' PRIVATE_IP_RANGES='127.0.0.1/8,192.168.0.0/16,172.16.0.0/12,10.0.0.0/8,fd00::/8,::1'