From 3a6e526033b1ecaff8bd598c3d65a0add531b1e0 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Mon, 11 Dec 2023 13:50:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Fail2ban=20=E9=85=8D=E7=BD=AE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=90=8E=E9=87=8D=E5=90=AF=E6=9C=8D=E5=8A=A1=20(#3261?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/dto/fail2ban.go | 2 +- backend/app/service/fail2ban.go | 4 ++-- cmd/server/docs/docs.go | 21 ++++++++++++++++--- cmd/server/docs/swagger.json | 21 ++++++++++++++++--- cmd/server/docs/swagger.yaml | 12 +++++++++++ frontend/src/lang/modules/en.ts | 2 +- frontend/src/lang/modules/tw.ts | 2 +- frontend/src/lang/modules/zh.ts | 2 +- frontend/src/views/container/image/index.vue | 2 +- .../setting/backup-account/operate/index.vue | 6 +++++- 10 files changed, 60 insertions(+), 14 deletions(-) diff --git a/backend/app/dto/fail2ban.go b/backend/app/dto/fail2ban.go index 51688e893..8c8351b82 100644 --- a/backend/app/dto/fail2ban.go +++ b/backend/app/dto/fail2ban.go @@ -19,7 +19,7 @@ type Fail2BanSearch struct { } type Fail2BanUpdate struct { - Key string `json:"key" validate:"required,oneof=port bantime findtime maxretry banaction logpath"` + Key string `json:"key" validate:"required,oneof=port bantime findtime maxretry banaction logpath port"` Value string `json:"value"` } diff --git a/backend/app/service/fail2ban.go b/backend/app/service/fail2ban.go index f1bef4f79..d74172ccd 100644 --- a/backend/app/service/fail2ban.go +++ b/backend/app/service/fail2ban.go @@ -167,7 +167,7 @@ func (u *Fail2BanService) UpdateConf(req dto.Fail2BanUpdate) error { if err != nil { return err } - if err := client.Operate("reload"); err != nil { + if err := client.Operate("restart"); err != nil { return err } return nil @@ -187,7 +187,7 @@ func (u *Fail2BanService) UpdateConfByFile(req dto.UpdateByFile) error { if err != nil { return err } - if err := client.Operate("reload"); err != nil { + if err := client.Operate("restart"); err != nil { return err } return nil diff --git a/cmd/server/docs/docs.go b/cmd/server/docs/docs.go index 0c10103e1..f634ef66c 100644 --- a/cmd/server/docs/docs.go +++ b/cmd/server/docs/docs.go @@ -14984,9 +14984,15 @@ const docTemplate = `{ "isExist": { "type": "boolean" }, + "logPath": { + "type": "string" + }, "maxRetry": { "type": "integer" }, + "port": { + "type": "integer" + }, "version": { "type": "string" } @@ -15020,7 +15026,9 @@ const docTemplate = `{ "bantime", "findtime", "maxretry", - "banaction" + "banaction", + "logpath", + "port" ] }, "value": { @@ -16603,7 +16611,8 @@ const docTemplate = `{ "dto.SSLUpdate": { "type": "object", "required": [ - "ssl" + "ssl", + "sslType" ], "properties": { "cert": { @@ -16626,7 +16635,13 @@ const docTemplate = `{ "type": "integer" }, "sslType": { - "type": "string" + "type": "string", + "enum": [ + "self", + "select", + "import-paste", + "import-local" + ] } } }, diff --git a/cmd/server/docs/swagger.json b/cmd/server/docs/swagger.json index b6a4fbd74..016953aca 100644 --- a/cmd/server/docs/swagger.json +++ b/cmd/server/docs/swagger.json @@ -14977,9 +14977,15 @@ "isExist": { "type": "boolean" }, + "logPath": { + "type": "string" + }, "maxRetry": { "type": "integer" }, + "port": { + "type": "integer" + }, "version": { "type": "string" } @@ -15013,7 +15019,9 @@ "bantime", "findtime", "maxretry", - "banaction" + "banaction", + "logpath", + "port" ] }, "value": { @@ -16596,7 +16604,8 @@ "dto.SSLUpdate": { "type": "object", "required": [ - "ssl" + "ssl", + "sslType" ], "properties": { "cert": { @@ -16619,7 +16628,13 @@ "type": "integer" }, "sslType": { - "type": "string" + "type": "string", + "enum": [ + "self", + "select", + "import-paste", + "import-local" + ] } } }, diff --git a/cmd/server/docs/swagger.yaml b/cmd/server/docs/swagger.yaml index 1185ddae7..af1c6ac30 100644 --- a/cmd/server/docs/swagger.yaml +++ b/cmd/server/docs/swagger.yaml @@ -1079,8 +1079,12 @@ definitions: type: boolean isExist: type: boolean + logPath: + type: string maxRetry: type: integer + port: + type: integer version: type: string type: object @@ -1103,6 +1107,8 @@ definitions: - findtime - maxretry - banaction + - logpath + - port type: string value: type: string @@ -2186,9 +2192,15 @@ definitions: sslID: type: integer sslType: + enum: + - self + - select + - import-paste + - import-local type: string required: - ssl + - sslType type: object dto.SearchForAnalysis: properties: diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 1da66e065..c3148a095 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1226,7 +1226,7 @@ const message = { OneDrive: 'Microsoft OneDrive', backupDir: 'Backup dir', codeWarning: 'The current authorization code format is incorrect, please confirm again!', - isCN: 'Domestic version', + isCN: 'Domestic version (not supported at the moment)', code: 'Auth code', codeHelper: 'Please click on the "Acquire" button, then login to OneDrive and copy the content after "code" in the redirected link. Paste it into this input box. For specific instructions, please refer to the official documentation.', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 37a8fc648..ff14eff16 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -1153,7 +1153,7 @@ const message = { OneDrive: '微軟 OneDrive', codeWarning: '當前授權碼格式錯誤,請重新確認!', backupDir: '備份路徑', - isCN: '國內版', + isCN: '國內版 (暫不支持)', code: '授權碼', codeHelper: '請點擊獲取按鈕,然後登錄 OneDrive 復製跳轉鏈接中 code 後面的內容,粘貼到該輸入框中,具體操作可參考官方文檔。', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index d33e7a5c0..6db4babc2 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1154,7 +1154,7 @@ const message = { OneDrive: '微软 OneDrive', codeWarning: '当前授权码格式错误,请重新确认!', backupDir: '备份路径', - isCN: '国内版', + isCN: '国内版 (暂不支持)', code: '授权码', codeHelper: '请点击获取按钮,然后登录 OneDrive 复制跳转链接中 code 后面的内容,粘贴到该输入框中,具体操作可参考官方文档。', diff --git a/frontend/src/views/container/image/index.vue b/frontend/src/views/container/image/index.vue index 2f85bfcee..a0220c4bf 100644 --- a/frontend/src/views/container/image/index.vue +++ b/frontend/src/views/container/image/index.vue @@ -195,7 +195,7 @@ const loadRepos = async () => { }; const onDelete = (row: Container.ImageInfo) => { - let names = row.tags || [row.id.replaceAll('sha256:', '').substring(0, 12)]; + let names = [row.id.replaceAll('sha256:', '').substring(0, 12)]; opRef.value.acceptParams({ title: i18n.global.t('commons.button.delete'), names: names, diff --git a/frontend/src/views/setting/backup-account/operate/index.vue b/frontend/src/views/setting/backup-account/operate/index.vue index 3dc1be8a4..b767d2f2c 100644 --- a/frontend/src/views/setting/backup-account/operate/index.vue +++ b/frontend/src/views/setting/backup-account/operate/index.vue @@ -46,7 +46,11 @@ - +