Fix notifications display
All checks were successful
Build / Compute Version (push) Successful in 7s
Build / Build Nuget package (NuGet) (push) Successful in 4m9s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 4m22s
Build / Build Nuget package (SharedCringe) (push) Successful in 4m18s
Build / Build Nuget package (CringePlugins) (push) Successful in 4m42s
Build / Build Launcher (push) Successful in 5m29s
All checks were successful
Build / Compute Version (push) Successful in 7s
Build / Build Nuget package (NuGet) (push) Successful in 4m9s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 4m22s
Build / Build Nuget package (SharedCringe) (push) Successful in 4m18s
Build / Build Nuget package (CringePlugins) (push) Successful in 4m42s
Build / Build Launcher (push) Successful in 5m29s
Rename default source Remove plugins that aren't found (404) Fix duplicate ids in plugins list
This commit is contained in:
@@ -7,7 +7,7 @@ namespace CringePlugins.Config;
|
|||||||
public record PackagesConfig(ImmutableArray<PackageSource> Sources, ImmutableArray<PackageReference> Packages, ImmutableArray<Profile> Profiles)
|
public record PackagesConfig(ImmutableArray<PackageSource> Sources, ImmutableArray<PackageReference> Packages, ImmutableArray<Profile> Profiles)
|
||||||
{
|
{
|
||||||
public static PackagesConfig Default { get; } = new([
|
public static PackagesConfig Default { get; } = new([
|
||||||
new("zznty", @"^SpaceEngineersDedicated\.ReferenceAssemblies$|^ImGui\.NET\.DirectX$|^NuGet$|^Cringe.+$|^SharedCringe$|^Plugin.+$", "https://ng.zznty.ru/v3/index.json"),
|
new("CringeLauncher Official", @"^SpaceEngineersDedicated\.ReferenceAssemblies$|^ImGui\.NET\.DirectX$|^NuGet$|^Cringe.+$|^SharedCringe$|^Plugin.+$", "https://ng.zznty.ru/v3/index.json"),
|
||||||
new("nuget.org", string.Empty, "https://api.nuget.org/v3/index.json")
|
new("nuget.org", string.Empty, "https://api.nuget.org/v3/index.json")
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@@ -85,8 +85,7 @@ internal sealed class PluginWrapper(PluginMetadata metadata, IPlugin plugin) : I
|
|||||||
|
|
||||||
private void RenderError()
|
private void RenderError()
|
||||||
{
|
{
|
||||||
ImGui.TextColored(new System.Numerics.Vector4(1f, 0f, 0f, 0f), "Error: ");
|
ImGui.TextColored(new System.Numerics.Vector4(1f, 0f, 0f, 1f), $"Fatal error in {metadata.Name}:");
|
||||||
ImGui.SameLine();
|
ImGui.TextWrapped(LastException?.Message);
|
||||||
ImGui.TextWrapped($"Fatal error in {metadata.Name}: {LastException?.Message}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -54,7 +54,22 @@ internal class PluginsLifetime(ConfigHandler configHandler, HttpClient client) :
|
|||||||
|
|
||||||
var cacheDir = _dir.CreateSubdirectory("cache");
|
var cacheDir = _dir.CreateSubdirectory("cache");
|
||||||
|
|
||||||
var packages = await resolver.ResolveAsync(cacheDir, launcherConfig.DisablePluginUpdates);
|
var invalidPackages = new List<PackageReference>();
|
||||||
|
var packages = await resolver.ResolveAsync(cacheDir, launcherConfig.DisablePluginUpdates, invalidPackages);
|
||||||
|
|
||||||
|
if (invalidPackages.Count > 0)
|
||||||
|
{
|
||||||
|
var builder = packagesConfig.Packages.ToBuilder();
|
||||||
|
|
||||||
|
foreach (var package in invalidPackages)
|
||||||
|
{
|
||||||
|
builder.Remove(package);
|
||||||
|
}
|
||||||
|
|
||||||
|
_configReference.Value = packagesConfig with { Packages = builder.ToImmutable() };
|
||||||
|
packagesConfig = _configReference.Value;
|
||||||
|
Log.Warn("Removed {Count} invalid packages from the config", invalidPackages.Count);
|
||||||
|
}
|
||||||
|
|
||||||
progress.Report("Downloading packages");
|
progress.Report("Downloading packages");
|
||||||
|
|
||||||
|
@@ -87,7 +87,7 @@ public static class BuiltInPackages
|
|||||||
steam.AsDependency(libraries)
|
steam.AsDependency(libraries)
|
||||||
]
|
]
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
, version: new(0, 1, 21)
|
, version: new(0, 1, 84)
|
||||||
#endif
|
#endif
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
@@ -11,7 +11,7 @@ namespace CringePlugins.Resolver;
|
|||||||
public class PackageResolver(NuGetFramework runtimeFramework, ImmutableArray<PackageReference> references, PackageSourceMapping packageSources)
|
public class PackageResolver(NuGetFramework runtimeFramework, ImmutableArray<PackageReference> references, PackageSourceMapping packageSources)
|
||||||
{
|
{
|
||||||
private static readonly ILogger Log = LogManager.GetCurrentClassLogger();
|
private static readonly ILogger Log = LogManager.GetCurrentClassLogger();
|
||||||
public async Task<ImmutableSortedSet<ResolvedPackage>> ResolveAsync(DirectoryInfo baseDir, bool disableUpdates)
|
public async Task<ImmutableSortedSet<ResolvedPackage>> ResolveAsync(DirectoryInfo baseDir, bool disableUpdates, List<PackageReference> invalidPackages)
|
||||||
{
|
{
|
||||||
var order = 0;
|
var order = 0;
|
||||||
var packages = new Dictionary<Package, CatalogEntry>();
|
var packages = new Dictionary<Package, CatalogEntry>();
|
||||||
@@ -31,6 +31,12 @@ public class PackageResolver(NuGetFramework runtimeFramework, ImmutableArray<Pac
|
|||||||
}
|
}
|
||||||
catch (HttpRequestException ex)
|
catch (HttpRequestException ex)
|
||||||
{
|
{
|
||||||
|
if (ex.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||||
|
{
|
||||||
|
//package isn't on this source, and should be removed from the config
|
||||||
|
invalidPackages.Add(reference);
|
||||||
|
}
|
||||||
|
|
||||||
Log.Warn("Failed to resolve package {Package}: {Message}", reference.Id, ex.Message);
|
Log.Warn("Failed to resolve package {Package}: {Message}", reference.Id, ex.Message);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -71,8 +77,6 @@ public class PackageResolver(NuGetFramework runtimeFramework, ImmutableArray<Pac
|
|||||||
if (!packages.TryGetValue(package, out var existingEntry))
|
if (!packages.TryGetValue(package, out var existingEntry))
|
||||||
throw new InvalidOperationException($"Duplicate package error {package.Id}");
|
throw new InvalidOperationException($"Duplicate package error {package.Id}");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (package.Version < existingEntry.Version)
|
if (package.Version < existingEntry.Version)
|
||||||
throw new NotSupportedException($"Package reference {package.Id} has lower version {package.Version} than already resolved {existingEntry.Version}");
|
throw new NotSupportedException($"Package reference {package.Id} has lower version {package.Version} than already resolved {existingEntry.Version}");
|
||||||
|
|
||||||
|
@@ -120,6 +120,7 @@ internal class PluginListComponent : IRenderComponent
|
|||||||
sortSpecs.SpecsDirty = false;
|
sortSpecs.SpecsDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var i = 0;
|
||||||
foreach (var plugin in _plugins)
|
foreach (var plugin in _plugins)
|
||||||
{
|
{
|
||||||
TableNextRow();
|
TableNextRow();
|
||||||
@@ -132,8 +133,18 @@ internal class PluginListComponent : IRenderComponent
|
|||||||
plugin.IsReloading ? Color.Yellow.ToFloat4() : plugin.HasConfig ? Color.Red.ToFloat4() : Color.DarkRed.ToFloat4());
|
plugin.IsReloading ? Color.Yellow.ToFloat4() : plugin.HasConfig ? Color.Red.ToFloat4() : Color.DarkRed.ToFloat4());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Selectable(plugin.Metadata.Name, false, ImGuiSelectableFlags.SpanAllColumns) && !plugin.IsReloading)
|
if (Selectable($"{plugin.Metadata.Name}##{++i}", false, ImGuiSelectableFlags.SpanAllColumns) && !plugin.IsReloading)
|
||||||
plugin.OpenConfig();
|
plugin.OpenConfig();
|
||||||
|
|
||||||
|
if (!plugin.IsReloading && plugin.IsLocal && BeginPopupContextItem($"##{plugin.Metadata.Name}ContextMenu{i}"))
|
||||||
|
{
|
||||||
|
if (Button($"Reload##{i}"))
|
||||||
|
{
|
||||||
|
PluginsLifetime.ReloadPlugin(plugin).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
EndPopup();
|
||||||
|
}
|
||||||
|
|
||||||
if (plugin.WrappedInstance?.LastException is not null && !plugin.IsReloading)
|
if (plugin.WrappedInstance?.LastException is not null && !plugin.IsReloading)
|
||||||
{
|
{
|
||||||
PopStyleColor();
|
PopStyleColor();
|
||||||
@@ -143,16 +154,6 @@ internal class PluginListComponent : IRenderComponent
|
|||||||
}
|
}
|
||||||
EndDisabled();
|
EndDisabled();
|
||||||
|
|
||||||
if (!plugin.IsReloading && BeginPopupContextItem($"##{plugin.Metadata.Name}ContextMenu"))
|
|
||||||
{
|
|
||||||
BeginDisabled(!plugin.IsLocal);
|
|
||||||
if (Button("Reload"))
|
|
||||||
{
|
|
||||||
PluginsLifetime.ReloadPlugin(plugin).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
EndDisabled();
|
|
||||||
EndPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
Text(plugin.Metadata.Version.ToString());
|
Text(plugin.Metadata.Version.ToString());
|
||||||
|
Reference in New Issue
Block a user