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" "3310"
], ],
"environmentVariables": [], "environmentVariables": [],
"volumes": [], "volumes": [
{
"name": "nextcloud_aio_clamav",
"location": "/var/lib/clamav",
"writeable": true
}
],
"secrets": [], "secrets": [],
"maxShutdownTime": 10, "maxShutdownTime": 10,
"restartPolicy": "unless-stopped" "restartPolicy": "unless-stopped"

View file

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

View file

@ -1,4 +1,5 @@
document.addEventListener("DOMContentLoaded", function(event) { document.addEventListener("DOMContentLoaded", function(event) {
// Clamav // 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']); $this->configurationManager->SetBorgBackupHostLocation($request->getParsedBody()['borg_backup_host_location']);
} }
if (isset($request->getParsedBody()['clamav'])) { if (isset($request->getParsedBody()['options-form'])) {
$value = $request->getParsedBody()['clamav']; if (isset($request->getParsedBody()['clamav'])) {
if ($value === 'on') {
$this->configurationManager->SetClamavEnabledState(1); $this->configurationManager->SetClamavEnabledState(1);
} elseif ($value === 'off') {
$this->configurationManager->SetClamavEnabledState(0);
} else { } 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"> <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.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}"> <input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input type="hidden" name="options-form" value="options-form">
{% if is_clamav_enabled == true %} {% 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 %} {% 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 %} {% endif %}
<input id="options-form-submit" class="button" type="submit" value="Save changes" /> <input id="options-form-submit" class="button" type="submit" value="Save changes" />
</form> </form>
{% if isAnyRunning == true or is_x64_platform == false %} {% 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 %} {% endif %}
{% endif %} {% endif %}