1#[macro_use]
3extern crate rust_i18n;
4
5i18n!("locales", fallback = "en");
6
7pub mod auth_keys;
8pub mod client_ip;
9pub mod config;
10pub mod files;
11pub mod handler;
12pub mod jwt_auth;
13pub mod model;
14pub mod pages;
15pub mod rate_limit;
16pub mod redirect_middleware;
17pub mod response;
18pub mod route;
19pub mod telemetry;
20pub mod token;
21
22pub use config::Config;
23pub use model::{LoginUserSchema, RegisterUserSchema, User};
24pub use token::{TokenClaims, TokenDetails};
25
26use redis::Client;
27use std::sync::Arc;
28use tokio::sync::Mutex;
29
30pub struct AppState {
31 pub conf: Config,
32 pub redis_client: Client,
33 pub frac: i64,
34 pub user: Mutex<Option<User>>,
35}
36
37impl AppState {
38 #[must_use]
39 pub fn new(conf: Config, redis_client: Client) -> Arc<Self> {
40 Arc::new(Self {
41 conf,
42 redis_client,
43 frac: 0,
44 user: Mutex::new(None),
45 })
46 }
47}