mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 09:12:35 +00:00
Added option to force fetch to Cache.fetch, force user profile picture to be fetched on start up or on login
This commit is contained in:
@@ -7,18 +7,18 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Fetch a generic uri
|
# Fetch a generic uri
|
||||||
def self.fetch(internet, uri)
|
def self.fetch(internet, uri, force_fetch = false)
|
||||||
path = path(uri)
|
path = path(uri)
|
||||||
|
|
||||||
if File.exist?(path)
|
if !force_fetch && File.exist?(path)
|
||||||
path
|
path
|
||||||
else
|
else
|
||||||
response = internet.get(uri, [["user-agent", W3DHub::Api::USER_AGENT]])
|
response = internet.get(uri, W3DHub::Api::DEFAULT_HEADERS)
|
||||||
|
|
||||||
if response.success?
|
if response.success?
|
||||||
response.save(path, "wb")
|
response.save(path, "wb")
|
||||||
|
|
||||||
path
|
return path
|
||||||
end
|
end
|
||||||
|
|
||||||
false
|
false
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class W3DHub
|
|||||||
Store.settings[:account][:refresh_token] = account.refresh_token
|
Store.settings[:account][:refresh_token] = account.refresh_token
|
||||||
Store.settings.save_settings
|
Store.settings.save_settings
|
||||||
|
|
||||||
Cache.fetch(internet, account.avatar_uri)
|
Cache.fetch(internet, account.avatar_uri, true)
|
||||||
|
|
||||||
populate_account_info
|
populate_account_info
|
||||||
page(W3DHub::Pages::Games)
|
page(W3DHub::Pages::Games)
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ class W3DHub
|
|||||||
|
|
||||||
if @account
|
if @account
|
||||||
Store.settings[:account][:refresh_token] = @account.refresh_token
|
Store.settings[:account][:refresh_token] = @account.refresh_token
|
||||||
|
Cache.fetch(internet, @account.avatar_uri, true)
|
||||||
else
|
else
|
||||||
Store.settings[:account][:refresh_token] = nil
|
Store.settings[:account][:refresh_token] = nil
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user