Major refactor
This commit is contained in:
23
crates/siren-api/src/app_state.rs
Normal file
23
crates/siren-api/src/app_state.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
use dashmap::DashMap;
|
||||
use serenity::{
|
||||
all::{Cache, Http},
|
||||
prelude::Mutex,
|
||||
};
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
use tokio::sync::broadcast;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AppState {
|
||||
pub client: reqwest::Client,
|
||||
pub client_id: String,
|
||||
pub client_secret: String,
|
||||
pub base_url: String,
|
||||
/// Maps oauth_state → ui_redirect_uri.
|
||||
/// Populated on /authorize, consumed on /callback.
|
||||
pub discord_authorize_cache: Arc<Mutex<HashMap<String, String>>>,
|
||||
pub http: Arc<Http>,
|
||||
pub cache: Arc<Cache>,
|
||||
/// Per-map WebSocket broadcast channels for real-time collaboration.
|
||||
/// Key is the CSPRNG map ID (TEXT).
|
||||
pub map_rooms: Arc<DashMap<String, broadcast::Sender<String>>>,
|
||||
}
|
||||
Reference in New Issue
Block a user