@@ -17,7 +17,6 @@ use mas_config::{
17
17
use mas_data_model:: { Device , TokenType , Ulid , UpstreamOAuthProvider , User } ;
18
18
use mas_email:: Address ;
19
19
use mas_matrix:: HomeserverConnection ;
20
- use mas_matrix_synapse:: SynapseConnection ;
21
20
use mas_storage:: {
22
21
Clock , RepositoryAccess , SystemClock ,
23
22
compat:: { CompatAccessTokenRepository , CompatSessionFilter , CompatSessionRepository } ,
@@ -33,7 +32,10 @@ use rand::{RngCore, SeedableRng};
33
32
use sqlx:: { Acquire , types:: Uuid } ;
34
33
use tracing:: { error, info, info_span, warn} ;
35
34
36
- use crate :: util:: { database_connection_from_config, password_manager_from_config} ;
35
+ use crate :: util:: {
36
+ database_connection_from_config, homeserver_connection_from_config,
37
+ password_manager_from_config,
38
+ } ;
37
39
38
40
const USER_ATTRIBUTES_HEADING : & str = "User attributes" ;
39
41
@@ -491,12 +493,7 @@ impl Options {
491
493
let matrix_config = MatrixConfig :: extract ( figment) ?;
492
494
493
495
let password_manager = password_manager_from_config ( & password_config) . await ?;
494
- let homeserver = SynapseConnection :: new (
495
- matrix_config. homeserver ,
496
- matrix_config. endpoint ,
497
- matrix_config. secret ,
498
- http_client,
499
- ) ;
496
+ let homeserver = homeserver_connection_from_config ( & matrix_config, http_client) ;
500
497
let mut conn = database_connection_from_config ( & database_config) . await ?;
501
498
let txn = conn. begin ( ) . await ?;
502
499
let mut repo = PgRepository :: from_conn ( txn) ;
@@ -746,7 +743,7 @@ impl std::fmt::Display for HumanReadable<&UpstreamOAuthProvider> {
746
743
async fn check_and_normalize_username < ' a > (
747
744
localpart_or_mxid : & ' a str ,
748
745
repo : & mut dyn RepositoryAccess < Error = DatabaseError > ,
749
- homeserver : & SynapseConnection ,
746
+ homeserver : & dyn HomeserverConnection ,
750
747
) -> anyhow:: Result < & ' a str > {
751
748
// XXX: this is a very basic MXID to localpart conversion
752
749
// Strip any leading '@'
@@ -828,7 +825,7 @@ impl UserCreationRequest<'_> {
828
825
}
829
826
830
827
/// Show the user creation request in a human-readable format
831
- fn show ( & self , term : & Term , homeserver : & SynapseConnection ) -> std:: io:: Result < ( ) > {
828
+ fn show ( & self , term : & Term , homeserver : & dyn HomeserverConnection ) -> std:: io:: Result < ( ) > {
832
829
let value_style = Style :: new ( ) . green ( ) ;
833
830
let key_style = Style :: new ( ) . bold ( ) ;
834
831
let warning_style = Style :: new ( ) . italic ( ) . red ( ) . bright ( ) ;
0 commit comments