matrix-sdk: Remove the proxy usage from the exmaples for now
While it's generally useful to watch what the sdk is sending out during development using mitmproxy, users of the sdk might wonder why the example doesn't connect. Remove the proxy usage until we add a cli parser which can enable proxy support with a command line switch.master
parent
cf07fc8e8e
commit
9cd217fc5d
|
@ -69,10 +69,7 @@ async fn login_and_sync(
|
||||||
let mut home = dirs::home_dir().expect("no home directory found");
|
let mut home = dirs::home_dir().expect("no home directory found");
|
||||||
home.push("party_bot");
|
home.push("party_bot");
|
||||||
|
|
||||||
let client_config = ClientConfig::new()
|
let client_config = ClientConfig::new().store_path(home);
|
||||||
.proxy("http://localhost:8080")?
|
|
||||||
.disable_ssl_verification()
|
|
||||||
.store_path(home);
|
|
||||||
|
|
||||||
let homeserver_url = Url::parse(&homeserver_url).expect("Couldn't parse the homeserver URL");
|
let homeserver_url = Url::parse(&homeserver_url).expect("Couldn't parse the homeserver URL");
|
||||||
// create a new Client with the given homeserver url and config
|
// create a new Client with the given homeserver url and config
|
||||||
|
|
|
@ -9,8 +9,7 @@ use serde_json::json;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use matrix_sdk::{
|
use matrix_sdk::{
|
||||||
self, api::r0::uiaa::AuthData, identifiers::UserId, Client, ClientConfig, LoopCtrl,
|
self, api::r0::uiaa::AuthData, identifiers::UserId, Client, LoopCtrl, SyncSettings,
|
||||||
SyncSettings,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fn auth_data<'a>(user: &UserId, password: &str, session: Option<&'a str>) -> AuthData<'a> {
|
fn auth_data<'a>(user: &UserId, password: &str, session: Option<&'a str>) -> AuthData<'a> {
|
||||||
|
@ -64,12 +63,8 @@ async fn login(
|
||||||
username: &str,
|
username: &str,
|
||||||
password: &str,
|
password: &str,
|
||||||
) -> Result<(), matrix_sdk::Error> {
|
) -> Result<(), matrix_sdk::Error> {
|
||||||
let client_config = ClientConfig::new()
|
|
||||||
.disable_ssl_verification()
|
|
||||||
.proxy("http://localhost:8080")
|
|
||||||
.unwrap();
|
|
||||||
let homeserver_url = Url::parse(&homeserver_url).expect("Couldn't parse the homeserver URL");
|
let homeserver_url = Url::parse(&homeserver_url).expect("Couldn't parse the homeserver URL");
|
||||||
let client = Client::new_with_config(homeserver_url, client_config).unwrap();
|
let client = Client::new(homeserver_url).unwrap();
|
||||||
|
|
||||||
let response = client
|
let response = client
|
||||||
.login(username, password, None, Some("rust-sdk"))
|
.login(username, password, None, Some("rust-sdk"))
|
||||||
|
|
|
@ -14,7 +14,7 @@ use matrix_sdk::{
|
||||||
room::message::MessageEventContent, AnySyncMessageEvent, AnySyncRoomEvent, AnyToDeviceEvent,
|
room::message::MessageEventContent, AnySyncMessageEvent, AnySyncRoomEvent, AnyToDeviceEvent,
|
||||||
},
|
},
|
||||||
identifiers::UserId,
|
identifiers::UserId,
|
||||||
Client, ClientConfig, LoopCtrl, Sas, SyncSettings,
|
Client, LoopCtrl, Sas, SyncSettings,
|
||||||
};
|
};
|
||||||
|
|
||||||
async fn wait_for_confirmation(client: Client, sas: Sas) {
|
async fn wait_for_confirmation(client: Client, sas: Sas) {
|
||||||
|
@ -67,12 +67,8 @@ async fn login(
|
||||||
username: &str,
|
username: &str,
|
||||||
password: &str,
|
password: &str,
|
||||||
) -> Result<(), matrix_sdk::Error> {
|
) -> Result<(), matrix_sdk::Error> {
|
||||||
let client_config = ClientConfig::new()
|
|
||||||
.disable_ssl_verification()
|
|
||||||
.proxy("http://localhost:8080")
|
|
||||||
.unwrap();
|
|
||||||
let homeserver_url = Url::parse(&homeserver_url).expect("Couldn't parse the homeserver URL");
|
let homeserver_url = Url::parse(&homeserver_url).expect("Couldn't parse the homeserver URL");
|
||||||
let client = Client::new_with_config(homeserver_url, client_config).unwrap();
|
let client = Client::new(homeserver_url).unwrap();
|
||||||
|
|
||||||
client
|
client
|
||||||
.login(username, password, None, Some("rust-sdk"))
|
.login(username, password, None, Some("rust-sdk"))
|
||||||
|
|
|
@ -2,9 +2,7 @@ use std::{convert::TryFrom, env, process::exit};
|
||||||
|
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use matrix_sdk::{
|
use matrix_sdk::{self, api::r0::profile, identifiers::UserId, Client, Result as MatrixResult};
|
||||||
self, api::r0::profile, identifiers::UserId, Client, ClientConfig, Result as MatrixResult,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct UserProfile {
|
struct UserProfile {
|
||||||
|
@ -38,11 +36,8 @@ async fn login(
|
||||||
username: &str,
|
username: &str,
|
||||||
password: &str,
|
password: &str,
|
||||||
) -> Result<Client, matrix_sdk::Error> {
|
) -> Result<Client, matrix_sdk::Error> {
|
||||||
let client_config = ClientConfig::new()
|
|
||||||
.proxy("http://localhost:8080")?
|
|
||||||
.disable_ssl_verification();
|
|
||||||
let homeserver_url = Url::parse(&homeserver_url).expect("Couldn't parse the homeserver URL");
|
let homeserver_url = Url::parse(&homeserver_url).expect("Couldn't parse the homeserver URL");
|
||||||
let client = Client::new_with_config(homeserver_url, client_config).unwrap();
|
let client = Client::new(homeserver_url).unwrap();
|
||||||
|
|
||||||
client
|
client
|
||||||
.login(username, password, None, Some("rust-sdk"))
|
.login(username, password, None, Some("rust-sdk"))
|
||||||
|
|
|
@ -14,7 +14,7 @@ use matrix_sdk::{
|
||||||
room::message::{MessageEventContent, TextMessageEventContent},
|
room::message::{MessageEventContent, TextMessageEventContent},
|
||||||
SyncMessageEvent,
|
SyncMessageEvent,
|
||||||
},
|
},
|
||||||
Client, ClientConfig, EventEmitter, RoomState, SyncSettings,
|
Client, EventEmitter, RoomState, SyncSettings,
|
||||||
};
|
};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
@ -77,12 +77,8 @@ async fn login_and_sync(
|
||||||
password: String,
|
password: String,
|
||||||
image: File,
|
image: File,
|
||||||
) -> Result<(), matrix_sdk::Error> {
|
) -> Result<(), matrix_sdk::Error> {
|
||||||
let client_config = ClientConfig::new()
|
|
||||||
.proxy("http://localhost:8080")?
|
|
||||||
.disable_ssl_verification();
|
|
||||||
|
|
||||||
let homeserver_url = Url::parse(&homeserver_url).expect("Couldn't parse the homeserver URL");
|
let homeserver_url = Url::parse(&homeserver_url).expect("Couldn't parse the homeserver URL");
|
||||||
let client = Client::new_with_config(homeserver_url, client_config).unwrap();
|
let client = Client::new(homeserver_url).unwrap();
|
||||||
|
|
||||||
client
|
client
|
||||||
.login(&username, &password, None, Some("command bot"))
|
.login(&username, &password, None, Some("command bot"))
|
||||||
|
|
|
@ -7,7 +7,7 @@ use matrix_sdk::{
|
||||||
room::message::{MessageEventContent, TextMessageEventContent},
|
room::message::{MessageEventContent, TextMessageEventContent},
|
||||||
SyncMessageEvent,
|
SyncMessageEvent,
|
||||||
},
|
},
|
||||||
Client, ClientConfig, EventEmitter, RoomState, SyncSettings,
|
Client, EventEmitter, RoomState, SyncSettings,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EventCallback;
|
struct EventCallback;
|
||||||
|
@ -41,11 +41,8 @@ async fn login(
|
||||||
username: &str,
|
username: &str,
|
||||||
password: &str,
|
password: &str,
|
||||||
) -> Result<(), matrix_sdk::Error> {
|
) -> Result<(), matrix_sdk::Error> {
|
||||||
let client_config = ClientConfig::new()
|
|
||||||
.proxy("http://localhost:8080")?
|
|
||||||
.disable_ssl_verification();
|
|
||||||
let homeserver_url = Url::parse(&homeserver_url).expect("Couldn't parse the homeserver URL");
|
let homeserver_url = Url::parse(&homeserver_url).expect("Couldn't parse the homeserver URL");
|
||||||
let client = Client::new_with_config(homeserver_url, client_config).unwrap();
|
let client = Client::new(homeserver_url).unwrap();
|
||||||
|
|
||||||
client.add_event_emitter(Box::new(EventCallback)).await;
|
client.add_event_emitter(Box::new(EventCallback)).await;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue