Skip to content

Commit

Permalink
Add feature
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Yves <7360784+docjyJ@users.noreply.github.com>
  • Loading branch information
docjyJ committed Aug 25, 2024
1 parent 3ccdd33 commit f2e7153
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
1 change: 1 addition & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions php/containers.json
Original file line number Diff line number Diff line change
Expand Up @@ -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%",
Expand Down
20 changes: 12 additions & 8 deletions php/src/Data/ConfigurationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function GetLastBackupTime() : string {
if (!file_exists(DataConst::GetBackupArchivesList())) {
return '';
}

$content = file_get_contents(DataConst::GetBackupArchivesList());
if ($content === '') {
return '';
Expand All @@ -91,15 +91,15 @@ public function GetLastBackupTime() : string {
if ($lastBackupTime === "") {
return '';
}

return $lastBackupTime;
}

public function GetBackupTimes() : array {
if (!file_exists(DataConst::GetBackupArchivesList())) {
return [];
}

$content = file_get_contents(DataConst::GetBackupArchivesList());
if ($content === '') {
return [];
Expand All @@ -110,7 +110,7 @@ public function GetBackupTimes() : array {
foreach($backupLines as $lines) {
if ($lines !== "") {
$backupTimesTemp = explode(',', $lines);
$backupTimes[] = $backupTimesTemp[1];
$backupTimes[] = $backupTimesTemp[1];
}
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 12 additions & 0 deletions php/src/Docker/DockerActionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit f2e7153

Please sign in to comment.