Make isWhiteboardEnabled an attribute

Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
Pablo Zmdl 2026-01-19 13:00:22 +01:00
parent c968e9e310
commit 881e77cca5
5 changed files with 10 additions and 24 deletions

View file

@ -136,7 +136,7 @@ $app->get('/containers', function (Request $request, Response $response, array $
'is_nvidia_gpu_enabled' => $configurationManager->isNvidiaGpuEnabled(),
'is_talk_recording_enabled' => $configurationManager->isTalkRecordingEnabled(),
'is_docker_socket_proxy_enabled' => $configurationManager->isDockerSocketProxyEnabled(),
'is_whiteboard_enabled' => $configurationManager->isWhiteboardEnabled(),
'is_whiteboard_enabled' => $configurationManager->isWhiteboardEnabled,
'community_containers' => $configurationManager->listAvailableCommunityContainers(),
'community_containers_enabled' => $configurationManager->GetEnabledCommunityContainers(),
'bypass_container_update' => $bypass_container_update,

View file

@ -91,7 +91,7 @@ readonly class ContainerDefinitionFetcher {
continue;
}
} elseif ($entry['container_name'] === 'nextcloud-aio-whiteboard') {
if (!$this->configurationManager->isWhiteboardEnabled()) {
if (!$this->configurationManager->isWhiteboardEnabled) {
continue;
}
}
@ -200,7 +200,7 @@ readonly class ContainerDefinitionFetcher {
continue;
}
} elseif ($value === 'nextcloud-aio-whiteboard') {
if (!$this->configurationManager->isWhiteboardEnabled()) {
if (!$this->configurationManager->isWhiteboardEnabled) {
continue;
}
}

View file

@ -119,11 +119,7 @@ readonly class ConfigurationController {
} else {
$this->configurationManager->SetDockerSocketProxyEnabledState(0);
}
if (isset($request->getParsedBody()['whiteboard'])) {
$this->configurationManager->SetWhiteboardEnabledState(1);
} else {
$this->configurationManager->SetWhiteboardEnabledState(0);
}
$this->configurationManager->isWhiteboardEnabled = isset($request->getParsedBody()['whiteboard']);
}
if (isset($request->getParsedBody()['community-form'])) {

View file

@ -23,6 +23,11 @@ class ConfigurationManager
set { $this->set('password', $value); }
}
public bool $isWhiteboardEnabled {
get => $this->get('isWhiteboardEnabled', true);
set { $this->set('isWhiteboardEnabled', $value); }
}
public bool $restoreExcludePreviews {
get => $this->get('restore-exclude-previews', false);
set { $this->set('restore-exclude-previews', $value); }
@ -207,21 +212,6 @@ class ConfigurationManager
$this->WriteConfig($config);
}
public function isWhiteboardEnabled() : bool {
$config = $this->GetConfig();
if (isset($config['isWhiteboardEnabled']) && $config['isWhiteboardEnabled'] === 0) {
return false;
} else {
return true;
}
}
public function SetWhiteboardEnabledState(int $value) : void {
$config = $this->GetConfig();
$config['isWhiteboardEnabled'] = $value;
$this->WriteConfig($config);
}
public function SetClamavEnabledState(int $value) : void {
$config = $this->GetConfig();
$config['isClamavEnabled'] = $value;

View file

@ -601,7 +601,7 @@ readonly class DockerActionManager {
'AIO_DATABASE_HOST' => gethostbyname('nextcloud-aio-database'),
// Allow to get local ip-address of caddy container and add it to trusted proxies automatically
'CADDY_IP_ADDRESS' => in_array('caddy', $this->configurationManager->GetEnabledCommunityContainers(), true) ? gethostbyname('nextcloud-aio-caddy') : '',
'WHITEBOARD_ENABLED' => $this->configurationManager->isWhiteboardEnabled() ? 'yes' : '',
'WHITEBOARD_ENABLED' => $this->configurationManager->isWhiteboardEnabled ? 'yes' : '',
default => $this->configurationManager->GetRegisteredSecret($placeholder),
};
}