/
Undeadguy
/
conduit
Обзор
Документация
Войти
/
Undeadguy
/
conduit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
src/api/ruma_wrapper/mod.rs
43 строки
990 B
Matthias Ahouansou
feat(appservice): ensure users/aliases outside of namespaces are not accessed
24 апр 2024, 21:51
24 апр 2024, 21:51
3086271
Код
Авторство
О чём код?
use crate::{service::appservice::RegistrationInfo, Error}; use ruma::{ api::client::uiaa::UiaaResponse, CanonicalJsonValue, OwnedDeviceId, OwnedServerName, OwnedUserId, }; use std::ops::Deref; #[cfg(feature = "conduit_bin")] mod axum; /// Extractor for Ruma request structs pub struct Ruma<T> { pub body: T, pub sender_user: Option<OwnedUserId>, pub sender_device: Option<OwnedDeviceId>, pub sender_servername: Option<OwnedServerName>, // This is None when body is not a valid string pub json_body: Option<CanonicalJsonValue>, pub appservice_info: Option<RegistrationInfo>, } impl<T> Deref for Ruma<T> { type Target = T; fn deref(&self) -> &Self::Target { &self.body } } #[derive(Clone)] pub struct RumaResponse<T>(pub T); impl<T> From<T> for RumaResponse<T> { fn from(t: T) -> Self { Self(t) } } impl From<Error> for RumaResponse<UiaaResponse> { fn from(t: Error) -> Self { t.to_response() } }