fd685e8211
refactor: Remove unused HTTPException imports from routers
...
After removing all try/except blocks that used HTTPException for domain
exception conversion, these imports are no longer needed in the routers.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com >
2026-04-23 16:01:44 +02:00
5480dce221
refactor: Remove duplicate router-level exception helpers
...
All routers now let domain exceptions propagate to the global handlers in main.py
instead of catching and converting them to HTTPException. This eliminates:
- Duplicate exception-to-HTTP-status mappings across 8 routers
- Duplicate helper functions (_bad_gateway, _not_found, _conflict, etc.)
- Inconsistent error response formats
Changes:
- Removed all try/except blocks from routers that catch domain exceptions
- Removed duplicate helper functions from all routers
- Added missing exception handlers to main.py for:
* ActionNameError
* FilterNameError
* JailNameError
* JailNotFoundInConfigError
* FilterInvalidRegexError
- Removed unused imports from affected routers
All domain exceptions now propagate to the single authoritative mapping in
main.py, ensuring consistent error codes, messages, and logging across the API.
Affected routers:
- action_config.py: Removed _action_not_found, _bad_request, _not_found helpers
- bans.py: Removed try/except in ban/unban endpoints
- config_misc.py: Removed try/except blocks
- file_config.py: Removed 6 try/except blocks and _service_unavailable helper
- filter_config.py: Removed try/except blocks
- geo.py: Removed try/except in lookup_ip endpoint
- jail_config.py: Removed try/except blocks
- jails.py: Removed try/except blocks
- server.py: Removed try/except blocks
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com >
2026-04-23 16:00:37 +02:00
8c6950afc1
Task 13: move ban_ip, unban_ip, and get_active_bans from jail_service to ban_service and update routers/tests
2026-04-17 16:22:20 +02:00
328f3575e2
Move Fail2Ban exceptions into central app.exceptions module
2026-04-15 10:22:48 +02:00
56ade7fb08
Task 13: wire geo_batch_lookup through dependency injection and mark task completed
2026-04-14 09:51:23 +02:00
f0ee466603
backup
2026-04-06 19:49:53 +02:00
42c030c706
Refactor backend to use request-scoped SQLite connections
2026-04-05 23:14:46 +02:00
a442836c5c
refactor: complete Task 2/3 geo decouple + exceptions centralization; mark as done
2026-03-22 14:24:25 +01:00
28f7b1cfcd
Make geo lookups non-blocking with bulk DB writes and background tasks
2026-03-12 18:10:00 +01:00
4773ae1c7a
Add mass unban: DELETE /api/bans/all clears all active bans
...
- Send fail2ban's `unban --all` command via new `unban_all_ips()` service
function; returns the count of unbanned IPs
- Add `UnbanAllResponse` Pydantic model (message + count)
- Add `DELETE /api/bans/all` router endpoint; handles 502 on socket error
- Frontend: `bansAll` endpoint constant, `unbanAllBans()` API call,
`UnbanAllResponse` type, `unbanAll` action in `useActiveBans` hook
- JailsPage: "Clear All Bans" button (visible when bans > 0) with a
Fluent UI confirmation Dialog before executing the operation
- 7 new tests (3 service, 4 router); 440 total pass, 82% coverage
2026-03-07 21:16:49 +01:00
ebec5e0f58
Stage 6: jail management — backend service, routers, tests, and frontend
...
- jail_service.py: list/detail/control/ban/unban/ignore-list/IP-lookup
- jails.py router: 11 endpoints including ignore list management
- bans.py router: active bans, ban, unban
- geo.py router: IP lookup with geo enrichment
- models: Jail.actions, ActiveBan.country/.banned_at optional, GeoDetail
- 217 tests pass (40 service + 36 router + 141 existing), 76% coverage
- Frontend: types/jail.ts, api/jails.ts, hooks/useJails.ts
- JailsPage: jail overview table with controls, ban/unban forms,
active bans table, IP lookup
- JailDetailPage: full detail, start/stop/idle/reload, patterns,
ignore list management
2026-03-01 14:09:02 +01:00