mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Move Svelto/RC op ID copying logic into openjam servers
This commit is contained in:
@@ -11,6 +11,7 @@ use polariton_server::operations::OperationsHandler;
|
|||||||
|
|
||||||
pub fn handler(chat_system: crate::state::chat::ChatImpl, data_root: impl AsRef<std::path::Path>, conf: &rc_core::persist::config::ConfigImpl) -> OperationsHandler<crate::UserTy> {
|
pub fn handler(chat_system: crate::state::chat::ChatImpl, data_root: impl AsRef<std::path::Path>, conf: &rc_core::persist::config::ConfigImpl) -> OperationsHandler<crate::UserTy> {
|
||||||
OperationsHandler::new()
|
OperationsHandler::new()
|
||||||
|
.modify(rc_core::polariton::OpIdCopy)
|
||||||
.add(more_auth::MoreLobbyAuth::new(chat_system.clone(), data_root))
|
.add(more_auth::MoreLobbyAuth::new(chat_system.clone(), data_root))
|
||||||
.add(chat_ignores::ignores_provider())
|
.add(chat_ignores::ignores_provider())
|
||||||
.add(pending_sanctions::pending_sanctions_checker())
|
.add(pending_sanctions::pending_sanctions_checker())
|
||||||
|
|||||||
@@ -7,3 +7,5 @@ pub use state::UserState;
|
|||||||
pub mod persist;
|
pub mod persist;
|
||||||
pub use persist::user::{UserImpl, UserProvider, UserAuthenticator};
|
pub use persist::user::{UserImpl, UserProvider, UserAuthenticator};
|
||||||
pub use persist::config::{ConfigImpl, ConfigProvider};
|
pub use persist::config::{ConfigImpl, ConfigProvider};
|
||||||
|
|
||||||
|
pub mod polariton;
|
||||||
|
|||||||
2
rc_core/src/polariton/mod.rs
Normal file
2
rc_core/src/polariton/mod.rs
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
mod svelto_uuid_copy;
|
||||||
|
pub use svelto_uuid_copy::OpIdCopy;
|
||||||
15
rc_core/src/polariton/svelto_uuid_copy.rs
Normal file
15
rc_core/src/polariton/svelto_uuid_copy.rs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
use polariton_server::operations::OperationModifier;
|
||||||
|
|
||||||
|
pub struct OpIdCopy;
|
||||||
|
|
||||||
|
impl OpIdCopy {
|
||||||
|
const SERVICE_MAPPING_KEY: u8 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl <C: Clone + Send + Sync + 'static> OperationModifier<C> for OpIdCopy {
|
||||||
|
fn after(&self, req: &mut polariton::operation::OperationRequest<C>, resp: &mut polariton::operation::OperationResponse<C>) {
|
||||||
|
if let Some(svelto_service_id) = req.params.get(&Self::SERVICE_MAPPING_KEY) {
|
||||||
|
resp.params.insert(Self::SERVICE_MAPPING_KEY, svelto_service_id.to_owned());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -85,6 +85,7 @@ use polariton_server::operations::OperationsHandler;
|
|||||||
|
|
||||||
pub fn handler(init_ctx: &crate::InitConfig) -> OperationsHandler<crate::UserTy> {
|
pub fn handler(init_ctx: &crate::InitConfig) -> OperationsHandler<crate::UserTy> {
|
||||||
OperationsHandler::new()
|
OperationsHandler::new()
|
||||||
|
.modify(rc_core::polariton::OpIdCopy)
|
||||||
.add(eac::EacChallengeIgnorer)
|
.add(eac::EacChallengeIgnorer)
|
||||||
.add(more_auth::MoreLobbyAuth)
|
.add(more_auth::MoreLobbyAuth)
|
||||||
.add(versioner::VersionTeller)
|
.add(versioner::VersionTeller)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use polariton_server::operations::OperationsHandler;
|
|||||||
|
|
||||||
pub fn handler() -> OperationsHandler<crate::UserTy> {
|
pub fn handler() -> OperationsHandler<crate::UserTy> {
|
||||||
OperationsHandler::<crate::UserTy>::new()
|
OperationsHandler::<crate::UserTy>::new()
|
||||||
|
.modify(rc_core::polariton::OpIdCopy)
|
||||||
.add(more_auth::MoreLobbyAuth)
|
.add(more_auth::MoreLobbyAuth)
|
||||||
.add(eac::EacChallengeIgnorer)
|
.add(eac::EacChallengeIgnorer)
|
||||||
.add(load_ai_robots::tdm_machines_provider())
|
.add(load_ai_robots::tdm_machines_provider())
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use polariton_server::operations::OperationsHandler;
|
|||||||
|
|
||||||
pub fn handler() -> OperationsHandler<crate::UserTy, crate::data::custom::CustomType> {
|
pub fn handler() -> OperationsHandler<crate::UserTy, crate::data::custom::CustomType> {
|
||||||
OperationsHandler::<crate::UserTy, crate::data::custom::CustomType>::new()
|
OperationsHandler::<crate::UserTy, crate::data::custom::CustomType>::new()
|
||||||
|
.modify(rc_core::polariton::OpIdCopy)
|
||||||
.add(more_auth::MoreLobbyAuth)
|
.add(more_auth::MoreLobbyAuth)
|
||||||
//.add(polariton_server::operations::Ack::<33, _>::default()) // get user clan info (this is equivalent to not being in a clan)
|
//.add(polariton_server::operations::Ack::<33, _>::default()) // get user clan info (this is equivalent to not being in a clan)
|
||||||
.add(friend_list::friends_provider()) // TODO friend object parsing Token: 0x0200169C RID: 5788
|
.add(friend_list::friends_provider()) // TODO friend object parsing Token: 0x0200169C RID: 5788
|
||||||
|
|||||||
Reference in New Issue
Block a user