Skip to content

Commit

Permalink
Remove scan option ScanOnlyNewFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
ata-no-one committed May 22, 2024
1 parent 027a905 commit de597fc
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 28 deletions.
2 changes: 1 addition & 1 deletion lib/Settings/VaasAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function getForm(): TemplateResponse
'vaasUrl' => $this->config->getAppValue(self::APP_ID, 'vaasUrl', 'wss://gateway.staging.vaas.gdatasecurity.de'),
'quarantineFolder' => $this->config->getAppValue(self::APP_ID, 'quarantineFolder', 'Quarantine'),
'autoScanFiles' => $this->config->getAppValue(self::APP_ID, 'autoScanFiles', false),
'scanOnlyNewFiles' => $this->config->getAppValue(self::APP_ID, 'scanOnlyNewFiles', false),
'scanOnlyNewFiles' => $this->config->getAppValue(self::APP_ID, 'scanOnlyNewFiles', true),
'prefixMalicious' => $this->config->getAppValue(self::APP_ID, 'prefixMalicious', true),
'disableUnscannedTag' => $this->config->getAppValue(self::APP_ID, 'disableUnscannedTag', false),
'allowlist' => $this->config->getAppValue(self::APP_ID, 'allowlist'),
Expand Down
20 changes: 0 additions & 20 deletions src/admin-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ document.addEventListener('DOMContentLoaded', async () => {
const authSubmitAdvanced = document.querySelector('#auth_submit_advanced');
const resetAllTags = document.querySelector('#reset');
const autoScanFiles = document.querySelector('#auto_scan_files');
const scanOnlyNew = document.querySelector('#scan_only_new');
const prefixMalicious = document.querySelector('#prefixMalicious');
const authMethod = document.querySelector('#authMethod');
const disableUnscannedTag = document.querySelector('#disable_tag_unscanned');
Expand Down Expand Up @@ -94,10 +93,6 @@ document.addEventListener('DOMContentLoaded', async () => {
await toggleAutoScan(autoScanFiles.checked);
});

scanOnlyNew.addEventListener('click', async () => {
await toggleScanOnlyNew(scanOnlyNew.checked);
});

prefixMalicious.addEventListener('click', async () => {
await postData(OC.generateUrl('apps/gdatavaas/setPrefixMalicious'), {prefixMalicious: prefixMalicious.checked});
});
Expand All @@ -106,21 +101,10 @@ document.addEventListener('DOMContentLoaded', async () => {
await postData(OC.generateUrl('apps/gdatavaas/setDisableUnscannedTag'), {disableUnscannedTag: disableUnscannedTag.checked});
});

// Activate or deactivate scanning only for new files
const toggleScanOnlyNew = async (enable) => {
scanOnlyNew.checked = enable;
scanOnlyNew.disabled = !autoScanFiles.checked;
const response = await postData(OC.generateUrl('apps/gdatavaas/setScanOnlyNewFiles'), {scanOnlyNewFiles: enable});
if (response.status !== "success") {
OC.Notification.showTemporary(`An Error occurred when ${enable ? 'activating' : 'deactivating'} scanning only for new files.`);
}
};

// Activate or deactivate automatic file scanning
const toggleAutoScan = async (enable) => {
autoScanFiles.checked = enable;
const response = await postData(OC.generateUrl('apps/gdatavaas/setAutoScan'), {autoScanFiles: enable});
await toggleScanOnlyNew(enable);
if (response.status !== "success") {
OC.Notification.showTemporary(`An Error occurred when ${enable ? 'activating' : 'deactivating'} automatic file scanning.`);
}
Expand All @@ -130,12 +114,8 @@ document.addEventListener('DOMContentLoaded', async () => {
const autoScanResponse = await getData(OC.generateUrl('apps/gdatavaas/getAutoScan'));
if (autoScanResponse.status) {
autoScanFiles.checked = true;
scanOnlyNew.disabled = false;
const scanOnlyNewResponse = await getData(OC.generateUrl('apps/gdatavaas/getScanOnlyNewFiles'));
scanOnlyNew.checked = scanOnlyNewResponse.status;
} else {
autoScanFiles.checked = false;
await toggleScanOnlyNew(false);
}
prefixMalicious.checked = (await getData(OC.generateUrl('apps/gdatavaas/getPrefixMalicious'))).status;
disableUnscannedTag.checked = (await getData(OC.generateUrl('apps/gdatavaas/getDisableUnscannedTag'))).status;
Expand Down
7 changes: 0 additions & 7 deletions templates/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,6 @@
</td>
<td><label for="auto_scan"><?php p($l->t('Automatic file scanning'));?></label></td>
</tr>
<tr id="scan_option_only_new">
<td>
<input id="scan_only_new" class="toggle-round" type="checkbox">
<label for="scan_only_new"></label>
</td>
<td><div title="<?php p($l->t('Automatically scans only files that have not yet been scanned. When switched off, files that have already been scanned are scanned again at random, but unscanned files are prioritized.'));?>" class="visible"><label for="scan_new"><?php p($l->t('Scan only new files'));?></label></div></td>
</tr>
<tr>
<td>
<input id="prefixMalicious" class="toggle-round" type="checkbox">
Expand Down

0 comments on commit de597fc

Please sign in to comment.