Compare commits

..

2 Commits

Author SHA1 Message Date
James Manuel 8941f364eb 🔧 fix(nextcloud): use parameter expansion instead of sed (SC2001)
Replace sed pipe with bash suffix-removal expansion to satisfy
shellcheck SC2001.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
2026-06-09 16:19:46 +02:00
James Manuel f3abe7bc21 🔧 fix(nextcloud): configure EuroOffice internal URLs and preview provider
Three fixes applied when \$EUROOFFICE_HOST matches the default AIO
container naming pattern (nextcloud-*-eurooffice):

1. DocumentServerInternalUrl → http://\$EUROOFFICE_HOST:80/
   Bypasses the public domain for NC→EuroOffice converter calls.
   Trailing slash required; DocumentService.php concatenates the raw
   value with "converter" with no separator.

2. StorageUrl → http://\$APACHE_CONTAINER_HOST.nextcloud-aio:23973/
   Bypasses the public domain for EuroOffice→NC file fetch calls.
   Port 23973 is the Collabora WOPI ingress; port 11000 rejects
   requests where Host doesn't match the nextcloud.test binding.
   Trailing slash required to avoid malformed replacement URLs.

3. enabledPreviewProviders index 50 → OCA\Eurooffice\Preview
   NC's allowlist is explicit; registerPreviewProvider() alone is
   insufficient. Fixed index 50 avoids collision with AIO's seeded
   range (1–7, 23).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
2026-06-09 16:19:46 +02:00
4 changed files with 17 additions and 15 deletions
+13
View File
@@ -903,11 +903,24 @@ if [ "$EUROOFFICE_ENABLED" = 'yes' ]; then
# Adjust the EuroOffice host if using internal pattern # Adjust the EuroOffice host if using internal pattern
if echo "$EUROOFFICE_HOST" | grep -q "nextcloud-.*-eurooffice"; then if echo "$EUROOFFICE_HOST" | grep -q "nextcloud-.*-eurooffice"; then
# Set internal URLs for server-to-server calls via Docker network,
# bypassing the public domain which may not resolve inside containers.
# DocumentServerInternalUrl: NC -> EuroOffice (direct container port)
# StorageUrl: EuroOffice -> NC (via port 23973 which has a matching Caddy server-block)
APACHE_CONTAINER_HOST="${EUROOFFICE_HOST%-eurooffice}-apache"
php /var/www/html/occ config:app:set eurooffice DocumentServerInternalUrl --value="http://$EUROOFFICE_HOST:80/"
php /var/www/html/occ config:app:set eurooffice StorageUrl --value="http://$APACHE_CONTAINER_HOST.nextcloud-aio:23973/"
EUROOFFICE_HOST="$NC_DOMAIN/eurooffice" EUROOFFICE_HOST="$NC_DOMAIN/eurooffice"
export EUROOFFICE_HOST export EUROOFFICE_HOST
fi fi
php /var/www/html/occ config:app:set eurooffice DocumentServerUrl --value="https://$EUROOFFICE_HOST" php /var/www/html/occ config:app:set eurooffice DocumentServerUrl --value="https://$EUROOFFICE_HOST"
# Register EuroOffice preview provider in the explicit allowlist.
# Use a high fixed index (50) to avoid colliding with AIO's seeded indices (1-7, 23).
if ! php /var/www/html/occ config:system:get enabledPreviewProviders | grep -q "Eurooffice"; then
php /var/www/html/occ config:system:set enabledPreviewProviders 50 --value="OCA\Eurooffice\Preview"
fi
fi fi
else else
# Remove EuroOffice app if disabled and removal is requested # Remove EuroOffice app if disabled and removal is requested
-1
View File
@@ -25,7 +25,6 @@ use Psr\Http\Message\ServerRequestInterface as Request;
require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../vendor/autoload.php';
$container = \AIO\DependencyInjection::GetContainer(); $container = \AIO\DependencyInjection::GetContainer();
$container->get(\AIO\Data\ConfigurationManager::class)->performMigrations();
$dataConst = $container->get(\AIO\Data\DataConst::class); $dataConst = $container->get(\AIO\Data\DataConst::class);
// Create app // Create app
+3 -13
View File
@@ -100,14 +100,13 @@ class ConfigurationManager
} }
public bool $isEuroofficeEnabled { public bool $isEuroofficeEnabled {
// Type-cast because old configs could have 1/0 for this key. get => $this->get('isEuroofficeEnabled', false);
get => (bool) $this->get('isEuroofficeEnabled', true);
set { $this->set('isEuroofficeEnabled', $value); } set { $this->set('isEuroofficeEnabled', $value); }
} }
public bool $isCollaboraEnabled { public bool $isCollaboraEnabled {
// Type-cast because old configs could have 1/0 for this key. // Type-cast because old configs could have 1/0 for this key.
get => (bool) $this->get('isCollaboraEnabled', false); get => (bool) $this->get('isCollaboraEnabled', true);
set { $this->set('isCollaboraEnabled', $value); } set { $this->set('isCollaboraEnabled', $value); }
} }
@@ -928,16 +927,7 @@ class ConfigurationManager
if (is_string($apps)) { if (is_string($apps)) {
return trim($apps); return trim($apps);
} }
return 'deck twofactor_totp tasks calendar contacts notes eurooffice'; return 'deck twofactor_totp tasks calendar contacts notes';
}
public function performMigrations(): void {
if (!$this->get('eurooffice_default_migration_v1', false)) {
$this->isCollaboraEnabled = false;
$this->isOnlyofficeEnabled = false;
$this->isEuroofficeEnabled = true;
$this->set('eurooffice_default_migration_v1', true);
}
} }
/** /**
+1 -1
View File
@@ -10,7 +10,7 @@ Included are:
- High performance backend for Nextcloud Files (Client Push) - High performance backend for Nextcloud Files (Client Push)
- Redis & APCU for performant caching - Redis & APCU for performant caching
- PostgreSQL as database - PostgreSQL as database
- EuroOffice Document Server (default) or Nextcloud Office / OnlyOffice (optional) - Nextcloud Office (optional)
- High performance backend for Nextcloud Talk and TURN-server (optional) - High performance backend for Nextcloud Talk and TURN-server (optional)
- Nextcloud Talk Recording-server (optional) - Nextcloud Talk Recording-server (optional)
- Backup solution (optional, based on [BorgBackup](https://github.com/borgbackup/borg#what-is-borgbackup)) - Backup solution (optional, based on [BorgBackup](https://github.com/borgbackup/borg#what-is-borgbackup))