Working auth
This commit is contained in:
+3
-2
@@ -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
@@ -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(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user