mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-24 11:09:16 +08:00
feat: 支持编辑失败状态下的 Fail2ban 配置 (#3322)
This commit is contained in:
parent
e8d3b5fe93
commit
18cbcb7f13
@ -39,12 +39,16 @@ func (u *Fail2BanService) LoadBaseInfo() (dto.Fail2BanBaseInfo, error) {
|
||||
baseInfo.IsEnable, baseInfo.IsActive, baseInfo.IsExist = client.Status()
|
||||
if !baseInfo.IsActive {
|
||||
baseInfo.Version = "-"
|
||||
return baseInfo, nil
|
||||
} else {
|
||||
baseInfo.Version = client.Version()
|
||||
}
|
||||
baseInfo.Version = client.Version()
|
||||
conf, err := os.ReadFile(defaultFail2BanPath)
|
||||
if err != nil {
|
||||
return baseInfo, fmt.Errorf("read fail2ban conf of %s failed, err: %v", defaultFail2BanPath, err)
|
||||
if baseInfo.IsActive {
|
||||
return baseInfo, fmt.Errorf("read fail2ban conf of %s failed, err: %v", defaultFail2BanPath, err)
|
||||
} else {
|
||||
return baseInfo, nil
|
||||
}
|
||||
}
|
||||
lines := strings.Split(string(conf), "\n")
|
||||
|
||||
|
@ -40,17 +40,14 @@
|
||||
</div>
|
||||
|
||||
<div v-if="form.isExist">
|
||||
<el-card v-if="!form.isActive" class="mask-prompt">
|
||||
<span>{{ $t('toolbox.fail2ban.unActive') }}</span>
|
||||
</el-card>
|
||||
<LayoutContent title="Fail2ban" :divider="true" :class="{ mask: !form.isActive }">
|
||||
<LayoutContent title="Fail2ban" :divider="true">
|
||||
<template #toolbar>
|
||||
<el-row>
|
||||
<el-col :span="16">
|
||||
<el-button type="primary" plain @click="onLoadList('ignore')">
|
||||
<el-button :disabled="!form.isActive" type="primary" plain @click="onLoadList('ignore')">
|
||||
{{ $t('toolbox.fail2ban.ignoreIP') }}
|
||||
</el-button>
|
||||
<el-button type="primary" plain @click="onLoadList('banned')">
|
||||
<el-button :disabled="!form.isActive" type="primary" plain @click="onLoadList('banned')">
|
||||
{{ $t('toolbox.fail2ban.bannedIP') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
|
Loading…
Reference in New Issue
Block a user