Compare commits
4 Commits
32c4065940
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
f089629c74
|
|||
|
836282c6ac
|
|||
|
ee6b8d443d
|
|||
|
5947f81307
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,3 +1,3 @@
|
||||
[submodule "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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<ImplicitUsings>true</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@@ -17,7 +17,7 @@ public partial class MainView : Window
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Title = $"{Title} (v{Assembly.GetExecutingAssembly().GetAppVersion().ToShortString()})";
|
||||
Title = $"{Title} (v{Assembly.GetExecutingAssembly().GetAppVersion().ToShortHumanString()})";
|
||||
|
||||
ButtonSearchProfileFolder.ImageSource = AppGlobals.Symbols.GetImageSource(AppSymbols.opened_folder);
|
||||
ButtonCheckForUpdates.ImageSource = AppGlobals.Symbols.GetImageSource(AppSymbols.update_done);
|
||||
|
||||
@@ -24,7 +24,6 @@ public partial class MainViewModel : ObservableObject
|
||||
private readonly UpdateCheckOptions updateOptions = new();
|
||||
private ModpackInfo modpackInfo = new();
|
||||
private ModpackConfig updateConfig = new();
|
||||
private ModpackFeatures? features;
|
||||
private UpdateCheckResult? lastUpdateCheckResult;
|
||||
|
||||
[ObservableProperty] private string? minecraftProfileFolder;
|
||||
@@ -99,7 +98,7 @@ public partial class MainViewModel : ObservableObject
|
||||
|
||||
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()
|
||||
@@ -191,15 +190,14 @@ public partial class MainViewModel : ObservableObject
|
||||
// Ignore
|
||||
}
|
||||
|
||||
features = new(updateConfig);
|
||||
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));
|
||||
return false;
|
||||
}
|
||||
|
||||
CanUseExtrasKey = CanUseExtrasKey = !string.IsNullOrWhiteSpace(updateConfig.UnleashApiUrl);
|
||||
CanUseExtrasKey = updateConfig.ExtrasKeys.Count > 0;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(MinecraftProfileFolder) /*|| modpackInfo.Valid*/)
|
||||
{
|
||||
|
||||
@@ -67,27 +67,27 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<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="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageReference Include="Pilz" Version="2.6.2" />
|
||||
<PackageReference Include="Pilz.Configuration" Version="3.2.7" />
|
||||
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" />
|
||||
<PackageReference Include="Pilz.IO" Version="2.1.0" />
|
||||
<PackageReference Include="Pilz.UI" Version="3.1.4" />
|
||||
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.20" />
|
||||
<PackageReference Include="Avalonia" Version="11.3.9" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.3.9" />
|
||||
<PackageReference Include="Pilz" Version="2.7.8" />
|
||||
<PackageReference Include="Pilz.Configuration" Version="3.2.8" />
|
||||
<PackageReference Include="Pilz.Cryptography" Version="2.1.3" />
|
||||
<PackageReference Include="Pilz.IO" Version="2.1.1" />
|
||||
<PackageReference Include="Pilz.UI" Version="3.1.5" />
|
||||
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.21" />
|
||||
<PackageReference Include="Avalonia" Version="11.3.10" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.3.10" />
|
||||
<PackageReference Include="Avalonia.Svg" Version="11.3.0" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.9" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.9" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.10" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.10" />
|
||||
<!--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>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Pilz.Updating" Version="4.3.5" />
|
||||
<PackageReference Include="Pilz.Updating.Client" Version="4.4.6" />
|
||||
<PackageReference Include="Pilz.Updating" Version="4.3.6" />
|
||||
<PackageReference Include="Pilz.Updating.Client" Version="4.4.8" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageReference Include="Pilz" Version="2.6.2" />
|
||||
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" />
|
||||
<PackageReference Include="Pilz.IO" Version="2.1.0" />
|
||||
<PackageReference Include="Pilz" Version="2.7.8" />
|
||||
<PackageReference Include="Pilz.Cryptography" Version="2.1.3" />
|
||||
<PackageReference Include="Pilz.IO" Version="2.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -31,7 +31,7 @@ public static class Program
|
||||
private static void DrawInfo()
|
||||
{
|
||||
Console.WriteLine("Minecraft Modpack Updater CLI");
|
||||
Console.WriteLine("Version " + Assembly.GetExecutingAssembly().GetAppVersion().ToShortString());
|
||||
Console.WriteLine("Version " + Assembly.GetExecutingAssembly().GetAppVersion().ToShortHumanString());
|
||||
Console.WriteLine("------------------------------");
|
||||
}
|
||||
|
||||
@@ -39,13 +39,12 @@ public static class Program
|
||||
{
|
||||
var info = ModpackInfo.TryLoad(updateOptions.ProfileFolder);
|
||||
var config = ModpackConfig.LoadFromUrl(CheckModpackConfigUrl(updateOptions.ModpackConfig!, info));
|
||||
var features = new ModpackFeatures(config);
|
||||
|
||||
// Check features
|
||||
if (!string.IsNullOrWhiteSpace(updateOptions.ExtrasKey))
|
||||
info.ExtrasKey = updateOptions.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
|
||||
var installer = new ModpackInstaller(config, info)
|
||||
|
||||
@@ -49,25 +49,25 @@
|
||||
</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="MessageBox.Avalonia" Version="3.3.0" />
|
||||
<PackageReference Include="EPPlus" Version="8.3.1" />
|
||||
<PackageReference Include="MessageBox.Avalonia" Version="3.3.1" />
|
||||
<PackageReference Include="EPPlus" Version="8.4.0" />
|
||||
<PackageReference Include="NGitLab" Version="11.1.0" />
|
||||
<PackageReference Include="Pilz" Version="2.6.2" />
|
||||
<PackageReference Include="Pilz.Configuration" Version="3.2.7" />
|
||||
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" />
|
||||
<PackageReference Include="Pilz.Features" Version="2.13.0" />
|
||||
<PackageReference Include="Pilz.UI" Version="3.1.4" />
|
||||
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.20" />
|
||||
<PackageReference Include="Pilz.UI.AvaloniaUI.Features" Version="1.0.1" />
|
||||
<PackageReference Include="Avalonia" Version="11.3.9" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.3.9" />
|
||||
<PackageReference Include="Pilz" Version="2.7.8" />
|
||||
<PackageReference Include="Pilz.Configuration" Version="3.2.8" />
|
||||
<PackageReference Include="Pilz.Cryptography" Version="2.1.3" />
|
||||
<PackageReference Include="Pilz.Features" Version="2.13.1" />
|
||||
<PackageReference Include="Pilz.UI" Version="3.1.5" />
|
||||
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.21" />
|
||||
<PackageReference Include="Pilz.UI.AvaloniaUI.Features" Version="1.0.2" />
|
||||
<PackageReference Include="Avalonia" Version="11.3.10" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.3.10" />
|
||||
<PackageReference Include="Avalonia.Svg" Version="11.3.0" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.9" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.9" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.10" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.10" />
|
||||
<!--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>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -30,7 +30,7 @@ public partial class MainWindow : Window, IMainApi
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Title = $"{Title} (v{Assembly.GetExecutingAssembly().GetAppVersion().ToShortString()})";
|
||||
Title = $"{Title} (v{Assembly.GetExecutingAssembly().GetAppVersion().ToShortHumanString()})";
|
||||
|
||||
GridMain.DataContext = Model;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace ModpackUpdater.Apps;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -19,22 +19,22 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pilz" Version="2.6.2" />
|
||||
<PackageReference Include="Pilz.UI" Version="3.1.4" />
|
||||
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.20" />
|
||||
<PackageReference Include="MessageBox.Avalonia" Version="3.3.0" />
|
||||
<PackageReference Include="Avalonia" Version="11.3.9" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.3.9" />
|
||||
<PackageReference Include="Pilz" Version="2.7.8" />
|
||||
<PackageReference Include="Pilz.UI" Version="3.1.5" />
|
||||
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.2.21" />
|
||||
<PackageReference Include="MessageBox.Avalonia" Version="3.3.1" />
|
||||
<PackageReference Include="Avalonia" Version="11.3.10" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.3.10" />
|
||||
<PackageReference Include="Avalonia.Svg" Version="11.3.0" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.9" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.9" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.10" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.10" />
|
||||
<!--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>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Pilz.Updating" Version="4.3.5" />
|
||||
<PackageReference Include="Pilz.Updating.Client" Version="4.4.6" />
|
||||
<PackageReference Include="Pilz.Updating" Version="4.3.6" />
|
||||
<PackageReference Include="Pilz.Updating.Client" Version="4.4.8" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -169,9 +169,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
|
||||
foreach (InstallAction iaction in checkResult.Actions)
|
||||
{
|
||||
var destFilePath = iaction.GetDestPath(modpackInfo.LocalPath);
|
||||
var sourceUrl = updateConfig.PreferDirectLinks && !string.IsNullOrWhiteSpace(iaction.SourceUrl)
|
||||
? iaction.GetSourceUrl(checkResult.LatestVersion, overwriteVersion: OverwriteVersion)
|
||||
: await factory.ResolveSourceUrl(iaction, targetVersion: checkResult.LatestVersion, overwriteVersion: OverwriteVersion);
|
||||
var sourceUrl = iaction.GetSourceUrl(checkResult.LatestVersion, overwriteVersion: OverwriteVersion);
|
||||
|
||||
if (iaction is UpdateAction uaction)
|
||||
{
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Castle.Core" Version="5.2.1" />
|
||||
<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="Octokit" Version="14.0.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>
|
||||
|
||||
@@ -9,9 +9,7 @@ public class ModpackConfig
|
||||
public string? Name { get; set; }
|
||||
public string? UpdateUrl { get; set; }
|
||||
public string? InstallUrl { get; set; }
|
||||
public string? UnleashApiUrl { get; set; }
|
||||
public string? UnleashInstanceId { get; set; }
|
||||
public bool PreferDirectLinks { get; set; }
|
||||
public List<string> ExtrasKeys { get; } = [];
|
||||
public string? MinecraftVersion { get; set; }
|
||||
public string? RefTag { get; set; }
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" />
|
||||
<PackageReference Include="Pilz.Extensions" Version="2.1.1" />
|
||||
<PackageReference Include="Pilz.Cryptography" Version="2.1.3" />
|
||||
<PackageReference Include="Pilz.Extensions" Version="2.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="Pilz" value="https://git.pilzinsel64.de/api/v4/projects/6/packages/nuget/index.json" />
|
||||
<add key="Pilz.Updating" value="https://git.pilzinsel64.de/api/v4/projects/8/packages/nuget/index.json" />
|
||||
<add key="Pilz" value="https://git.pilzinsel64.de/api/packages/Pilz.NET/nuget/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
@@ -1,3 +1,3 @@
|
||||
using Pilz;
|
||||
|
||||
[assembly: AssemblyAppVersion(AssemblyAppVersionAttribute.EntryAssemblyVersionKey)]
|
||||
[assembly: AssemblyAppVersion]
|
||||
Reference in New Issue
Block a user