Expose ban-time escalation settings in jail detail and config UI
- Backend: Add BantimeEscalation + BantimeEscalationUpdate Pydantic models to app/models/config.py; add bantime_escalation field to Jail in jail.py - Backend: jail_service.get_jail_detail() fetches 7 bantime.* socket commands (increment, factor, formula, multipliers, maxtime, rndtime, overalljails) and populates bantime_escalation on the returned Jail object - Backend: config_service.get_jail_config() fetches same 7 commands; update_jail_config() writes escalation fields when provided - Frontend: Add BantimeEscalation + BantimeEscalationUpdate interfaces to types/config.ts; extend JailConfig + JailConfigUpdate; extend Jail in types/jail.ts - Frontend: JailDetailPage.tsx adds BantimeEscalationSection component that renders only when increment is enabled (shows factor, formula, multipliers, max_time, rnd_time, overall_jails) - Frontend: ConfigPage.tsx JailAccordionPanel adds full escalation edit form (Switch for enable/disable, number inputs for factor/max_time/rnd_time, text inputs for formula/multipliers, Switch for overall_jails); handleSave includes bantime_escalation in the JailConfigUpdate payload - Tests: Update ConfigPageLogPath.test.tsx mock to include bantime_escalation:null - Docs: Mark Task 6 as DONE in Tasks.md
This commit is contained in:
@@ -2,6 +2,39 @@
|
||||
* TypeScript interfaces for the configuration and server settings API.
|
||||
*/
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Ban-time escalation
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/** Incremental ban-time escalation settings for a jail. */
|
||||
export interface BantimeEscalation {
|
||||
/** Whether incremental banning is enabled. */
|
||||
increment: boolean;
|
||||
/** Multiplier applied to base ban time on each repeat offence, or null. */
|
||||
factor: number | null;
|
||||
/** Python expression for escalated ban time, or null. */
|
||||
formula: string | null;
|
||||
/** Space-separated per-offence multipliers, or null. */
|
||||
multipliers: string | null;
|
||||
/** Maximum ban duration in seconds, or null (no cap). */
|
||||
max_time: number | null;
|
||||
/** Random jitter (seconds) added to escalated ban time, or null. */
|
||||
rnd_time: number | null;
|
||||
/** Count repeat offences across all jails, not just the current one. */
|
||||
overall_jails: boolean;
|
||||
}
|
||||
|
||||
/** Partial update payload for ban-time escalation settings. */
|
||||
export interface BantimeEscalationUpdate {
|
||||
increment?: boolean | null;
|
||||
factor?: number | null;
|
||||
formula?: string | null;
|
||||
multipliers?: string | null;
|
||||
max_time?: number | null;
|
||||
rnd_time?: number | null;
|
||||
overall_jails?: boolean | null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Jail Configuration
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -18,6 +51,7 @@ export interface JailConfig {
|
||||
log_encoding: string;
|
||||
backend: string;
|
||||
actions: string[];
|
||||
bantime_escalation: BantimeEscalation | null;
|
||||
}
|
||||
|
||||
export interface JailConfigResponse {
|
||||
@@ -38,6 +72,7 @@ export interface JailConfigUpdate {
|
||||
date_pattern?: string | null;
|
||||
dns_mode?: string | null;
|
||||
enabled?: boolean | null;
|
||||
bantime_escalation?: BantimeEscalationUpdate | null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
* - `backend/app/models/geo.py` (GeoDetail / IpLookupResponse)
|
||||
*/
|
||||
|
||||
import type { BantimeEscalation } from "./config";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Jail statistics
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -107,6 +109,8 @@ export interface Jail {
|
||||
max_retry: number;
|
||||
/** Live counters, or `null` when not available. */
|
||||
status: JailStatus | null;
|
||||
/** Incremental ban-time escalation settings, or `null` if not configured. */
|
||||
bantime_escalation: BantimeEscalation | null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user