Merge pull request #1026 from nextcloud/enh/393/imaginary

add imaginary as option
This commit is contained in:
Simon L 2022-08-22 12:05:14 +02:00 committed by GitHub
commit 2fab890ac0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 95 additions and 2 deletions

View file

@ -135,3 +135,12 @@ updates:
labels:
- 3. to review
- dependencies
- package-ecosystem: "docker"
directory: "/Containers/imaginary"
schedule:
interval: "daily"
time: "12:00"
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies

View file

@ -0,0 +1,2 @@
# From https://github.com/h2non/imaginary/blob/master/Dockerfile
FROM nextcloud/imaginary:20220819

View file

@ -407,5 +407,16 @@ else
fi
fi
# Imaginary
if version_greater "24.0.0.0" "$installed_version"; then
if [ "$IMAGINARY_ENABLED" = 'yes' ]; then
php /var/www/html/occ config:system:set enabledPreviewProviders 0 --value="OC\\Preview\\Imaginary"
php /var/www/html/occ config:system:set preview_imaginary_url --value="http://$IMAGINARY_HOST:9000"
else
php /var/www/html/occ config:system:delete enabledPreviewProviders 0
php /var/www/html/occ config:system:delete preview_imaginary_url
fi
fi
# Remove the update skip file always
rm -f /mnt/ncdata/skip.update

View file

@ -80,7 +80,8 @@
"identifier": "nextcloud-aio-nextcloud",
"dependsOn": [
"nextcloud-aio-database",
"nextcloud-aio-redis"
"nextcloud-aio-redis",
"nextcloud-aio-imaginary"
],
"displayName": "Nextcloud",
"containerName": "nextcloud/aio-nextcloud",
@ -140,7 +141,9 @@
"ONLYOFFICE_HOST=nextcloud-aio-onlyoffice",
"UPDATE_NEXTCLOUD_APPS=%UPDATE_NEXTCLOUD_APPS%",
"TZ=%TIMEZONE%",
"TALK_PORT=%TALK_PORT%"
"TALK_PORT=%TALK_PORT%",
"IMAGINARY_ENABLED=%IMAGINARY_ENABLED%",
"IMAGINARY_HOST=nextcloud-aio-imaginary"
],
"maxShutdownTime": 10,
"restartPolicy": "unless-stopped"
@ -367,6 +370,23 @@
],
"maxShutdownTime": 10,
"restartPolicy": "unless-stopped"
},
{
"identifier": "nextcloud-aio-imaginary",
"dependsOn": [],
"displayName": "Imaginary",
"containerName": "nextcloud/aio-imaginary",
"ports": [],
"internalPorts": [
"9000"
],
"environmentVariables": [
"TZ=%TIMEZONE%"
],
"volumes": [],
"secrets": [],
"maxShutdownTime": 10,
"restartPolicy": "unless-stopped"
}
]
}

View file

@ -0,0 +1,5 @@
document.addEventListener("DOMContentLoaded", function(event) {
// Imaginary
var imaginary = document.getElementById("imaginary");
imaginary.disabled = true;
});

View file

@ -102,6 +102,7 @@ $app->get('/containers', function ($request, $response, $args) use ($container)
'collabora_dictionaries' => $configurationManager->GetCollaboraDictionaries(),
'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(),
'is_backup_section_enabled' => $configurationManager->isBackupSectionEnabled(),
'is_imaginary_enabled' => $configurationManager->isImaginaryEnabled(),
]);
})->setName('profile');
$app->get('/login', function ($request, $response, $args) use ($container) {

View file

@ -23,4 +23,8 @@ document.addEventListener("DOMContentLoaded", function(event) {
// Talk
var talk = document.getElementById("talk");
talk.addEventListener('change', makeOptionsFormSubmitVisible);
// Imaginary
var imaginary = document.getElementById("imaginary");
imaginary.addEventListener('change', makeOptionsFormSubmitVisible);
});

View file

@ -65,6 +65,10 @@ class ContainerDefinitionFetcher
if (!$this->configurationManager->isTalkEnabled()) {
continue;
}
} elseif ($entry['identifier'] === 'nextcloud-aio-imaginary') {
if (!$this->configurationManager->isImaginaryEnabled()) {
continue;
}
}
$ports = new ContainerPorts();
@ -146,6 +150,10 @@ class ContainerDefinitionFetcher
if (!$this->configurationManager->isTalkEnabled()) {
continue;
}
} elseif ($value === 'nextcloud-aio-imaginary') {
if (!$this->configurationManager->isImaginaryEnabled()) {
continue;
}
}
$dependsOn[] = $value;
}

View file

@ -90,6 +90,11 @@ class ConfigurationController
} else {
$this->configurationManager->SetTalkEnabledState(0);
}
if (isset($request->getParsedBody()['imaginary'])) {
$this->configurationManager->SetImaginaryEnabledState(1);
} else {
$this->configurationManager->SetImaginaryEnabledState(0);
}
}
if (isset($request->getParsedBody()['delete_collabora_dictionaries'])) {

View file

@ -139,6 +139,21 @@ class ConfigurationManager
$this->WriteConfig($config);
}
public function isImaginaryEnabled() : bool {
$config = $this->GetConfig();
if (isset($config['isImaginaryEnabled']) && $config['isImaginaryEnabled'] === 1) {
return true;
} else {
return false;
}
}
public function SetImaginaryEnabledState(int $value) : void {
$config = $this->GetConfig();
$config['isImaginaryEnabled'] = $value;
$this->WriteConfig($config);
}
public function isOnlyofficeEnabled() : bool {
$config = $this->GetConfig();
if (isset($config['isOnlyofficeEnabled']) && $config['isOnlyofficeEnabled'] === 1) {

View file

@ -298,6 +298,12 @@ class DockerActionManager
} else {
$replacements[1] = $this->configurationManager->GetCollaboraDictionaries();
}
} elseif ($out[1] === 'IMAGINARY_ENABLED') {
if ($this->configurationManager->isImaginaryEnabled()) {
$replacements[1] = 'yes';
} else {
$replacements[1] = '';
}
} else {
$replacements[1] = $this->configurationManager->GetSecret($out[1]);
}

View file

@ -452,6 +452,11 @@
{% else %}
<input type="checkbox" id="collabora" name="collabora"><label for="collabora">Collabora (Nextcloud Office)</label><br>
{% endif %}
{% if is_imaginary_enabled == true %}
<input type="checkbox" id="imaginary" name="imaginary" checked="checked"><label for="imaginary">Imaginary</label><br>
{% else %}
<input type="checkbox" id="imaginary" name="imaginary"><label for="imaginary">Imaginary</label><br>
{% endif %}
{% if is_talk_enabled == true %}
<input type="checkbox" id="talk" name="talk" checked="checked"><label for="talk">Nextcloud Talk (needs ports {{ talk_port }}/TCP and {{ talk_port }}/UDP open in your firewall/router)</label><br><br>
{% else %}
@ -472,6 +477,7 @@
{% if isAnyRunning == true %}
<script type="text/javascript" src="disable-talk.js"></script>
<script type="text/javascript" src="disable-collabora.js"></script>
<script type="text/javascript" src="disable-imaginary.js"></script>
{% endif %}
{% if is_collabora_enabled == true and isAnyRunning == false and was_start_button_clicked == true %}

View file

@ -7,6 +7,7 @@ Included are:
- High performance backend for Nextcloud Files
- High performance backend for Nextcloud Talk
- Backup solution (based on [BorgBackup](https://github.com/borgbackup/borg#what-is-borgbackup))
- Imaginary
- ClamAV
## How to use this?