mirror of
https://github.com/Xevion/xevion.dev.git
synced 2026-01-31 08:26:41 -06:00
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
35 lines
902 B
Rust
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 {}
|