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

Get part way through loading (to sync) #30

This commit is contained in:
NG (Graham)
2025-07-06 17:36:52 -04:00
parent 38ab4ba799
commit 1d404db209
31 changed files with 1049 additions and 100 deletions

View File

@@ -43,7 +43,9 @@ pub struct RegistrationInfo {
#[async_trait::async_trait]
pub trait UserProvider<C> {
async fn authenticate(&self, user: UserToken, ext: std::collections::HashMap<std::any::TypeId, Box<dyn std::any::Any + Send + Sync + 'static>>) -> Result<Box<dyn User<C> + Send + Sync>, String>;
async fn authenticate(&self, user: UserToken) -> Result<Box<dyn User<C> + Send + Sync>, String>;
async fn multiplayer_authenticate(&self, user: String) -> Result<Box<dyn User<C> + Send + Sync>, String>;
}
#[async_trait::async_trait]
@@ -54,9 +56,8 @@ pub trait UserAuthenticator {
}
#[async_trait::async_trait]
pub trait User<C>: ChatUser + LobbyUser {
fn ext(&self, ty: std::any::TypeId) -> Option<&'_ (dyn std::any::Any + Send + Sync + 'static)>;
fn token(&self) -> &'_ super::UserToken;
pub trait User<C>: ChatUser + LobbyUser + MultiplayerUser {
fn public_id(&self) -> &'_ str;
fn is_mod(&self) -> bool;
fn is_admin(&self) -> bool;
fn is_dev(&self) -> bool;
@@ -230,3 +231,11 @@ impl SanctionType {
pub trait LobbyUser {
async fn player_data(&self) -> Result<crate::data::player_data::PlayerData, polariton_server::operations::SimpleOpError>;
}
#[async_trait::async_trait]
pub trait MultiplayerUser {
// TODO
fn user_id(&self) -> i32;
fn user_name(&self) -> &'_ str;
fn display_name(&self) -> &'_ str;
}