Auth testing

This commit is contained in:
2025-12-21 22:33:24 +01:00
parent 143db5d2e8
commit 0833537e5e
2 changed files with 15 additions and 1 deletions
+4 -1
View File
@@ -26,7 +26,7 @@ use crate::{
cli, logger,
plugin::{Plugin, loader::PluginLoader, types::LoaderMessage},
types,
utils::{self, client::Client},
utils::{self, auth, client::Client},
};
#[derive(serde::Serialize, serde::Deserialize)]
@@ -107,6 +107,9 @@ impl Server {
// Initialize plugins
Self::LOGGER.info("Initializing plugins");
Self::LOGGER.info("Authenticating");
auth::test(self)?;
// Initialize CLI
Self::LOGGER.info("Initializing CLI");
cli::start_cli(self.clone(), plugin_loader);
+11
View File
@@ -26,3 +26,14 @@ pub fn auth(server: &Arc<Server>, client: &mut Client, token: &str) -> crate::Re
LOGGER.info(format!("{} successfully authenticated", api_res.user_id));
Ok(api_res.user_id)
}
pub fn test(server: &Arc<Server>) -> crate::Result<()> {
ureq::get(format!(
"https://vxchat.netlify.app/api/test-auth?key={}&id={}",
server.config.server_key, server.config.server_id
))
.call()
.context("Failed to authenticate")?;
Ok(())
}