Moved label

This commit is contained in:
2025-12-11 21:06:54 +01:00
parent 5d8a93ce84
commit df2ac3fe4d
4 changed files with 2 additions and 2 deletions
+28
View File
@@ -0,0 +1,28 @@
use std::sync::Arc;
use anyhow::Context;
use serde::Deserialize;
use crate::logger;
use crate::server::Server;
use crate::utils::client::Client;
logger!(LOGGER "Auth");
#[derive(Debug, Deserialize)]
struct AuthApiRes {
user_id: String,
}
pub fn auth(server: &Arc<Server>, client: &mut Client, token: &str) -> crate::Result<String> {
let mut res = ureq::get(format!(
"https://vxchat.netlify.app/api/auth?token={token}&key={}",
server.config.server_key
))
.call()
.context("Failed to authenticate")?;
let api_res: AuthApiRes = serde_json::from_str(&res.body_mut().read_to_string()?)?;
client.set_uuid(&api_res.user_id);
LOGGER.info(format!("{} successfully authenticated", api_res.user_id));
Ok(api_res.user_id)
}
+1
View File
@@ -1,3 +1,4 @@
pub mod auth;
pub mod client;
pub mod database;
#[cfg(feature = "loader")]