1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Add status reporting to auth server

This commit is contained in:
NG (Graham)
2025-11-03 19:24:20 -05:00
parent 7579963893
commit 2583429af8
28 changed files with 216 additions and 18 deletions

View File

@@ -31,6 +31,7 @@ argon2 = { version = "0.5", features = [ "std" ] }
sha2 = "0.10"
reqwest = { version = "0.12", default-features = false, features = [ "rustls-tls", "charset" ] }
reqwest-websocket = { version = "0.5", default-features = false, features = [ "json" ] }
oj_serdes.workspace = true
oj_rc_database = { version = "*", path = "../rc_database" }
oj_rc_factory = { version = "*", path = "../rc_factory" }

View File

@@ -83,6 +83,12 @@ impl super::IntercomUser for super::account_json::UserData {
log::error!("Failed to send intercom maintenance mode message: {}", e);
}
}
async fn update_status(&self, server_name: &str, msg: oj_serdes::ServerStatus) {
if let Err(e) = self.post_to_intercom(&msg, ".status", server_name).await {
log::error!("Failed to send intercom status message: {}", e);
}
}
}
#[derive(Serialize, Deserialize, Clone, Debug)]

View File

@@ -323,7 +323,7 @@ pub enum MultiplayerErrorCode {
}
#[async_trait::async_trait]
pub trait MultiplayerUser: CommonUser {
pub trait MultiplayerUser: IntercomUser + CommonUser {
fn user_id(&self) -> i32;
fn user_name(&self) -> &'_ str;
fn display_name(&self) -> &'_ str;
@@ -334,11 +334,12 @@ pub trait MultiplayerUser: CommonUser {
}
#[async_trait::async_trait]
pub trait IntercomUser {
pub trait IntercomUser: CommonUser {
async fn save_custom_avatar(&self, image: Vec<u8>) -> Result<(), polariton_server::operations::SimpleOpError>;
async fn webservice_listener(&self) -> Result<IntercomListener<super::intercom::IntercomWebServiceUserMessage>, polariton_server::operations::SimpleOpError>;
async fn show_dev_message(&self, msg: super::intercom::IntercomDevMessage, to: Vec<String>);
async fn enter_maintenance(&self, msg: super::intercom::IntercomMaintenanceMessage, to: Vec<String>);
async fn update_status(&self, server_name: &str, msg: oj_serdes::ServerStatus);
}
pub struct IntercomListener<D: serde::de::DeserializeOwned> {