improve/fix some things

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-03-16 14:29:30 +01:00
parent d385d43af0
commit 172ae49cdf
5 changed files with 20 additions and 13 deletions

View file

@ -306,7 +306,13 @@
"3310"
],
"environmentVariables": [],
"volumes": [],
"volumes": [
{
"name": "nextcloud_aio_clamav",
"location": "/var/lib/clamav",
"writeable": true
}
],
"secrets": [],
"maxShutdownTime": 10,
"restartPolicy": "unless-stopped"

View file

@ -18,19 +18,21 @@
<MissingParamType occurrences="1">
<code>$args</code>
</MissingParamType>
<PossiblyInvalidArrayAccess occurrences="3">
<PossiblyInvalidArrayAccess occurrences="4">
<code>$request-&gt;getParsedBody()['borg_backup_host_location']</code>
<code>$request-&gt;getParsedBody()['domain']</code>
<code>$request-&gt;getParsedBody()['clamav']</code>
<code>$request-&gt;getParsedBody()['options-form']</code>
</PossiblyInvalidArrayAccess>
<PossiblyNullArgument occurrences="2">
<code>$request-&gt;getParsedBody()['borg_backup_host_location']</code>
<code>$request-&gt;getParsedBody()['domain']</code>
</PossiblyNullArgument>
<PossiblyNullArrayAccess occurrences="3">
<PossiblyNullArrayAccess occurrences="4">
<code>$request-&gt;getParsedBody()['borg_backup_host_location']</code>
<code>$request-&gt;getParsedBody()['domain']</code>
<code>$request-&gt;getParsedBody()['clamav']</code>
<code>$request-&gt;getParsedBody()['options-form']</code>
</PossiblyNullArrayAccess>
</file>
<file src="src/Controller/DockerController.php">

View file

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

View file

@ -35,14 +35,11 @@ class ConfigurationController
$this->configurationManager->SetBorgBackupHostLocation($request->getParsedBody()['borg_backup_host_location']);
}
if (isset($request->getParsedBody()['clamav'])) {
$value = $request->getParsedBody()['clamav'];
if ($value === 'on') {
if (isset($request->getParsedBody()['options-form'])) {
if (isset($request->getParsedBody()['clamav'])) {
$this->configurationManager->SetClamavEnabledState(1);
} elseif ($value === 'off') {
$this->configurationManager->SetClamavEnabledState(0);
} else {
error_log('It seems like clamav was changed but not to on or off.');
$this->configurationManager->SetClamavEnabledState(0);
}
}

View file

@ -293,15 +293,16 @@
<form id="options-form" method="POST" action="/api/configuration" class="xhr">
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input type="hidden" name="options-form" value="options-form">
{% if is_clamav_enabled == true %}
<input type="checkbox" id="clamav" name="clamav" checked="checked"><label for="clamav">ClamAV (only supported on x64)</label>
<input type="checkbox" id="clamav" name="clamav" checked="checked"><label for="clamav">ClamAV (only supported on x64, needs ~2GB additional RAM)</label>
{% else %}
<input type="checkbox" id="clamav" name="clamav"><label for="clamav">ClamAV (only supported on x64)</label>
<input type="checkbox" id="clamav" name="clamav"><label for="clamav">ClamAV (only supported on x64, needs ~2GB additional RAM)</label>
{% endif %}
<input id="options-form-submit" class="button" type="submit" value="Save changes" />
</form>
{% if isAnyRunning == true or is_x64_platform == false %}
<script type="text/javascript" src="disabe-clamav.js"></script>
<script type="text/javascript" src="disable-clamav.js"></script>
{% endif %}
{% endif %}
{% endif %}