Authentication

This commit is contained in:
2025-10-13 22:25:50 +02:00
parent 721a79cf74
commit e425461a29
2 changed files with 4 additions and 6 deletions
+3 -5
View File
@@ -13,11 +13,9 @@ struct AuthApiRes {
} }
pub fn auth(_server: &Arc<Server>, client: &mut Client, token: &str) -> crate::Result<String> { pub fn auth(_server: &Arc<Server>, client: &mut Client, token: &str) -> crate::Result<String> {
let mut res = ureq::get(format!( let mut res = ureq::get(format!("https://vxchat.netlify.app/api/auth?token={token}"))
"http://localhost:3000/api/auth?intents=server&token={token}" .call()
)) .context("Failed to authenticate")?;
.call()
.context("Failed to authenticate")?;
let api_res: AuthApiRes = serde_json::from_str(&res.body_mut().read_to_string()?)?; let api_res: AuthApiRes = serde_json::from_str(&res.body_mut().read_to_string()?)?;
client.set_uuid(&api_res.user_id); client.set_uuid(&api_res.user_id);
LOGGER.info(format!("{} successfully authenticated", api_res.user_id)); LOGGER.info(format!("{} successfully authenticated", api_res.user_id));
+1 -1
View File
@@ -28,7 +28,7 @@ pub mod handshake {
if !request_line.starts_with("GET") { if !request_line.starts_with("GET") {
return Err(std::io::Error::new( return Err(std::io::Error::new(
std::io::ErrorKind::InvalidData, std::io::ErrorKind::InvalidData,
"Invalid HTTP method", format!("Invalid HTTP method: {request_line}"),
)); ));
} }