Commit b59da8e87c
Unsigned
Layout: unified · split
README.md +6
| @@ -157,6 +157,12 @@ _(replace the placeholders in brackets [] with your own details)_: | |||
| 157 | If the homeserver advertises single sign-on, leave the password empty to use | 157 | If the homeserver advertises single sign-on, leave the password empty to use |
| 158 | it. WeeChat will print a login URL when you connect. | 158 | it. WeeChat will print a login URL when you connect. |
| 159 | 159 | ||
| 160 | The SSO callback listens on `127.0.0.1:29325` on the WeeChat host. When | ||
| 161 | WeeChat runs on another machine, create an SSH tunnel before connecting so | ||
| 162 | the browser's localhost callback reaches it: | ||
| 163 | |||
| 164 | ssh -L 29325:127.0.0.1:29325 user@weechat-host | ||
| 165 | |||
| 160 | 3. Now try to connect. The first connection can take a few minutes while the | 166 | 3. Now try to connect. The first connection can take a few minutes while the |
| 161 | client syncs the account: | 167 | client syncs the account: |
| 162 | 168 | ||
src/connection.rs +8 −1
| @@ -42,6 +42,7 @@ use matrix_sdk::{ | |||
| 42 | OwnedDeviceId, OwnedEventId, OwnedRoomId, OwnedTransactionId, | 42 | OwnedDeviceId, OwnedEventId, OwnedRoomId, OwnedTransactionId, |
| 43 | }, | 43 | }, |
| 44 | sync::State, | 44 | sync::State, |
| 45 | utils::local_server::LocalServerBuilder, | ||
| 45 | Client, LoopCtrl, Result as MatrixResult, RoomMemberships, | 46 | Client, LoopCtrl, Result as MatrixResult, RoomMemberships, |
| 46 | }; | 47 | }; |
| 47 | 48 | ||
| @@ -53,6 +54,7 @@ use crate::{ | |||
| 53 | }; | 54 | }; |
| 54 | 55 | ||
| 55 | const DEFAULT_SYNC_TIMEOUT: Duration = Duration::from_secs(30); | 56 | const DEFAULT_SYNC_TIMEOUT: Duration = Duration::from_secs(30); |
| 57 | const SSO_CALLBACK_PORT: u16 = 29_325; | ||
| 56 | 58 | ||
| 57 | pub struct InteractiveAuthInfo { | 59 | pub struct InteractiveAuthInfo { |
| 58 | pub user: String, | 60 | pub user: String, |
| @@ -435,7 +437,12 @@ impl Connection { | |||
| 435 | Ok(()) | 437 | Ok(()) |
| 436 | } | 438 | } |
| 437 | }) | 439 | }) |
| 438 | .initial_device_display_name("WeeChat-Matrix-rs"); | 440 | .initial_device_display_name("WeeChat-Matrix-rs") |
| 441 | .server_builder( | ||
| 442 | LocalServerBuilder::new().port_range( | ||
| 443 | SSO_CALLBACK_PORT..SSO_CALLBACK_PORT + 1, | ||
| 444 | ), | ||
| 445 | ); | ||
| 439 | 446 | ||
| 440 | if let Some(device_id) = device_id.as_ref() { | 447 | if let Some(device_id) = device_id.as_ref() { |
| 441 | builder = builder.device_id(device_id); | 448 | builder = builder.device_id(device_id); |