remove modpack key

This commit is contained in:
2024-07-10 18:45:22 +02:00
parent 1e41fa8b10
commit 60b11d949d
4 changed files with 5 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
using ModpackUpdater.Model; using ModpackUpdater.Model;
using Unleash; using Unleash;
using Unleash.ClientFactory;
namespace ModpackUpdater; namespace ModpackUpdater;
@@ -38,7 +39,7 @@ public class ModpackFeatures(ModpackConfig modpackConfig)
InstanceTag = modpackConfig.UnleashInstanceId, InstanceTag = modpackConfig.UnleashInstanceId,
}; };
api = new DefaultUnleash(settings); api = new UnleashClientFactory().CreateClient(settings, synchronousInitialization: true);
} }
return api != null; return api != null;
@@ -63,11 +64,10 @@ public abstract class AppFeatureContext
public abstract void Apply(UnleashContext context); 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) public override void Apply(UnleashContext context)
{ {
context.UserId = info.ExtrasKey; context.UserId = info.ExtrasKey;
context.Environment = config.Key;
} }
} }

View File

@@ -6,7 +6,6 @@ public class ModpackConfig
{ {
public bool Maintenance { get; set; } public bool Maintenance { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Key { get; set; }
public string UpdateUrl { get; set; } public string UpdateUrl { get; set; }
public string InstallUrl { get; set; } public string InstallUrl { get; set; }
public string UnleashApiUrl { get; set; } public string UnleashApiUrl { get; set; }

View File

@@ -172,7 +172,7 @@ public partial class Form1
SetStatus(LangRes.StatusText_CheckingForUpdates, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.update_done, SvgImageSize.Small)); SetStatus(LangRes.StatusText_CheckingForUpdates, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.update_done, SvgImageSize.Small));
// Check for extras once again // 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 try
{ {

View File

@@ -87,7 +87,7 @@ public static class Program
if (!string.IsNullOrWhiteSpace(updateOptions.ExtrasKey)) if (!string.IsNullOrWhiteSpace(updateOptions.ExtrasKey))
info.ExtrasKey = updateOptions.ExtrasKey; info.ExtrasKey = updateOptions.ExtrasKey;
if (!string.IsNullOrWhiteSpace(info.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 // Check for update
var installer = new ModpackInstaller(config, info); var installer = new ModpackInstaller(config, info);