add user conv impl

This commit is contained in:
2025-12-29 17:23:05 +01:00
parent 5a8d1e447b
commit 8671b03856
15 changed files with 316 additions and 382 deletions

View File

@@ -1,6 +1,7 @@
use axum::serve;
use axum::Extension;
use axum::extract::{ws::{Message, WebSocket, WebSocketUpgrade}, State};
use jsonwebtoken::{DecodingKey, EncodingKey};
use reqwest::header::AUTHORIZATION;
use reqwest::header::CONTENT_TYPE;
@@ -25,8 +26,8 @@ use crate::utils::auth::JwtKeys;
use std::env;
use dotenvy::dotenv;
use tower_http::cors::{CorsLayer, Any};
//use tower_http::cors::Origin;
use tower_http::cors::{CorsLayer, Any,};
use axum::http::{Method, HeaderValue};
pub async fn notify_discord(msg: &str) -> Result<(), reqwest::Error> {
@@ -91,13 +92,15 @@ std::panic::set_hook(Box::new(|info| {
decoding: DecodingKey::from_secret(jwt_secret.as_ref()),
};
let allowed_origins = vec![
"http://82.66.253.209",
"http://localhost:5173",
];
let cors = CorsLayer::new()
.allow_origin("http://localhost:5173".parse::<HeaderValue>().unwrap())
.allow_credentials(true)
.allow_methods([Method::GET, Method::POST, Method::PUT , Method::OPTIONS])
.allow_headers([CONTENT_TYPE, AUTHORIZATION]);
let cors = CorsLayer::very_permissive()
.allow_credentials(true)
.allow_methods([Method::GET, Method::POST, Method::PUT, Method::OPTIONS])
.allow_headers([CONTENT_TYPE, AUTHORIZATION]);
let app = create_router(state)
.layer(Extension(jwt_keys))
.layer(cors);