Updating auth
This commit is contained in:
@@ -5,6 +5,16 @@ use serenity::{
|
||||
};
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
use tokio::sync::broadcast;
|
||||
use uuid::Uuid;
|
||||
|
||||
/// Data stored per-entry in the Discord OAuth state cache.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct DiscordOAuthState {
|
||||
/// Where to send the browser after the OAuth dance completes.
|
||||
pub redirect_uri: String,
|
||||
/// Set when a logged-in user is connecting (not logging in) via Discord.
|
||||
pub connecting_user_id: Option<Uuid>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AppState {
|
||||
@@ -12,9 +22,9 @@ pub struct AppState {
|
||||
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>>>,
|
||||
/// Maps oauth_state → DiscordOAuthState.
|
||||
/// Populated on /authorize or /connect, consumed on /callback.
|
||||
pub discord_authorize_cache: Arc<Mutex<HashMap<String, DiscordOAuthState>>>,
|
||||
pub http: Arc<Http>,
|
||||
pub cache: Arc<Cache>,
|
||||
/// Per-map WebSocket broadcast channels for real-time collaboration.
|
||||
|
||||
Reference in New Issue
Block a user