From 0105da02af025edd8692aa1aa848c7e93db02e9e Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Fri, 5 Jul 2024 16:52:39 +0800 Subject: [PATCH] =?UTF-8?q?pref:=20=E4=BC=98=E5=8C=96=20ClamAV=20=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E4=BF=A1=E6=81=AF=20(#5693)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/clam.go | 13 +++++++++---- frontend/src/lang/modules/en.ts | 3 ++- frontend/src/lang/modules/tw.ts | 3 ++- frontend/src/lang/modules/zh.ts | 6 ++++-- frontend/src/views/setting/backup-account/index.vue | 4 ++-- frontend/src/views/toolbox/clam/index.vue | 9 ++------- frontend/src/views/toolbox/clam/record/index.vue | 12 ++++++++---- 7 files changed, 29 insertions(+), 21 deletions(-) diff --git a/backend/app/service/clam.go b/backend/app/service/clam.go index 51aaa3b97..4cfbec83c 100644 --- a/backend/app/service/clam.go +++ b/backend/app/service/clam.go @@ -168,7 +168,9 @@ func (u *ClamService) Delete(req dto.ClamDelete) error { if req.RemoveInfected { _ = os.RemoveAll(path.Join(clam.InfectedDir, "1panel-infected", clam.Name)) } - return clamRepo.Delete(commonRepo.WithByID(id)) + if err := clamRepo.Delete(commonRepo.WithByID(id)); err != nil { + return err + } } return nil } @@ -204,8 +206,11 @@ func (u *ClamService) HandleOnce(req dto.OperateByID) error { _ = os.MkdirAll(dir, os.ModePerm) } } - cmd := exec.Command("clamdscan", "--fdpass", strategy, clam.Path, "-l", logFile) - _, _ = cmd.CombinedOutput() + global.LOG.Debugf("clamdscan --fdpass %s %s -l %s", strategy, clam.Path, logFile) + stdout, err := cmd.Execf("clamdscan --fdpass %s %s -l %s", strategy, clam.Path, logFile) + if err != nil { + global.LOG.Errorf("clamdscan failed, stdout: %v, err: %v", string(stdout), err) + } }() return nil } @@ -308,7 +313,7 @@ func (u *ClamService) LoadFile(req dto.OperationWithName) (string, error) { if u.serviceName == clamServiceNameUbuntu { filePath = "/var/log/clamav/freshclam.log" } else { - filePath = "/var/log/clamav/freshclam.log" + filePath = "/var/log/freshclam.log" } default: return "", fmt.Errorf("not support such type") diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index b80c4efef..8908a2f0f 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -68,6 +68,7 @@ const message = { notSave: 'Not Save', createNewFolder: 'Create new folder', createNewFile: 'Create new file', + helpDoc: 'Help Document', }, search: { timeStart: 'Time start', @@ -1077,7 +1078,7 @@ const message = { 'The minimum recommended configuration for ClamAV is: 3 GiB of RAM or more, single-core CPU with 2.0 GHz or higher, and at least 5 GiB of available hard disk space.', noClam: 'ClamAV service not detected, please refer to the official documentation for installation!', notStart: 'ClamAV service is currently not running, please start it first!', - removeResult: 'Delete Report Files', + removeRecord: 'Delete Report Files', removeResultHelper: 'Delete report files generated during task execution to free up storage space.', removeInfected: 'Delete Virus Files', removeInfectedHelper: diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 540a9dee7..9336627fa 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -67,6 +67,7 @@ const message = { notSave: '不保存', createNewFolder: '新建資料夾', createNewFile: '新建檔案', + helpDoc: '幫助文档', }, search: { timeStart: '開始時間', @@ -1019,7 +1020,7 @@ const message = { 'ClamAV 的最低建議配置為:3 GiB 以上的 RAM,2.0 GHz 以上的單核 CPU,以及至少 5 GiB 的可用硬盤空間。', noClam: '未檢測到 ClamAV 服務,請參考官方文檔進行安裝!', notStart: '當前未 ClamAV 服務,請先開啟!', - removeResult: '刪除報告文件', + removeRecord: '刪除報告文件', removeResultHelper: '刪除任務執行過程中生成的報告文件,以清理存儲空間。', removeInfected: '刪除病毒文件', removeInfectedHelper: '刪除任務檢測到的病毒文件,以確保伺服器的安全和正常運行。', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 373ead7cb..881dd5e2d 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -67,6 +67,7 @@ const message = { notSave: '不保存', createNewFolder: '新建文件夹', createNewFile: '新建文件', + helpDoc: '帮助文档', }, search: { timeStart: '开始时间', @@ -1017,10 +1018,11 @@ const message = { clam: { clam: '病毒扫描', clamHelper: - 'ClamAV 的最低建议配置为:3 GiB 以上的 RAM,2.0 GHz 以上的单核 CPU,以及至少 5 GiB 的可用硬盘空间。', + 'ClamAV 的最低建议配置为:3 GiB 以上的 RAM,2.0 GHz 以上的单核 CPU,以及至少 5 GiB 的可用硬盘空间', + doc: '帮助文档', noClam: '未检测到 ClamAV 服务,请参考官方文档进行安装!', notStart: '当前未开启 ClamAV 服务,请先开启!', - removeResult: '删除报告文件', + removeRecord: '删除报告文件', removeResultHelper: '删除任务执行过程中生成的报告文件,以清理存储空间。', removeInfected: '删除病毒文件', removeInfectedHelper: '删除任务检测到的病毒文件,以确保服务器的安全和正常运行。', diff --git a/frontend/src/views/setting/backup-account/index.vue b/frontend/src/views/setting/backup-account/index.vue index 134126e39..77451589b 100644 --- a/frontend/src/views/setting/backup-account/index.vue +++ b/frontend/src/views/setting/backup-account/index.vue @@ -38,12 +38,12 @@ {{ $t('setting.backupAlert') }} - {{ $t('setting.doc') }} + {{ $t('commons.button.helpDoc') }} diff --git a/frontend/src/views/toolbox/clam/index.vue b/frontend/src/views/toolbox/clam/index.vue index fe580ca2c..7377d053b 100644 --- a/frontend/src/views/toolbox/clam/index.vue +++ b/frontend/src/views/toolbox/clam/index.vue @@ -5,13 +5,8 @@ diff --git a/frontend/src/views/toolbox/clam/record/index.vue b/frontend/src/views/toolbox/clam/record/index.vue index fd79a350d..5ed461d39 100644 --- a/frontend/src/views/toolbox/clam/record/index.vue +++ b/frontend/src/views/toolbox/clam/record/index.vue @@ -102,13 +102,13 @@ - + - {{ currentRecord?.scanTime }} + {{ currentRecord?.status === 'Done' ? currentRecord?.scanTime : '-' }} @@ -116,11 +116,15 @@ {{ $t('toolbox.clam.infectedFiles') }} - {{ currentRecord?.infectedFiles }} + {{ currentRecord?.status === 'Done' ? currentRecord?.infectedFiles : '-' }}
- {{ currentRecord?.infectedFiles }} + {{ + currentRecord?.status === 'Done' + ? currentRecord?.infectedFiles + : '-' + }}