mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
refactor: Fix errors in api/server/well_known.rs
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Error, Result};
|
use conduwuit::{Err, Result};
|
||||||
use ruma::api::{client::error::ErrorKind, federation::discovery::discover_homeserver};
|
use ruma::api::federation::discovery::discover_homeserver;
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
@@ -11,10 +11,10 @@ pub(crate) async fn well_known_server(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
_body: Ruma<discover_homeserver::Request>,
|
_body: Ruma<discover_homeserver::Request>,
|
||||||
) -> Result<discover_homeserver::Response> {
|
) -> Result<discover_homeserver::Response> {
|
||||||
Ok(discover_homeserver::Response {
|
Ok(discover_homeserver::Response::new(
|
||||||
server: match services.server.config.well_known.server.as_ref() {
|
match services.server.config.well_known.server.as_ref() {
|
||||||
| Some(server_name) => server_name.to_owned(),
|
| Some(server_name) => server_name.to_owned(),
|
||||||
| None => return Err(Error::BadRequest(ErrorKind::NotFound, "Not found.")),
|
| None => return Err!(Request(NotFound("No well-known server URL is configured."))),
|
||||||
},
|
},
|
||||||
})
|
))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user