Working auth

This commit is contained in:
2025-10-14 00:32:07 +02:00
parent d14f162c08
commit 26d12c443e
2 changed files with 9 additions and 6 deletions
+3 -2
View File
@@ -12,9 +12,10 @@ struct AuthApiRes {
user_id: String,
}
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!(
"http://localhost:3000/api/auth?intents=server&token={token}"
"https://vxchat.netlify.app/api/auth?token={token}&key={}",
server.config.server_key
))
.call()
.context("Failed to authenticate")?;
+6 -4
View File
@@ -19,10 +19,11 @@ pub use once_cell;
#[derive(serde::Serialize, serde::Deserialize)]
pub struct ServerConfig {
server_name: String,
server_id: String,
port: u16,
channels: Vec<types::data::Channel>,
pub server_name: String,
pub server_id: String,
pub server_key: String,
pub port: u16,
pub channels: Vec<types::data::Channel>,
}
#[allow(dead_code)]
@@ -40,6 +41,7 @@ impl Default for ServerConfig {
port: 7080,
server_name: format!("Server Name"),
server_id: format!("offline-server"),
server_key: format!(""),
channels: Vec::new(),
}
}