mobile update
This commit is contained in:
@@ -1,14 +1,10 @@
|
||||
use axum::{
|
||||
routing::{get, post, put, delete},
|
||||
Router, middleware as axum_middleware,
|
||||
Extension,
|
||||
};
|
||||
use sea_orm::{sqlx, Database, DatabaseConnection, DbErr};
|
||||
use sea_orm_migration::prelude::*;
|
||||
use std::net::SocketAddr;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Instant;
|
||||
use utoipa::OpenApi;
|
||||
use utoipa_swagger_ui::SwaggerUi;
|
||||
use tower_sessions::{Expiry, SessionManagerLayer, cookie::SameSite};
|
||||
@@ -18,12 +14,6 @@ use time::Duration;
|
||||
use tower_http::cors::CorsLayer;
|
||||
use axum::http::{Method, HeaderValue};
|
||||
|
||||
pub enum MobileStoreEntry {
|
||||
Csrf { created_at: Instant },
|
||||
AuthToken { user_id: i32, created_at: Instant },
|
||||
}
|
||||
|
||||
pub type MobileTokenStore = Arc<Mutex<HashMap<String, MobileStoreEntry>>>;
|
||||
|
||||
pub mod models;
|
||||
pub mod services;
|
||||
@@ -179,13 +169,10 @@ pub async fn create_app(db: DatabaseConnection) -> Result<Router, DbErr> {
|
||||
.layer(auth_layer.clone())
|
||||
.with_state(db.clone());
|
||||
|
||||
let mobile_token_store: MobileTokenStore = Arc::new(Mutex::new(HashMap::new()));
|
||||
|
||||
let oauth_routes = Router::new()
|
||||
.route("/auth/google", get(routes::oauth::google_auth))
|
||||
.route("/auth/google/callback", get(routes::oauth::google_callback))
|
||||
.route("/auth/mobile-callback", get(routes::oauth::mobile_callback))
|
||||
.layer(Extension(mobile_token_store))
|
||||
.layer(auth_layer.clone())
|
||||
.with_state(db.clone());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user