diff --git a/compose.yaml b/compose.yaml index f3b534529ed..70436779977 100644 --- a/compose.yaml +++ b/compose.yaml @@ -29,6 +29,7 @@ services: # NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS: imagick # This allows to add additional php extensions to the Nextcloud container permanently. Default is imagick but can be overwritten by modifying this value. See https://github.com/nextcloud/all-in-one#how-to-add-php-extensions-permanently-to-the-nextcloud-container # NEXTCLOUD_ENABLE_DRI_DEVICE: true # This allows to enable the /dev/dri device in the Nextcloud container. ⚠️⚠️⚠️ Warning: this only works if the '/dev/dri' device is present on the host! If it should not exist on your host, don't set this to true as otherwise the Nextcloud container will fail to start! See https://github.com/nextcloud/all-in-one#how-to-enable-hardware-transcoding-for-nextcloud # NEXTCLOUD_KEEP_DISABLED_APPS: false # Setting this to true will keep Nextcloud apps that are disabled in the AIO interface and not uninstall them if they should be installed. See https://github.com/nextcloud/all-in-one#how-to-keep-disabled-apps + # DISABLE_OVERWRITE_URL: true # Setting this to true will disable the ability to overwrite the URL in the AIO interface. See https://github.com/nextcloud/all-in-one#can-i-use-aio-with-multiple-domains # TALK_PORT: 3478 # This allows to adjust the port that the talk container is using. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-talk-port # WATCHTOWER_DOCKER_SOCKET_PATH: /var/run/docker.sock # Needs to be specified if the docker socket on the host is not located in the default '/var/run/docker.sock'. Otherwise mastercontainer updates will fail. For macos it needs to be '/var/run/docker.sock' # security_opt: ["label:disable"] # Is needed when using SELinux diff --git a/php/containers.json b/php/containers.json index 4d447d83efa..ee0de9c94a5 100644 --- a/php/containers.json +++ b/php/containers.json @@ -185,8 +185,8 @@ "ADMIN_USER=admin", "ADMIN_PASSWORD=%NEXTCLOUD_PASSWORD%", "NEXTCLOUD_DATA_DIR=/mnt/ncdata", - "OVERWRITEHOST=%NC_DOMAIN%", - "OVERWRITEPROTOCOL=https", + "OVERWRITEHOST=%OVERWRITEHOST%", + "OVERWRITEPROTOCOL=%OVERWRITEPROTOCOL%", "TURN_SECRET=%TURN_SECRET%", "SIGNALING_SECRET=%SIGNALING_SECRET%", "ONLYOFFICE_SECRET=%ONLYOFFICE_SECRET%", diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index b20938399ea..a09a01952ab 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -71,7 +71,7 @@ public function GetLastBackupTime() : string { if (!file_exists(DataConst::GetBackupArchivesList())) { return ''; } - + $content = file_get_contents(DataConst::GetBackupArchivesList()); if ($content === '') { return ''; @@ -91,7 +91,7 @@ public function GetLastBackupTime() : string { if ($lastBackupTime === "") { return ''; } - + return $lastBackupTime; } @@ -99,7 +99,7 @@ public function GetBackupTimes() : array { if (!file_exists(DataConst::GetBackupArchivesList())) { return []; } - + $content = file_get_contents(DataConst::GetBackupArchivesList()); if ($content === '') { return []; @@ -110,7 +110,7 @@ public function GetBackupTimes() : array { foreach($backupLines as $lines) { if ($lines !== "") { $backupTimesTemp = explode(',', $lines); - $backupTimes[] = $backupTimesTemp[1]; + $backupTimes[] = $backupTimesTemp[1]; } } @@ -140,7 +140,7 @@ public function isClamavEnabled() : bool { if (!$this->isx64Platform()) { return false; } - + $config = $this->GetConfig(); if (isset($config['isClamavEnabled']) && $config['isClamavEnabled'] === 1) { return true; @@ -349,7 +349,7 @@ public function SetDomain(string $domain) : void { $testUrl = $protocol . $domain . ':443'; curl_setopt($ch, CURLOPT_URL, $testUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $response = (string)curl_exec($ch); # Get rid of trailing \n @@ -455,7 +455,7 @@ public function SetBorgRestoreHostLocationAndPassword(string $location, string $ if ($location === '') { throw new InvalidSettingConfigurationException("Please enter a path!"); } - + $isValidPath = false; if (str_starts_with($location, '/') && !str_ends_with($location, '/')) { $isValidPath = true; @@ -520,6 +520,10 @@ public function GetTalkPort() : string { return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); } + public function IsOverwriteEnable() : bool { + return getenv('DISABLE_OVERWRITE_URL') !== 'yes'; + } + /** * @throws InvalidSettingConfigurationException */ @@ -698,7 +702,7 @@ public function SetDailyBackupTime(string $time, bool $enableAutomaticUpdates, b if (!preg_match("#^[0-1][0-9]:[0-5][0-9]$#", $time) && !preg_match("#^2[0-3]:[0-5][0-9]$#", $time)) { throw new InvalidSettingConfigurationException("You did not enter a correct time! One correct example is '04:00'!"); } - + if ($enableAutomaticUpdates === false) { $time .= PHP_EOL . 'automaticUpdatesAreNotEnabled'; } else { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 8b2e8a3e848..e9250508649 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -297,6 +297,18 @@ public function CreateContainer(Container $container) : void { $replacements[1] = $this->configurationManager->GetApachePort(); } elseif ($out[1] === 'TALK_PORT') { $replacements[1] = $this->configurationManager->GetTalkPort(); + } elseif($out[1] === 'OVERWRITEHOST') { + if ($this->configurationManager->IsOverwriteEnable()) { + $replacements[1] = $this->configurationManager->GetDomain(); + } else { + $replacements[1] = ''; + } + } elseif($out[1] === 'OVERWRITEPROTOCOL') { + if ($this->configurationManager->IsOverwriteEnable()) { + $replacements[1] = 'https'; + } else { + $replacements[1] = ''; + } } elseif ($out[1] === 'NEXTCLOUD_MOUNT') { $replacements[1] = $this->configurationManager->GetNextcloudMount(); } elseif ($out[1] === 'BACKUP_RESTORE_PASSWORD') { diff --git a/readme.md b/readme.md index dbcf8306eab..9922dd2cf70 100644 --- a/readme.md +++ b/readme.md @@ -254,7 +254,7 @@ No and they will not be. If you want to run it locally, without opening Nextclou No and it will not be added. If you only want to run it locally, you may have a look at the following documentation: [local-instance.md](./local-instance.md) ### Can I use AIO with multiple domains? -No and it will not be added. However you can use [this feature](https://github.com/nextcloud/all-in-one/blob/main/multiple-instances.md) in order to create multiple AIO instances, one for each domain. +No and it will not be added. However you can use [this feature](https://github.com/nextcloud/all-in-one/blob/main/multiple-instances.md) in order to create multiple AIO instances, one for each domain. Also you can set the environment variable `DISABLE_OVERWRITE_URL` to `true`, however we cannot fix bugs that may be caused by network issues. At your own risk. ### Are other ports than the default 443 for Nextcloud supported? No and they will not be. Please use a dedicated domain for Nextcloud and set it up correctly by following the [reverse proxy documentation](./reverse-proxy.md). If port 443 and/or 80 is blocked for you, you may use the a Cloudflare Tunnel if you want to publish it online. You could also use the ACME DNS-challenge to get a valid certificate. However in all cases the Nextcloud interface will redirect you to port 443.