Fixed token refresh happening to often at startup, replace missing game icon image with question mark, add support for more wwconfig.exe naming funkiness...

This commit is contained in:
2022-02-04 18:36:20 -06:00
parent 7da254fd61
commit e3cb9805fe
7 changed files with 20 additions and 28 deletions

View File

@@ -63,7 +63,8 @@ class W3DHub
if Store.settings[:account, :data]
account = Api::Account.new(Store.settings[:account, :data], {})
if (Time.now.to_i - account.access_token_expiry.to_i) >= 60 * 3 # Older than 3 hours then refresh
if (account.access_token_expiry - Time.now) / 60 <= 60 * 3 # Refresh if token expires within 3 hours
puts "Refreshing user login..."
@account = Api.refresh_user_login(account.refresh_token)
else
@account = account