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:
2021-11-14 18:54:09 -06:00
parent 4b69b60aab
commit b7ccdb2ad3
12 changed files with 207 additions and 35 deletions

32
lib/cache.rb Normal file
View 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