mirror of
https://github.com/youwen5/iamb.git
synced 2025-06-20 13:49:52 -07:00
Support following the .well-known entries for a username's domain (#209)
This commit is contained in:
parent
c5999bffc8
commit
84bc6be822
4 changed files with 29 additions and 8 deletions
|
@ -505,7 +505,7 @@ pub enum Layout {
|
|||
#[derive(Clone, Deserialize)]
|
||||
pub struct ProfileConfig {
|
||||
pub user_id: OwnedUserId,
|
||||
pub url: Url,
|
||||
pub url: Option<Url>,
|
||||
pub settings: Option<Tunables>,
|
||||
pub dirs: Option<Directories>,
|
||||
pub layout: Option<Layout>,
|
||||
|
|
|
@ -209,7 +209,7 @@ pub fn mock_settings() -> ApplicationSettings {
|
|||
profile_name: "test".into(),
|
||||
profile: ProfileConfig {
|
||||
user_id: user_id!("@user:example.com").to_owned(),
|
||||
url: Url::parse("https://example.com").unwrap(),
|
||||
url: None,
|
||||
settings: None,
|
||||
dirs: None,
|
||||
layout: None,
|
||||
|
|
|
@ -738,15 +738,21 @@ impl ClientWorker {
|
|||
let req_config = RequestConfig::new().timeout(req_timeout).retry_timeout(req_timeout);
|
||||
|
||||
// Set up the Matrix client for the selected profile.
|
||||
let client = Client::builder()
|
||||
let builder = Client::builder()
|
||||
.http_client(Arc::new(http))
|
||||
.homeserver_url(account.url.clone())
|
||||
.sled_store(settings.matrix_dir.as_path(), None)
|
||||
.expect("Failed to setup up sled store for Matrix SDK")
|
||||
.request_config(req_config)
|
||||
.build()
|
||||
.await
|
||||
.expect("Failed to instantiate Matrix client");
|
||||
.request_config(req_config);
|
||||
|
||||
let builder = if let Some(url) = account.url.as_ref() {
|
||||
// Use the explicitly specified homeserver.
|
||||
builder.homeserver_url(url.as_str())
|
||||
} else {
|
||||
// Try to discover the homeserver from the user ID.
|
||||
builder.server_name(account.user_id.server_name())
|
||||
};
|
||||
|
||||
let client = builder.build().await.expect("Failed to instantiate Matrix client");
|
||||
|
||||
let mut worker = ClientWorker {
|
||||
initialized: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue