+ log files

+ more control on auth providers
+ server info in motd
+ bans and parsing minecraft server blacklist
+ more error handling
+ panic hook to tracing
This commit is contained in:
Shiroyasha 2024-08-15 14:10:39 +03:00
parent bd101fc3fa
commit d45a495cbf
Signed by: shiroyashik
GPG key ID: E4953D3940D7860A
21 changed files with 748 additions and 378 deletions

View file

@ -1,25 +1,20 @@
use axum::{
extract::State,
http::StatusCode,
response::{IntoResponse, Response},
Json
};
use tracing::debug;
use crate::{auth::{Token, Userinfo}, AppState};
use crate::{auth::{Token, Userinfo}, ApiResult, AppState};
pub(super) async fn create_user(
Token(token): Token,
State(state): State<AppState>,
Json(json): Json<Userinfo>
) -> Response {
match state.config.lock().await.clone().verify_token(&token) {
Ok(_) => {},
Err(e) => return e,
}
) -> ApiResult<&'static str> {
state.config.read().await.clone().verify_token(&token)?;
debug!("Creating new user: {json:?}");
state.user_manager.insert_user(json.uuid, json);
(StatusCode::OK, "ok".to_string()).into_response()
Ok("ok")
}