mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-09 12:26:19 +08:00
allow to change the timezone
Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
parent
1cf5cf5509
commit
3e019d25f2
10 changed files with 102 additions and 10 deletions
|
|
@ -1,5 +1,6 @@
|
|||
# Probably from this file: https://github.com/Cisco-Talos/clamav/blob/main/Dockerfile
|
||||
FROM clamav/clamav:0.104.2-3
|
||||
|
||||
RUN apk add --update --no-cache tzdata
|
||||
COPY clamav.conf /tmp/
|
||||
RUN cat /tmp/clamav.conf >> /etc/clamav/clamd.conf
|
||||
|
|
|
|||
|
|
@ -1,2 +1,15 @@
|
|||
# From a file located probably somewhere here: https://github.com/CollaboraOnline/online/tree/master/docker
|
||||
FROM collabora/code:21.11.4.2.1
|
||||
FROM collabora/code:21.11.4.2.1
|
||||
|
||||
USER root
|
||||
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
export DEBIAN_FRONTEND=noninteractive; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
tzdata \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
USER 104
|
||||
|
|
|
|||
|
|
@ -198,6 +198,7 @@ RUN set -ex; \
|
|||
gnupg \
|
||||
git \
|
||||
postgresql-client \
|
||||
tzdata \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ sed -i 's|AIO_TOKEN=|AIO_TOKEN=123456 # Has no function but needs to be
|
|||
sed -i 's|AIO_URL=|AIO_URL=localhost # Has no function but needs to be set!|' sample.conf
|
||||
sed -i 's|NC_DOMAIN=|NC_DOMAIN=yourdomain.com # TODO! Needs to be changed to the domain that you want to use for Nextcloud.|' sample.conf
|
||||
sed -i 's|NEXTCLOUD_PASSWORD=|NEXTCLOUD_PASSWORD= # TODO! This is the password of the initially created Nextcloud admin with username "admin".|' sample.conf
|
||||
sed -i 's|TIMEZONE=|TIMEZONE=Europe/Berlin # TODO! This is the timezone that your containers will use.|' sample.conf
|
||||
sed -i 's|=$|= # TODO! This needs to be a unique and good password!|' sample.conf
|
||||
|
||||
cat sample.conf
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@
|
|||
"COLLABORA_HOST=nextcloud-aio-collabora",
|
||||
"TALK_HOST=nextcloud-aio-talk",
|
||||
"APACHE_PORT=%APACHE_PORT%",
|
||||
"ONLYOFFICE_HOST=nextcloud-aio-onlyoffice"
|
||||
"ONLYOFFICE_HOST=nextcloud-aio-onlyoffice",
|
||||
"TZ=%TIMEZONE%"
|
||||
],
|
||||
"volumes": [
|
||||
{
|
||||
|
|
@ -68,7 +69,8 @@
|
|||
"environmentVariables": [
|
||||
"POSTGRES_PASSWORD=%DATABASE_PASSWORD%",
|
||||
"POSTGRES_DB=nextcloud_database",
|
||||
"POSTGRES_USER=nextcloud"
|
||||
"POSTGRES_USER=nextcloud",
|
||||
"TZ=%TIMEZONE%"
|
||||
],
|
||||
"maxShutdownTime": 1800,
|
||||
"restartPolicy": "unless-stopped"
|
||||
|
|
@ -134,7 +136,8 @@
|
|||
"COLLABORA_HOST=nextcloud-aio-collabora",
|
||||
"TALK_ENABLED=%TALK_ENABLED%",
|
||||
"ONLYOFFICE_HOST=nextcloud-aio-onlyoffice",
|
||||
"DAILY_BACKUP_RUNNING=%DAILY_BACKUP_RUNNING%"
|
||||
"DAILY_BACKUP_RUNNING=%DAILY_BACKUP_RUNNING%",
|
||||
"TZ=%TIMEZONE%"
|
||||
],
|
||||
"maxShutdownTime": 10,
|
||||
"restartPolicy": "unless-stopped"
|
||||
|
|
@ -149,7 +152,8 @@
|
|||
"6379"
|
||||
],
|
||||
"environmentVariables": [
|
||||
"REDIS_HOST_PASSWORD=%REDIS_PASSWORD%"
|
||||
"REDIS_HOST_PASSWORD=%REDIS_PASSWORD%",
|
||||
"TZ=%TIMEZONE%"
|
||||
],
|
||||
"volumes": [],
|
||||
"secrets": [
|
||||
|
|
@ -169,7 +173,8 @@
|
|||
],
|
||||
"environmentVariables": [
|
||||
"aliasgroup1=https://%NC_DOMAIN%:443",
|
||||
"extra_params=--o:ssl.enable=false --o:ssl.termination=true --o:logging.level=warning"
|
||||
"extra_params=--o:ssl.enable=false --o:ssl.termination=true --o:logging.level=warning",
|
||||
"TZ=%TIMEZONE%"
|
||||
],
|
||||
"volumes": [],
|
||||
"secrets": [],
|
||||
|
|
@ -192,7 +197,8 @@
|
|||
"NC_DOMAIN=%NC_DOMAIN%",
|
||||
"TURN_SECRET=%TURN_SECRET%",
|
||||
"SIGNALING_SECRET=%SIGNALING_SECRET%",
|
||||
"JANUS_API_KEY=%JANUS_API_KEY%"
|
||||
"JANUS_API_KEY=%JANUS_API_KEY%",
|
||||
"TZ=%TIMEZONE%"
|
||||
],
|
||||
"volumes": [],
|
||||
"secrets": [
|
||||
|
|
@ -314,7 +320,9 @@
|
|||
"internalPorts": [
|
||||
"3310"
|
||||
],
|
||||
"environmentVariables": [],
|
||||
"environmentVariables": [
|
||||
"TZ=%TIMEZONE%"
|
||||
],
|
||||
"volumes": [
|
||||
{
|
||||
"name": "nextcloud_aio_clamav",
|
||||
|
|
@ -335,7 +343,9 @@
|
|||
"internalPorts": [
|
||||
"80"
|
||||
],
|
||||
"environmentVariables": [],
|
||||
"environmentVariables": [
|
||||
"TZ=%TIMEZONE%"
|
||||
],
|
||||
"volumes": [
|
||||
{
|
||||
"name": "nextcloud_aio_onlyoffice",
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ $app->get('/containers', function ($request, $response, $args) use ($container)
|
|||
'borg_restore_password' => $configurationManager->GetBorgRestorePassword(),
|
||||
'daily_backup_time' => $configurationManager->GetDailyBackupTime(),
|
||||
'is_daily_backup_running' => $configurationManager->isDailyBackupRunning(),
|
||||
'timezone' => $configurationManager->GetTimezone(),
|
||||
]);
|
||||
})->setName('profile');
|
||||
$app->get('/login', function ($request, $response, $args) use ($container) {
|
||||
|
|
|
|||
|
|
@ -52,6 +52,15 @@ class ConfigurationController
|
|||
$this->configurationManager->DeleteDailyBackupTime();
|
||||
}
|
||||
|
||||
if (isset($request->getParsedBody()['delete_timezone'])) {
|
||||
$this->configurationManager->DeleteTimezone();
|
||||
}
|
||||
|
||||
if (isset($request->getParsedBody()['timezone'])) {
|
||||
$timezone = $request->getParsedBody()['timezone'] ?? '';
|
||||
$this->configurationManager->SetTimezone($timezone);
|
||||
}
|
||||
|
||||
if (isset($request->getParsedBody()['options-form'])) {
|
||||
if (isset($request->getParsedBody()['collabora']) && isset($request->getParsedBody()['onlyoffice'])) {
|
||||
throw new InvalidSettingConfigurationException("Collabora and Onlyoffice are not allowed to be enabled at the same time!");
|
||||
|
|
|
|||
|
|
@ -479,4 +479,33 @@ class ConfigurationManager
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function GetTimezone() : string {
|
||||
$config = $this->GetConfig();
|
||||
if(!isset($config['timezone'])) {
|
||||
$config['timezone'] = '';
|
||||
}
|
||||
|
||||
return $config['timezone'];
|
||||
}
|
||||
|
||||
public function SetTimezone(string $timezone) : void {
|
||||
if ($timezone === "") {
|
||||
throw new InvalidSettingConfigurationException("The timezone must not be empty!");
|
||||
}
|
||||
|
||||
if (!preg_match("#[a-zA-Z0-9_-/+]+$#", $timezone)) {
|
||||
throw new InvalidSettingConfigurationException("The entered timezone does not seem to be a valid timezone!");
|
||||
}
|
||||
|
||||
$config = $this->GetConfig();
|
||||
$config['timezone'] = $timezone;
|
||||
$this->WriteConfig($config);
|
||||
}
|
||||
|
||||
public function DeleteTimezone() : void {
|
||||
$config = $this->GetConfig();
|
||||
$config['timezone'] = '';
|
||||
$this->WriteConfig($config);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -280,6 +280,8 @@ class DockerActionManager
|
|||
} else {
|
||||
$replacements[1] = '';
|
||||
}
|
||||
} elseif ($out[1] === 'TIMEZONE') {
|
||||
$replacements[1] = $this->configurationManager->GetTimezone();
|
||||
} else {
|
||||
$replacements[1] = $this->configurationManager->GetSecret($out[1]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -398,7 +398,32 @@
|
|||
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
|
||||
<input class="button" type="submit" value="Submit" />
|
||||
</form>
|
||||
The new password needs to be at least 24 characters long. Allowed characters are the <a href="https://en.wikipedia.org/wiki/Latin_alphabet#/media/File:Abecedarium.png"><b>latin characters</b></a> <b>a-z</b>, <b>A-Z</b>, <b>0-9</b> and <b>spaces</b>.
|
||||
The new password needs to be at least 24 characters long. Allowed characters are the <a href="https://en.wikipedia.org/wiki/Latin_alphabet#/media/File:Abecedarium.png"><b>latin characters</b></a> <b>a-z</b>, <b>A-Z</b>, <b>0-9</b> and <b>spaces</b>.<br><br>
|
||||
|
||||
<h2>Timezone change</h2>
|
||||
In order to get the correct time values for certain Nextcloud features, it makes sense to set the timezone for Nextcloud to the one that your users mainly use. Please note that this setting does not apply to the mastercontainer and any backup option.<br><br>
|
||||
{% if isAnyRunning == true %}
|
||||
You can change the timezone when your containers are stopped.<br><br>
|
||||
{% else %}
|
||||
{% if timezone == "" %}
|
||||
You can configure the timezone for Nextcloud below:<br><br>
|
||||
<form method="POST" action="/api/configuration" class="xhr">
|
||||
<input type="text" name="timezone" placeholder="Europe/Berlin" />
|
||||
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
|
||||
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
|
||||
<input class="button" type="submit" value="Submit" />
|
||||
</form>
|
||||
You need to make sure that the timezone that you enter is valid. An example is <b>Europe/Berlin</b>. You can get valid values by looking at the 'TZ database name' column of this list: <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List"><b>click here<b/></a>.<br><br>
|
||||
{% else %}
|
||||
The timezone for Nextcloud is currently set to <b>{{ timezone }}</b>. You can reset the timezone again by clicking on the button below.<br><br/>
|
||||
<form method="POST" action="/api/configuration" class="xhr">
|
||||
<input type="hidden" name="delete_timezone" value="yes"/>
|
||||
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
|
||||
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
|
||||
<input class="button" type="submit" value="Reset the timezone" />
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue