A free, open, self-hosted app platform (GNU AGPLv3): one-click app deploys, Traefik reverse proxy with automatic SSL, rootless Docker support, gluetun VPN routing, and a web dashboard to manage it all. Free & open forever to self-host; optional paid hosted services fund it. See PROMISE.md. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
25 lines
1.0 KiB
Bash
25 lines
1.0 KiB
Bash
#!/bin/bash
|
|
|
|
# Append a hostname to Nextcloud's trusted_domains array — required for any
|
|
# host Nextcloud should accept HTTP requests on. The index is auto-picked as
|
|
# `last + 1` from the existing array so we never collide.
|
|
|
|
appNextcloudAddTrustedDomain() {
|
|
local args="$1"
|
|
local domain
|
|
domain="$(authToolArg "$args" domain)"
|
|
[[ -z "$domain" ]] && { isError "Domain is required."; return 1; }
|
|
|
|
local current_count
|
|
current_count=$(sudo docker exec -u www-data nextcloud-service php occ config:system:get trusted_domains 2>/dev/null | grep -c '^\s*[0-9]')
|
|
[[ -z "$current_count" || "$current_count" -lt 1 ]] && current_count=1
|
|
|
|
local out
|
|
out=$(sudo docker exec -u www-data nextcloud-service php occ config:system:set trusted_domains "$current_count" --value="$domain" 2>&1)
|
|
if echo "$out" | grep -qi "system config value\|set to string"; then
|
|
isSuccessful "Nextcloud trusted_domains[$current_count] = $domain"
|
|
return 0
|
|
fi
|
|
isError "Nextcloud add-trusted-domain failed: $out"; return 1
|
|
}
|