mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 01:02:34 +00:00
Refresh token at start up now works, added a bit of a hack to populate account info by opening the login page first and having it populate the data then load the games page, added Cache, and Settings
This commit is contained in:
32
lib/cache.rb
Normal file
32
lib/cache.rb
Normal file
@@ -0,0 +1,32 @@
|
||||
class W3DHub
|
||||
class Cache
|
||||
def self.path(uri)
|
||||
ext = File.basename(uri).split(".").last
|
||||
|
||||
"#{CACHE_PATH}/#{Digest::SHA2.hexdigest(uri)}.#{ext}"
|
||||
end
|
||||
|
||||
def self.fetch(uri)
|
||||
path = path(uri)
|
||||
|
||||
if File.exist?(path)
|
||||
path
|
||||
else
|
||||
response = Excon.get(uri)
|
||||
|
||||
if response.status == 200
|
||||
File.open(path, "wb") do |f|
|
||||
f.write(response.body)
|
||||
end
|
||||
|
||||
path
|
||||
end
|
||||
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def self.fetch_package(*args)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user