From 5cb96f5fa49ccb8ee1ab894c8aeb760ba0a72c39 Mon Sep 17 00:00:00 2001 From: Citrinate Date: Mon, 27 May 2024 21:22:11 -0400 Subject: [PATCH] Account for marketability anomalies --- BoosterManager/Data/MarketableApps.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/BoosterManager/Data/MarketableApps.cs b/BoosterManager/Data/MarketableApps.cs index 505902b..ef1ad52 100644 --- a/BoosterManager/Data/MarketableApps.cs +++ b/BoosterManager/Data/MarketableApps.cs @@ -12,8 +12,12 @@ namespace BoosterManager { internal static class MarketableApps { internal static HashSet AppIDs = new(); + private static HashSet MarketableOverrides = new(); + private static HashSet UnmarketableOverrides = new(); private static Uri Source = new("https://raw.githubusercontent.com/Citrinate/Steam-MarketableApps/main/data/marketable_apps.min.json"); + private static Uri MarketableOverridesSource = new("https://raw.githubusercontent.com/Citrinate/Steam-MarketableApps/main/overrides/marketable_app_overrides.json"); + private static Uri UnmarketableOverridesSource = new("https://raw.githubusercontent.com/Citrinate/Steam-MarketableApps/main/overrides/unmarketable_app_overrides.json"); private static TimeSpan UpdateFrequency = TimeSpan.FromMinutes(30); private static TimeSpan SteamUpdateFrequency = TimeSpan.FromMinutes(5); @@ -38,13 +42,20 @@ internal static async Task Update() { // Can't account for these errors whithin this plugin (in a timely fashion), and so we use a cached version of ISteamApps/GetApplist which is known to be good ObjectResponse>? response = await ASF.WebBrowser.UrlGetToJsonObject>(Source).ConfigureAwait(false); - if (response == null || response.Content == null) { + ObjectResponse>? marketableOverrideResponse = await ASF.WebBrowser.UrlGetToJsonObject>(MarketableOverridesSource).ConfigureAwait(false); + ObjectResponse>? unmarketableOverrideResponse = await ASF.WebBrowser.UrlGetToJsonObject>(UnmarketableOverridesSource).ConfigureAwait(false); + if (response == null || response.Content == null + || marketableOverrideResponse == null || marketableOverrideResponse.Content == null + || unmarketableOverrideResponse == null || unmarketableOverrideResponse.Content == null + ) { ASF.ArchiLogger.LogGenericDebug("Failed to fetch marketable apps data"); return false; } AppIDs = response.Content; + MarketableOverrides = marketableOverrideResponse.Content; + UnmarketableOverrides = unmarketableOverrideResponse.Content; LastUpdate = DateTime.Now; // We're good to stop here, but let's try to replace the cached data that may be up to 1 hour old with fresh data from Steam @@ -108,7 +119,7 @@ private static async Task UpdateFromSteam() { return; } - AppIDs = newerAppIDs; + AppIDs = newerAppIDs.Union(MarketableOverrides).Except(UnmarketableOverrides).ToHashSet(); } } }