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