admin debug command to fetch a server's true destination
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
1cbf2bdc6b
commit
450f15df4f
11 changed files with 329 additions and 42 deletions
|
@ -294,7 +294,8 @@ pub(crate) async fn register_route(body: Ruma<register::v3::Request>) -> Result<
|
|||
.admin
|
||||
.send_message(RoomMessageEventContent::notice_plain(format!(
|
||||
"New user \"{user_id}\" registered on this server."
|
||||
)));
|
||||
)))
|
||||
.await;
|
||||
}
|
||||
|
||||
// log in conduit admin channel if a guest registered
|
||||
|
@ -310,27 +311,30 @@ pub(crate) async fn register_route(body: Ruma<register::v3::Request>) -> Result<
|
|||
.send_message(RoomMessageEventContent::notice_plain(format!(
|
||||
"Guest user \"{user_id}\" with device display name `{device_display_name}` registered on this \
|
||||
server."
|
||||
)));
|
||||
)))
|
||||
.await;
|
||||
} else {
|
||||
services()
|
||||
.admin
|
||||
.send_message(RoomMessageEventContent::notice_plain(format!(
|
||||
"Guest user \"{user_id}\" with no device display name registered on this server.",
|
||||
)));
|
||||
)))
|
||||
.await;
|
||||
}
|
||||
} else {
|
||||
services()
|
||||
.admin
|
||||
.send_message(RoomMessageEventContent::notice_plain(format!(
|
||||
"Guest user \"{user_id}\" with no device display name registered on this server.",
|
||||
)));
|
||||
)))
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
||||
// If this is the first real user, grant them admin privileges except for guest
|
||||
// users Note: the server user, @conduit:servername, is generated first
|
||||
if !is_guest {
|
||||
if let Some(admin_room) = service::admin::Service::get_admin_room()? {
|
||||
if let Some(admin_room) = service::admin::Service::get_admin_room().await? {
|
||||
if services()
|
||||
.rooms
|
||||
.state_cache
|
||||
|
@ -461,7 +465,8 @@ pub(crate) async fn change_password_route(
|
|||
.admin
|
||||
.send_message(RoomMessageEventContent::notice_plain(format!(
|
||||
"User {sender_user} changed their password."
|
||||
)));
|
||||
)))
|
||||
.await;
|
||||
|
||||
Ok(change_password::v3::Response {})
|
||||
}
|
||||
|
@ -536,7 +541,8 @@ pub(crate) async fn deactivate_route(body: Ruma<deactivate::v3::Request>) -> Res
|
|||
.admin
|
||||
.send_message(RoomMessageEventContent::notice_plain(format!(
|
||||
"User {sender_user} deactivated their account."
|
||||
)));
|
||||
)))
|
||||
.await;
|
||||
|
||||
Ok(deactivate::v3::Response {
|
||||
id_server_unbind_result: ThirdPartyIdRemovalStatus::NoSupport,
|
||||
|
|
|
@ -97,7 +97,8 @@ pub(crate) async fn report_event_route(
|
|||
body.score.unwrap_or_else(|| ruma::Int::from(0)),
|
||||
HtmlEscape(body.reason.as_deref().unwrap_or(""))
|
||||
),
|
||||
));
|
||||
))
|
||||
.await;
|
||||
|
||||
// even though this is kinda security by obscurity, let's still make a small
|
||||
// random delay sending a successful response per spec suggestion regarding
|
||||
|
|
|
@ -239,7 +239,7 @@ async fn send_state_event_for_key_helper(
|
|||
},
|
||||
// admin room is a sensitive room, it should not ever be made public
|
||||
StateEventType::RoomJoinRules => {
|
||||
if let Some(admin_room_id) = service::admin::Service::get_admin_room()? {
|
||||
if let Some(admin_room_id) = service::admin::Service::get_admin_room().await? {
|
||||
if admin_room_id == room_id {
|
||||
if let Ok(join_rule) = serde_json::from_str::<RoomJoinRulesEventContent>(json.json().get()) {
|
||||
if join_rule.join_rule == JoinRule::Public {
|
||||
|
@ -254,7 +254,7 @@ async fn send_state_event_for_key_helper(
|
|||
},
|
||||
// admin room is a sensitive room, it should not ever be made world readable
|
||||
StateEventType::RoomHistoryVisibility => {
|
||||
if let Some(admin_room_id) = service::admin::Service::get_admin_room()? {
|
||||
if let Some(admin_room_id) = service::admin::Service::get_admin_room().await? {
|
||||
if admin_room_id == room_id {
|
||||
if let Ok(visibility_content) =
|
||||
serde_json::from_str::<RoomHistoryVisibilityEventContent>(json.json().get())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue