Refactored API to support both backends and to re-enable logging in (on the primary backend)

This commit is contained in:
2025-06-24 10:38:41 -05:00
parent 685a1aa82c
commit 49d501a8b0
9 changed files with 183 additions and 72 deletions

View File

@@ -111,7 +111,7 @@ class W3DHub
return unless news
news.items[0..15].each do |item|
Cache.fetch(uri: item.image, async: false)
Cache.fetch(uri: item.image, async: false, backend: :w3dhub)
end
@w3dhub_news = news

View File

@@ -425,7 +425,7 @@ class W3DHub
return false unless news
news.items[0..15].each do |item|
Cache.fetch(uri: item.image, async: false)
Cache.fetch(uri: item.image, async: false, backend: :w3dhub)
end
@game_news[game.id] = news

View File

@@ -44,8 +44,10 @@ class W3DHub
Store.settings[:account][:data] = account
Store.settings.save_settings
Cache.fetch(uri: account.avatar_uri, force_fetch: true, async: false) if account
applications = Api.applications if account
if account
Cache.fetch(uri: account.avatar_uri, force_fetch: true, async: false, backend: :w3dhub)
applications = Api._applications
end
end
[account, applications]
@@ -79,7 +81,7 @@ class W3DHub
if Store.account
BackgroundWorker.foreground_job(
-> { Cache.fetch(uri: Store.account.avatar_uri, async: false) },
-> { Cache.fetch(uri: Store.account.avatar_uri, async: false, backend: :w3dhub) },
->(result) {
populate_account_info
page(W3DHub::Pages::Games)
@@ -152,7 +154,7 @@ class W3DHub
Store.account = nil
BackgroundWorker.foreground_job(
-> { Api.applications },
-> { Api._applications },
lambda do |applications|
if applications
Store.applications = applications