From 60b11d949d1964a10d00d1fd5ba5e10f736b22c3 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Wed, 10 Jul 2024 18:45:22 +0200 Subject: [PATCH] remove modpack key --- ModpackUpdater.Manager/ModpackFeatures.cs | 6 +++--- ModpackUpdater.Model/ModpackConfig.cs | 1 - ModpackUpdater/Form1.cs | 2 +- ModpackUpdater/Program.cs | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ModpackUpdater.Manager/ModpackFeatures.cs b/ModpackUpdater.Manager/ModpackFeatures.cs index 3e9e2df..b0d5a02 100644 --- a/ModpackUpdater.Manager/ModpackFeatures.cs +++ b/ModpackUpdater.Manager/ModpackFeatures.cs @@ -1,5 +1,6 @@ using ModpackUpdater.Model; using Unleash; +using Unleash.ClientFactory; namespace ModpackUpdater; @@ -38,7 +39,7 @@ public class ModpackFeatures(ModpackConfig modpackConfig) InstanceTag = modpackConfig.UnleashInstanceId, }; - api = new DefaultUnleash(settings); + api = new UnleashClientFactory().CreateClient(settings, synchronousInitialization: true); } return api != null; @@ -63,11 +64,10 @@ public abstract class AppFeatureContext public abstract void Apply(UnleashContext context); } -public class AllowExtrasFeatureContext(ModpackInfo info, ModpackConfig config) : AppFeatureContext +public class AllowExtrasFeatureContext(ModpackInfo info) : AppFeatureContext { public override void Apply(UnleashContext context) { context.UserId = info.ExtrasKey; - context.Environment = config.Key; } } \ No newline at end of file diff --git a/ModpackUpdater.Model/ModpackConfig.cs b/ModpackUpdater.Model/ModpackConfig.cs index 3d65607..d7f0ee2 100644 --- a/ModpackUpdater.Model/ModpackConfig.cs +++ b/ModpackUpdater.Model/ModpackConfig.cs @@ -6,7 +6,6 @@ public class ModpackConfig { public bool Maintenance { get; set; } public string Name { get; set; } - public string Key { get; set; } public string UpdateUrl { get; set; } public string InstallUrl { get; set; } public string UnleashApiUrl { get; set; } diff --git a/ModpackUpdater/Form1.cs b/ModpackUpdater/Form1.cs index 8d10c7c..2c724e8 100644 --- a/ModpackUpdater/Form1.cs +++ b/ModpackUpdater/Form1.cs @@ -172,7 +172,7 @@ public partial class Form1 SetStatus(LangRes.StatusText_CheckingForUpdates, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.update_done, SvgImageSize.Small)); // Check for extras once again - updateOptions.IncludeExtras = features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo, updateConfig)); + updateOptions.IncludeExtras = features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo)); try { diff --git a/ModpackUpdater/Program.cs b/ModpackUpdater/Program.cs index 5186d6d..ff07925 100644 --- a/ModpackUpdater/Program.cs +++ b/ModpackUpdater/Program.cs @@ -87,7 +87,7 @@ public static class Program if (!string.IsNullOrWhiteSpace(updateOptions.ExtrasKey)) info.ExtrasKey = updateOptions.ExtrasKey; if (!string.IsNullOrWhiteSpace(info.ExtrasKey)) - updateOptions.IncludeExtras = features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(info, config)); + updateOptions.IncludeExtras = features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(info)); // Check for update var installer = new ModpackInstaller(config, info);