pref: 优化 ClamAV 提示信息 (#5693)

This commit is contained in:
ssongliu 2024-07-05 16:52:39 +08:00 committed by GitHub
parent 40d9dea96c
commit 0105da02af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 29 additions and 21 deletions

View File

@ -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")

View File

@ -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:

View File

@ -67,6 +67,7 @@ const message = {
notSave: '不保存',
createNewFolder: '新建資料夾',
createNewFile: '新建檔案',
helpDoc: '幫助文档',
},
search: {
timeStart: '開始時間',
@ -1019,7 +1020,7 @@ const message = {
'ClamAV 的最低建議配置為3 GiB 以上的 RAM2.0 GHz 以上的單核 CPU以及至少 5 GiB 的可用硬盤空間',
noClam: '未檢測到 ClamAV 服務請參考官方文檔進行安裝',
notStart: '當前未 ClamAV 服務請先開啟',
removeResult: '刪除報告文件',
removeRecord: '刪除報告文件',
removeResultHelper: '刪除任務執行過程中生成的報告文件以清理存儲空間',
removeInfected: '刪除病毒文件',
removeInfectedHelper: '刪除任務檢測到的病毒文件以確保伺服器的安全和正常運行',

View File

@ -67,6 +67,7 @@ const message = {
notSave: '不保存',
createNewFolder: '新建文件夹',
createNewFile: '新建文件',
helpDoc: '帮助文档',
},
search: {
timeStart: '开始时间',
@ -1017,10 +1018,11 @@ const message = {
clam: {
clam: '病毒扫描',
clamHelper:
'ClamAV 的最低建议配置为3 GiB 以上的 RAM2.0 GHz 以上的单核 CPU以及至少 5 GiB 的可用硬盘空间',
'ClamAV 的最低建议配置为3 GiB 以上的 RAM2.0 GHz 以上的单核 CPU以及至少 5 GiB 的可用硬盘空间',
doc: '帮助文档',
noClam: '未检测到 ClamAV 服务请参考官方文档进行安装',
notStart: '当前未开启 ClamAV 服务请先开启',
removeResult: '删除报告文件',
removeRecord: '删除报告文件',
removeResultHelper: '删除任务执行过程中生成的报告文件以清理存储空间',
removeInfected: '删除病毒文件',
removeInfectedHelper: '删除任务检测到的病毒文件以确保服务器的安全和正常运行',

View File

@ -38,12 +38,12 @@
<span>
{{ $t('setting.backupAlert') }}
<el-link
class="ml-1.5"
class="ml-1 text-xs"
type="primary"
target="_blank"
href="https://1panel.cn/docs/user_manual/settings/#3"
>
{{ $t('setting.doc') }}
{{ $t('commons.button.helpDoc') }}
</el-link>
</span>
</template>

View File

@ -5,13 +5,8 @@
<el-alert type="info" :closable="false">
<template #title>
{{ $t('toolbox.clam.clamHelper') }}
<el-link
style="font-size: 12px; margin-left: 5px"
icon="Position"
@click="toDoc()"
type="primary"
>
{{ $t('firewall.quickJump') }}
<el-link class="ml-1 text-xs" @click="toDoc()" type="primary">
{{ $t('commons.button.helpDoc') }}
</el-link>
</template>
</el-alert>

View File

@ -102,13 +102,13 @@
</el-col>
<el-col :span="17">
<el-form label-position="top" :v-key="refresh">
<el-row v-if="currentRecord?.status === 'Done'">
<el-row>
<el-form-item class="descriptionWide">
<template #label>
<span class="status-label">{{ $t('toolbox.clam.scanTime') }}</span>
</template>
<span class="status-count">
{{ currentRecord?.scanTime }}
{{ currentRecord?.status === 'Done' ? currentRecord?.scanTime : '-' }}
</span>
</el-form-item>
<el-form-item class="descriptionWide">
@ -116,11 +116,15 @@
<span class="status-label">{{ $t('toolbox.clam.infectedFiles') }}</span>
</template>
<span class="status-count" v-if="!hasInfectedDir()">
{{ currentRecord?.infectedFiles }}
{{ currentRecord?.status === 'Done' ? currentRecord?.infectedFiles : '-' }}
</span>
<div class="count" v-else>
<span @click="toFolder(currentRecord?.name)">
{{ currentRecord?.infectedFiles }}
{{
currentRecord?.status === 'Done'
? currentRecord?.infectedFiles
: '-'
}}
</span>
</div>
</el-form-item>