Skip to content

Commit

Permalink
Fix Epic login issue, closes #213
Browse files Browse the repository at this point in the history
  • Loading branch information
aknarts committed Sep 1, 2022
1 parent 36bba7a commit b34228e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions data/resources/ui/sid_login/sid.ui
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<child>
<object class="GtkButton" id="sid_browser_button">
<property name="action-name">sid.browser</property>
<property name="tooltip-text">https://www.epicgames.com/id/login?redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fredirect</property>
<property name="tooltip-text">https://www.epicgames.com/id/login?redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fredirect%3FclientId%3D34a02cf8f4414e29b15921876da36f9a%26responseType%3Dcode</property>
<property name="receives-default">1</property>
<child>
<object class="GtkBox">
Expand Down Expand Up @@ -68,7 +68,7 @@
<object class="GtkEntry" id="sid_entry">
<property name="width-chars">32</property>
<property name="max-length">32</property>
<property name="placeholder-text">Please enter sid from the response after login</property>
<property name="placeholder-text">Please enter 'authorizationCode' from the response after login</property>
</object>
</child>
<child>
Expand Down
6 changes: 3 additions & 3 deletions src/ui/widgets/sid_login/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ impl SidBox {

action!(actions, "browser", move |_, _| {
#[cfg(target_os = "linux")]
if gio::AppInfo::launch_default_for_uri("https://www.epicgames.com/id/login?redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fredirect", None::<&gio::AppLaunchContext>).is_err() {
error!("Please go to https://www.epicgames.com/id/login?redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fredirect");
if gio::AppInfo::launch_default_for_uri("https://www.epicgames.com/id/login?redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fredirect%3FclientId%3D34a02cf8f4414e29b15921876da36f9a%26responseType%3Dcode", None::<&gio::AppLaunchContext>).is_err() {
error!("Please go to https://www.epicgames.com/id/login?redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fredirect%3FclientId%3D34a02cf8f4414e29b15921876da36f9a%26responseType%3Dcode");
}
#[cfg(target_os = "windows")]
open::that("https://www.epicgames.com/id/login?redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fredirect");
open::that("https://www.epicgames.com/id/login?redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fredirect%3FclientId%3D34a02cf8f4414e29b15921876da36f9a%26responseType%3Dcode");
});

action!(
Expand Down
8 changes: 4 additions & 4 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,21 +419,21 @@ impl EpicAssetManagerWindow {
self.show_logged_in();
let db = crate::models::database::connection();
if let Some(id) = &ud.display_name {
if let Ok(conn) = db.get() {
if let Ok(mut conn) = db.get() {
diesel::replace_into(crate::schema::user_data::table)
.values((
crate::schema::user_data::name.eq("display_name"),
crate::schema::user_data::value.eq(id),
))
.execute(&conn)
.execute(&mut conn)
.expect("Unable to insert display name to the DB");
};
self_.appmenu_button.set_label(id);
} else if let Ok(conn) = db.get() {
} else if let Ok(mut conn) = db.get() {
let data: Result<String, diesel::result::Error> = crate::schema::user_data::table
.filter(crate::schema::user_data::name.eq("display_name"))
.select(crate::schema::user_data::value)
.first(&conn);
.first(&mut conn);
if let Ok(name) = data {
self_.appmenu_button.set_label(&name);
}
Expand Down

0 comments on commit b34228e

Please sign in to comment.