From 866f1df5e34f451513c553209b44c4f83f4adeba Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 20 Jul 2026 15:41:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(waf):=20IP=20=E7=BB=84=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E9=97=B4=E9=9A=94=E4=B8=8B=E9=99=90=E6=94=B9=E4=B8=BA=201=20?= =?UTF-8?q?=E5=88=86=E9=92=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除同步周期 5 分钟限制;回看窗口仍保持最小 5 分钟。 --- docs/changelog/index.md | 1 + .../app/(main)/waf/components/ip-group-dialog.tsx | 11 ++++++----- internal/apps/openflare/waf/logics.go | 7 ++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/changelog/index.md b/docs/changelog/index.md index c8da7b27..d405c7b6 100644 --- a/docs/changelog/index.md +++ b/docs/changelog/index.md @@ -29,6 +29,7 @@ sidebar: false ### 改进 - IP 组自动规则中的 `StatusCount` / `StatusRatio` 支持状态码类写法(如 `"2xx"`、`"4xx"`、`"5xx"`),便于按整类错误率匹配。 +- IP 组同步间隔下限由 5 分钟调整为 1 分钟,便于更频繁同步自动/订阅名单。 ### 修复 diff --git a/frontend/app/(main)/waf/components/ip-group-dialog.tsx b/frontend/app/(main)/waf/components/ip-group-dialog.tsx index f3693c8c..987ee3c3 100644 --- a/frontend/app/(main)/waf/components/ip-group-dialog.tsx +++ b/frontend/app/(main)/waf/components/ip-group-dialog.tsx @@ -58,7 +58,7 @@ const ipGroupSchema = z subscription_url: z.string(), subscription_format: z.enum(['text', 'json']), subscription_mapping_rule: z.string(), - sync_interval_minutes: z.number().int().min(5), + sync_interval_minutes: z.number().int().min(1), }) .superRefine((value, context) => { if (value.type === 'subscription' && !value.subscription_url.trim()) { @@ -329,7 +329,7 @@ export function IPGroupDialog({ field.onChange(Number(event.target.value)) @@ -337,7 +337,7 @@ export function IPGroupDialog({ /> - 最小 5 分钟,默认 1440 分钟。 + 最小 1 分钟,默认 1440 分钟。 @@ -376,7 +376,7 @@ export function IPGroupDialog({ field.onChange(Number(event.target.value)) @@ -384,7 +384,8 @@ export function IPGroupDialog({ /> - 定时从请求日志挖掘恶意 IP 的周期。最小 5 分钟。 + 定时从请求日志挖掘恶意 IP 的周期。最小 1 分钟,默认 + 1440 分钟。 diff --git a/internal/apps/openflare/waf/logics.go b/internal/apps/openflare/waf/logics.go index 53c115d3..f33991f6 100644 --- a/internal/apps/openflare/waf/logics.go +++ b/internal/apps/openflare/waf/logics.go @@ -32,7 +32,8 @@ const ( defaultWAFIPGroupSyncIntervalMinutes = 1440 defaultWAFIPGroupAutoLookbackMinutes = 60 - minWAFIPGroupSyncIntervalMinutes = 5 + minWAFIPGroupSyncIntervalMinutes = 1 + minWAFIPGroupAutoLookbackMinutes = 5 maxWAFIPGroupSyncIntervalMinutes = 43200 minPoWSessionTTLSeconds = 60 minPoWChallengeTTLSeconds = 30 @@ -507,8 +508,8 @@ func parseIPGroupAutoConfig(raw json.RawMessage) (ipGroupAutoConfig, error) { if config.LookbackMinutes <= 0 { config.LookbackMinutes = defaultWAFIPGroupAutoLookbackMinutes } - if config.LookbackMinutes < minWAFIPGroupSyncIntervalMinutes { - config.LookbackMinutes = minWAFIPGroupSyncIntervalMinutes + if config.LookbackMinutes < minWAFIPGroupAutoLookbackMinutes { + config.LookbackMinutes = minWAFIPGroupAutoLookbackMinutes } if config.LookbackMinutes > maxWAFIPGroupSyncIntervalMinutes { config.LookbackMinutes = maxWAFIPGroupSyncIntervalMinutes