mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 00:01:24 +01:00
require client base_url, rename from authority
The previous code used `server_name` as a fallback but in reality there is no real relationship between `server_name` and the location clients are supposed to make requests to. Additionally, the `insecure` option is gone, because we now allow users to control the entire URL, so they're free to choose the scheme.
This commit is contained in:
parent
48850605b0
commit
b9ee898920
3 changed files with 13 additions and 29 deletions
|
|
@ -30,24 +30,10 @@ pub(crate) async fn server(
|
|||
|
||||
/// Handler for `/.well-known/matrix/client`
|
||||
pub(crate) async fn client(_: Ar<client::Request>) -> Ra<client::Response> {
|
||||
let authority = services()
|
||||
.globals
|
||||
.config
|
||||
.server_discovery
|
||||
.client
|
||||
.authority
|
||||
.clone()
|
||||
.unwrap_or_else(|| services().globals.config.server_name.clone());
|
||||
|
||||
let scheme = if services().globals.config.server_discovery.client.insecure {
|
||||
"http"
|
||||
} else {
|
||||
"https"
|
||||
};
|
||||
|
||||
let base_url = format!("{scheme}://{authority}");
|
||||
|
||||
// I wish ruma used an actual URL type instead of `String`
|
||||
let base_url =
|
||||
services().globals.config.server_discovery.client.base_url.to_string();
|
||||
|
||||
Ra(client::Response {
|
||||
homeserver: client::HomeserverInfo::new(base_url.clone()),
|
||||
identity_server: None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue