Skip to content

Commit

Permalink
Alleviate browser blocking oauth socket from creating (#589)
Browse files Browse the repository at this point in the history
* Alleviate browser blocking oauth socket from creating

* Remove unneded return
  • Loading branch information
gitRaiku authored Feb 22, 2025
1 parent 2e2a13f commit dd47c30
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions psst-gui/src/ui/preferences.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,6 @@ impl<W: Widget<AppState>> Controller<AppState, W> for Authenticate {
data.preferences.auth.result.defer_default();

let (auth_url, pkce_verifier) = oauth::generate_auth_url(8888);
if open::that(&auth_url).is_err() {
data.error_alert("Failed to open browser");
return;
}

let config = data.preferences.auth.session_config();
let widget_id = ctx.widget_id();
let event_sink = ctx.get_external_handle();
Expand Down Expand Up @@ -388,6 +383,10 @@ impl<W: Widget<AppState>> Controller<AppState, W> for Authenticate {
});
self.thread.replace(thread);
ctx.set_handled();

if open::that(&auth_url).is_err() {
data.error_alert("Failed to open browser");
}
}
Event::Command(cmd) if cmd.is(Self::RESPONSE) => {
self.thread.take();
Expand Down

0 comments on commit dd47c30

Please sign in to comment.