mirror of
https://github.com/NetworkCats/rustyip.git
synced 2026-11-13 16:17:46 +00:00
Split the 957-line handlers.rs into 4 focused files: - handlers/mod.rs: shared state, IP resolution, non-browser request helper - handlers/html.rs: HTML template rendering with Askama custom i18n filter, eliminating the Translations struct and ~250 lines of boilerplate - handlers/api.rs: JSON/plain-text API endpoints with generic field_handler and proxy_field_handler helpers (consolidates 8 near-identical handlers) - handlers/seo.rs: robots.txt, sitemap, OpenAPI, manifest DRY improvements included: - extract_ip_from_header() parameterized helper (deduplicates CF/IPv4 extraction) - handle_non_browser_request() helper (deduplicates CLI/JSON early-return) - append_ip_query() helper (deduplicates ?ip= redirect construction) - field_handler/proxy_field_handler generics (consolidates 8 handlers) - Askama #[filter_fn] custom filter for i18n (eliminates Translations struct)