4 Commits

Author SHA1 Message Date
f089629c74 something 2025-12-19 15:19:09 +01:00
836282c6ac update nuget packages & fixes 2025-12-19 14:54:28 +01:00
ee6b8d443d update update-url 2025-12-19 14:09:01 +01:00
5947f81307 new extras system 2025-12-19 14:07:59 +01:00
18 changed files with 61 additions and 150 deletions

2
.gitmodules vendored
View File

@@ -1,3 +1,3 @@
[submodule "publish-scripts"] [submodule "publish-scripts"]
path = publish-scripts path = publish-scripts
url = https://git.pilzinsel64.de/pilz-framework/publish-scripts.git url = https://git.pilzinsel64.de/Pilz.NET/publish-scripts.git

View File

@@ -1,7 +1,7 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<ImplicitUsings>true</ImplicitUsings> <ImplicitUsings>true</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>

View File

@@ -17,7 +17,7 @@ public partial class MainView : Window
{ {
InitializeComponent(); InitializeComponent();
Title = $"{Title} (v{Assembly.GetExecutingAssembly().GetAppVersion().ToShortString()})"; Title = $"{Title} (v{Assembly.GetExecutingAssembly().GetAppVersion().ToShortHumanString()})";
ButtonSearchProfileFolder.ImageSource = AppGlobals.Symbols.GetImageSource(AppSymbols.opened_folder); ButtonSearchProfileFolder.ImageSource = AppGlobals.Symbols.GetImageSource(AppSymbols.opened_folder);
ButtonCheckForUpdates.ImageSource = AppGlobals.Symbols.GetImageSource(AppSymbols.update_done); ButtonCheckForUpdates.ImageSource = AppGlobals.Symbols.GetImageSource(AppSymbols.update_done);

View File

@@ -24,7 +24,6 @@ public partial class MainViewModel : ObservableObject
private readonly UpdateCheckOptions updateOptions = new(); private readonly UpdateCheckOptions updateOptions = new();
private ModpackInfo modpackInfo = new(); private ModpackInfo modpackInfo = new();
private ModpackConfig updateConfig = new(); private ModpackConfig updateConfig = new();
private ModpackFeatures? features;
private UpdateCheckResult? lastUpdateCheckResult; private UpdateCheckResult? lastUpdateCheckResult;
[ObservableProperty] private string? minecraftProfileFolder; [ObservableProperty] private string? minecraftProfileFolder;
@@ -99,7 +98,7 @@ public partial class MainViewModel : ObservableObject
private bool AllowExtras() private bool AllowExtras()
{ {
return features != null && features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo)); return !string.IsNullOrWhiteSpace(modpackInfo.ExtrasKey) && updateConfig.ExtrasKeys.Contains(modpackInfo.ExtrasKey);
} }
public void LoadProfileToUi() public void LoadProfileToUi()
@@ -191,15 +190,14 @@ public partial class MainViewModel : ObservableObject
// Ignore // Ignore
} }
features = new(updateConfig);
modpackInfo.ExtrasKey = InstallKey?.Trim(); modpackInfo.ExtrasKey = InstallKey?.Trim();
if (!features.IsInvalid() && !string.IsNullOrWhiteSpace(modpackInfo.ExtrasKey) && !AllowExtras()) if (!string.IsNullOrWhiteSpace(modpackInfo.ExtrasKey) && !AllowExtras())
{ {
SetStatus(GeneralLangRes.InstallationKeyNotValid, AppGlobals.Symbols.GetImageSource(AppSymbols.general_warning_sign)); SetStatus(GeneralLangRes.InstallationKeyNotValid, AppGlobals.Symbols.GetImageSource(AppSymbols.general_warning_sign));
return false; return false;
} }
CanUseExtrasKey = CanUseExtrasKey = !string.IsNullOrWhiteSpace(updateConfig.UnleashApiUrl); CanUseExtrasKey = updateConfig.ExtrasKeys.Count > 0;
if (string.IsNullOrWhiteSpace(MinecraftProfileFolder) /*|| modpackInfo.Valid*/) if (string.IsNullOrWhiteSpace(MinecraftProfileFolder) /*|| modpackInfo.Valid*/)
{ {

View File

@@ -67,27 +67,27 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="MessageBox.Avalonia" Version="3.3.0" /> <PackageReference Include="MessageBox.Avalonia" Version="3.3.1" />
<PackageReference Include="Mono.Options" Version="6.12.0.148" /> <PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="Pilz" Version="2.6.2" /> <PackageReference Include="Pilz" Version="2.7.8" />
<PackageReference Include="Pilz.Configuration" Version="3.2.7" /> <PackageReference Include="Pilz.Configuration" Version="3.2.8" />
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" /> <PackageReference Include="Pilz.Cryptography" Version="2.1.3" />
<PackageReference Include="Pilz.IO" Version="2.1.0" /> <PackageReference Include="Pilz.IO" Version="2.1.1" />
<PackageReference Include="Pilz.UI" Version="3.1.4" /> <PackageReference Include="Pilz.UI" Version="3.1.5" />
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.20" /> <PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.21" />
<PackageReference Include="Avalonia" Version="11.3.9" /> <PackageReference Include="Avalonia" Version="11.3.10" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.9" /> <PackageReference Include="Avalonia.Desktop" Version="11.3.10" />
<PackageReference Include="Avalonia.Svg" Version="11.3.0" /> <PackageReference Include="Avalonia.Svg" Version="11.3.0" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.9" /> <PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.10" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.9" /> <PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.10" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--> <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.9"> <PackageReference Include="Avalonia.Diagnostics" Version="11.3.10">
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets> <IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets> <PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Pilz.Updating" Version="4.3.5" /> <PackageReference Include="Pilz.Updating" Version="4.3.6" />
<PackageReference Include="Pilz.Updating.Client" Version="4.4.6" /> <PackageReference Include="Pilz.Updating.Client" Version="4.4.8" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -23,9 +23,9 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Mono.Options" Version="6.12.0.148" /> <PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="Pilz" Version="2.6.2" /> <PackageReference Include="Pilz" Version="2.7.8" />
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" /> <PackageReference Include="Pilz.Cryptography" Version="2.1.3" />
<PackageReference Include="Pilz.IO" Version="2.1.0" /> <PackageReference Include="Pilz.IO" Version="2.1.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -31,7 +31,7 @@ public static class Program
private static void DrawInfo() private static void DrawInfo()
{ {
Console.WriteLine("Minecraft Modpack Updater CLI"); Console.WriteLine("Minecraft Modpack Updater CLI");
Console.WriteLine("Version " + Assembly.GetExecutingAssembly().GetAppVersion().ToShortString()); Console.WriteLine("Version " + Assembly.GetExecutingAssembly().GetAppVersion().ToShortHumanString());
Console.WriteLine("------------------------------"); Console.WriteLine("------------------------------");
} }
@@ -39,13 +39,12 @@ public static class Program
{ {
var info = ModpackInfo.TryLoad(updateOptions.ProfileFolder); var info = ModpackInfo.TryLoad(updateOptions.ProfileFolder);
var config = ModpackConfig.LoadFromUrl(CheckModpackConfigUrl(updateOptions.ModpackConfig!, info)); var config = ModpackConfig.LoadFromUrl(CheckModpackConfigUrl(updateOptions.ModpackConfig!, info));
var features = new ModpackFeatures(config);
// Check features // Check features
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)); updateOptions.IncludeExtras = !string.IsNullOrWhiteSpace(info.ExtrasKey) && config.ExtrasKeys.Contains(info.ExtrasKey);
// Check for update // Check for update
var installer = new ModpackInstaller(config, info) var installer = new ModpackInstaller(config, info)

View File

@@ -49,25 +49,25 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.3.9" /> <PackageReference Include="Avalonia.Controls.DataGrid" Version="11.3.10" />
<PackageReference Include="DynamicData" Version="9.4.1" /> <PackageReference Include="DynamicData" Version="9.4.1" />
<PackageReference Include="MessageBox.Avalonia" Version="3.3.0" /> <PackageReference Include="MessageBox.Avalonia" Version="3.3.1" />
<PackageReference Include="EPPlus" Version="8.3.1" /> <PackageReference Include="EPPlus" Version="8.4.0" />
<PackageReference Include="NGitLab" Version="11.1.0" /> <PackageReference Include="NGitLab" Version="11.1.0" />
<PackageReference Include="Pilz" Version="2.6.2" /> <PackageReference Include="Pilz" Version="2.7.8" />
<PackageReference Include="Pilz.Configuration" Version="3.2.7" /> <PackageReference Include="Pilz.Configuration" Version="3.2.8" />
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" /> <PackageReference Include="Pilz.Cryptography" Version="2.1.3" />
<PackageReference Include="Pilz.Features" Version="2.13.0" /> <PackageReference Include="Pilz.Features" Version="2.13.1" />
<PackageReference Include="Pilz.UI" Version="3.1.4" /> <PackageReference Include="Pilz.UI" Version="3.1.5" />
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.20" /> <PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.21" />
<PackageReference Include="Pilz.UI.AvaloniaUI.Features" Version="1.0.1" /> <PackageReference Include="Pilz.UI.AvaloniaUI.Features" Version="1.0.2" />
<PackageReference Include="Avalonia" Version="11.3.9" /> <PackageReference Include="Avalonia" Version="11.3.10" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.9" /> <PackageReference Include="Avalonia.Desktop" Version="11.3.10" />
<PackageReference Include="Avalonia.Svg" Version="11.3.0" /> <PackageReference Include="Avalonia.Svg" Version="11.3.0" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.9" /> <PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.10" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.9" /> <PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.10" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--> <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.9"> <PackageReference Include="Avalonia.Diagnostics" Version="11.3.10">
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets> <IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets> <PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference> </PackageReference>

View File

@@ -30,7 +30,7 @@ public partial class MainWindow : Window, IMainApi
{ {
InitializeComponent(); InitializeComponent();
Title = $"{Title} (v{Assembly.GetExecutingAssembly().GetAppVersion().ToShortString()})"; Title = $"{Title} (v{Assembly.GetExecutingAssembly().GetAppVersion().ToShortHumanString()})";
GridMain.DataContext = Model; GridMain.DataContext = Model;

View File

@@ -12,7 +12,7 @@ namespace ModpackUpdater.Apps;
public class AppUpdates(string appShortName, Window mainWindow) public class AppUpdates(string appShortName, Window mainWindow)
{ {
public const string UpdateUrl = "https://git.pilzinsel64.de/litw-refined/minecraft-modpack-updater/-/snippets/3/raw/main/updates-new.json"; public const string UpdateUrl = "https://git.pilzinsel64.de/LITW-Refined/minecraft-modpack-updater/raw/branch/updates/updates.json";
public event EventHandler? OnDownloadProgramUpdate; public event EventHandler? OnDownloadProgramUpdate;

View File

@@ -19,22 +19,22 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Pilz" Version="2.6.2" /> <PackageReference Include="Pilz" Version="2.7.8" />
<PackageReference Include="Pilz.UI" Version="3.1.4" /> <PackageReference Include="Pilz.UI" Version="3.1.5" />
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.20" /> <PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.21" />
<PackageReference Include="MessageBox.Avalonia" Version="3.3.0" /> <PackageReference Include="MessageBox.Avalonia" Version="3.3.1" />
<PackageReference Include="Avalonia" Version="11.3.9" /> <PackageReference Include="Avalonia" Version="11.3.10" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.9" /> <PackageReference Include="Avalonia.Desktop" Version="11.3.10" />
<PackageReference Include="Avalonia.Svg" Version="11.3.0" /> <PackageReference Include="Avalonia.Svg" Version="11.3.0" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.9" /> <PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.10" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.9" /> <PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.10" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--> <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.9"> <PackageReference Include="Avalonia.Diagnostics" Version="11.3.10">
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets> <IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets> <PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Pilz.Updating" Version="4.3.5" /> <PackageReference Include="Pilz.Updating" Version="4.3.6" />
<PackageReference Include="Pilz.Updating.Client" Version="4.4.6" /> <PackageReference Include="Pilz.Updating.Client" Version="4.4.8" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,81 +0,0 @@
using System.Diagnostics.CodeAnalysis;
using Unleash;
using Unleash.ClientFactory;
namespace ModpackUpdater.Manager;
public class ModpackFeatures(ModpackConfig modpackConfig)
{
private IUnleash? api;
private UnleashContext context;
private UnleashSettings settings;
public static string FeatureAllowExtas => "allow-extras";
~ModpackFeatures()
{
api?.Dispose();
}
public bool IsEnabled(string feature)
{
return IsEnabled(feature, null);
}
public bool IsEnabled(string feature, AppFeatureContext context)
{
return CheckFeature(feature, context);
}
public bool IsInvalid()
{
return string.IsNullOrWhiteSpace(modpackConfig.UnleashApiUrl) || string.IsNullOrWhiteSpace(modpackConfig.UnleashInstanceId);
}
[MemberNotNullWhen(true, nameof(api))]
private bool InitializeApi()
{
if (api != null
|| string.IsNullOrWhiteSpace(modpackConfig.UnleashApiUrl)
|| string.IsNullOrWhiteSpace(modpackConfig.UnleashInstanceId))
return api != null;
settings = new UnleashSettings
{
AppName = "Modpack Updater",
UnleashApi = new Uri(modpackConfig.UnleashApiUrl),
FetchTogglesInterval = TimeSpan.FromSeconds(0),
InstanceTag = modpackConfig.UnleashInstanceId,
};
api = new UnleashClientFactory().CreateClient(settings, synchronousInitialization: true);
return api != null;
}
private bool CheckFeature(string name, AppFeatureContext context)
{
return InitializeApi() && api.IsEnabled(name, GetContext(context));
}
private UnleashContext GetContext(AppFeatureContext ccontext)
{
context ??= new();
context.CurrentTime = DateTime.Now;
ccontext?.Apply(context);
return context;
}
}
public abstract class AppFeatureContext
{
public abstract void Apply(UnleashContext context);
}
public class AllowExtrasFeatureContext(ModpackInfo info) : AppFeatureContext
{
public override void Apply(UnleashContext context)
{
context.UserId = info.ExtrasKey;
}
}

View File

@@ -169,9 +169,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
foreach (InstallAction iaction in checkResult.Actions) foreach (InstallAction iaction in checkResult.Actions)
{ {
var destFilePath = iaction.GetDestPath(modpackInfo.LocalPath); var destFilePath = iaction.GetDestPath(modpackInfo.LocalPath);
var sourceUrl = updateConfig.PreferDirectLinks && !string.IsNullOrWhiteSpace(iaction.SourceUrl) var sourceUrl = iaction.GetSourceUrl(checkResult.LatestVersion, overwriteVersion: OverwriteVersion);
? iaction.GetSourceUrl(checkResult.LatestVersion, overwriteVersion: OverwriteVersion)
: await factory.ResolveSourceUrl(iaction, targetVersion: checkResult.LatestVersion, overwriteVersion: OverwriteVersion);
if (iaction is UpdateAction uaction) if (iaction is UpdateAction uaction)
{ {

View File

@@ -9,11 +9,11 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Castle.Core" Version="5.2.1" /> <PackageReference Include="Castle.Core" Version="5.2.1" />
<PackageReference Include="CurseForge.APIClient" Version="4.2.0" /> <PackageReference Include="CurseForge.APIClient" Version="4.2.0" />
<PackageReference Include="LaunchDarkly.EventSource" Version="5.2.1" /> <PackageReference Include="LaunchDarkly.EventSource" Version="5.3.0" />
<PackageReference Include="Modrinth.Net" Version="3.6.0" /> <PackageReference Include="Modrinth.Net" Version="3.6.0" />
<PackageReference Include="Octokit" Version="14.0.0" /> <PackageReference Include="Octokit" Version="14.0.0" />
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" /> <PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
<PackageReference Include="Unleash.Client" Version="5.5.3" /> <PackageReference Include="Unleash.Client" Version="5.6.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -9,9 +9,7 @@ public class ModpackConfig
public string? Name { get; set; } public string? Name { 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 List<string> ExtrasKeys { get; } = [];
public string? UnleashInstanceId { get; set; }
public bool PreferDirectLinks { get; set; }
public string? MinecraftVersion { get; set; } public string? MinecraftVersion { get; set; }
public string? RefTag { get; set; } public string? RefTag { get; set; }

View File

@@ -6,8 +6,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" /> <PackageReference Include="Pilz.Cryptography" Version="2.1.3" />
<PackageReference Include="Pilz.Extensions" Version="2.1.1" /> <PackageReference Include="Pilz.Extensions" Version="2.1.2" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<packageSources> <packageSources>
<add key="Pilz" value="https://git.pilzinsel64.de/api/v4/projects/6/packages/nuget/index.json" /> <add key="Pilz" value="https://git.pilzinsel64.de/api/packages/Pilz.NET/nuget/index.json" />
<add key="Pilz.Updating" value="https://git.pilzinsel64.de/api/v4/projects/8/packages/nuget/index.json" />
</packageSources> </packageSources>
</configuration> </configuration>

View File

@@ -1,3 +1,3 @@
using Pilz; using Pilz;
[assembly: AssemblyAppVersion(AssemblyAppVersionAttribute.EntryAssemblyVersionKey)] [assembly: AssemblyAppVersion]