Files
xevion.dev/src/state.rs
Xevion 8aa14a2cab refactor: replace SVG sprite with client-side icon fetching and Rust caching
Eliminates server-side batch rendering and IconSprite pattern in favor of:
- Rust handler with moka cache (10k icons, 24h TTL, immutable HTTP headers)
- Client Icon component fetches SVGs on-demand with shimmer loading states
- Removes renderIconsBatch, tag-icons collection logic, and page load icon preprocessing
- Reduces SSR complexity and data serialization overhead
2026-01-15 10:33:43 -06:00

35 lines
902 B
Rust

use std::sync::Arc;
use crate::{
auth::SessionManager, cache::IsrCache, health::HealthChecker, http::HttpClient,
icon_cache::IconCache, tarpit::TarpitState,
};
/// Application state shared across all handlers
#[derive(Clone)]
pub struct AppState {
pub client: HttpClient,
pub health_checker: Arc<HealthChecker>,
pub tarpit_state: Arc<TarpitState>,
pub pool: sqlx::PgPool,
pub session_manager: Arc<SessionManager>,
pub isr_cache: Arc<IsrCache>,
pub icon_cache: Arc<IconCache>,
}
/// Errors that can occur during proxying to Bun
#[derive(Debug)]
pub enum ProxyError {
Network(reqwest::Error),
}
impl std::fmt::Display for ProxyError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ProxyError::Network(e) => write!(f, "Network error: {e}"),
}
}
}
impl std::error::Error for ProxyError {}