forked from
smokesignal.events/smokesignal
i18n+filtering fork - fluent-templates v2
1//! # HTTP Module
2//!
3//! Web server implementation using the Axum framework with HTMX support for dynamic user interactions.
4//!
5//! This module contains all the HTTP request handlers, middleware, and utilities for the smokesignal
6//! web application. It provides a modern, responsive interface for event management and RSVP functionality.
7//!
8//! ## Architecture
9//!
10//! The HTTP module is organized around several key concepts:
11//!
12//! ### Request Handlers
13//! - **Event Management**: [`handle_create_event`], [`handle_edit_event`], [`handle_view_event`]
14//! - **RSVP System**: [`handle_create_rsvp`], [`handle_view_rsvp`]
15//! - **Administration**: [`handle_admin_index`], [`handle_admin_events`], [`handle_admin_event`] and other admin modules
16//! - **Authentication**: [`handle_oauth_login`], [`handle_oauth_callback`], [`handle_oauth_metadata`] OAuth flow handlers
17//! - **User Interface**: [`handle_index`], [`handle_profile`], [`handle_settings`]
18//!
19//! ### Middleware
20//! - **[`middleware_auth`]** - Authentication and session management
21//! - **[`middleware_i18n`]** - Internationalization and locale detection
22//! - **[`middleware_filter`]** - Request filtering and validation
23//!
24//! ### Support Utilities
25//! - **[`context`]** - Request context management and template data preparation
26//! - **[`templates`]** - Template rendering and response generation
27//! - **[`pagination`]** - List pagination utilities
28//! - **[`errors`]** - HTTP error handling and user-friendly error pages
29//!
30//! ## Features
31//!
32//! ### HTMX Integration
33//! The application heavily uses HTMX for dynamic interactions:
34//! - Partial page updates without full page reloads
35//! - Real-time RSVP updates
36//! - Progressive enhancement for accessibility
37//! - Automatic detection of HTMX requests for appropriate responses
38//!
39//! ### Internationalization
40//! Full i18n support with automatic locale detection:
41//! - Language preference detection from headers and user settings
42//! - Gender-aware translations for personalized content
43//! - Graceful fallback to English when translations are missing
44//!
45//! ### Template System
46//! Unified template rendering with automatic context enrichment:
47//! - Consistent layout and styling with Bulma CSS
48//! - Automatic injection of common template variables
49//! - Error templates with proper context and user guidance
50//! - Support for both full page and partial rendering
51//!
52//! ### Security
53//! - CSRF protection for state-changing operations
54//! - Secure session management with Redis/Valkey
55//! - Input validation and sanitization
56//! - Rate limiting and abuse prevention
57//!
58//! ## Example Usage
59//!
60//! ```rust,no_run
61//! use smokesignal::http::server;
62//! use smokesignal::config::Config;
63//!
64//! async fn start_server() -> anyhow::Result<()> {
65//! let config = Config::from_env().await?;
66//! server::run(config).await
67//! }
68//! ```
69
70pub mod cache_countries;
71pub mod context;
72pub mod errors;
73pub mod event_form;
74pub mod event_view;
75pub mod handle_admin_denylist;
76pub mod handle_admin_event;
77pub mod handle_admin_events;
78pub mod handle_admin_handles;
79pub mod handle_admin_import_event;
80pub mod handle_admin_import_rsvp;
81pub mod handle_admin_index;
82pub mod handle_admin_rsvp;
83pub mod handle_admin_rsvps;
84pub mod handle_create_event;
85pub mod handle_create_rsvp;
86pub mod handle_edit_event;
87pub mod handle_filter_events;
88pub mod handle_import;
89pub mod handle_index;
90pub mod handle_migrate_event;
91pub mod handle_migrate_rsvp;
92pub mod handle_oauth_callback;
93pub mod handle_oauth_jwks;
94pub mod handle_oauth_login;
95pub mod handle_oauth_logout;
96pub mod handle_oauth_metadata;
97pub mod handle_policy;
98pub mod handle_profile;
99pub mod handle_set_language;
100pub mod handle_settings;
101pub mod handle_view_event;
102pub mod handle_ical_event; // New iCal handler
103pub mod handle_view_feed;
104pub mod handle_view_rsvp;
105pub mod location_edit_status;
106pub mod macros;
107pub mod middleware_auth;
108pub mod middleware_filter;
109pub mod middleware_i18n;
110pub mod middleware_timezone;
111pub mod pagination;
112pub mod rsvp_form;
113pub mod server;
114pub mod tab_selector;
115pub mod template_renderer;
116pub mod templates;
117pub mod timezones;
118pub mod utils;