From ce8e0880442b54d70a6a0f65767c4fd7155d2be8 Mon Sep 17 00:00:00 2001 From: goat <16760685+goaaats@users.noreply.github.com> Date: Sun, 3 Jul 2022 18:02:46 +0200 Subject: [PATCH] feat: add orphaned plugins regardless, inform users in installer --- .../PluginInstaller/PluginInstallerWindow.cs | 22 ++++++++++++++++++- Dalamud/Plugin/Internal/PluginManager.cs | 14 +++++++----- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index ac5d1f98a..ffb05e170 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -1180,6 +1180,12 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller ImGui.PopStyleColor(); } + else if (plugin is { IsOrphaned: true }) + { + ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); + ImGui.TextWrapped(Locs.PluginBody_Orphaned); + ImGui.PopStyleColor(); + } else if (plugin is { State: PluginState.LoadError or PluginState.DependencyResolutionFailed }) // Load failed warning { ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); @@ -1517,6 +1523,13 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller trouble = true; } + // Orphaned + if (plugin.IsOrphaned) + { + label += Locs.PluginTitleMod_OrphanedError; + trouble = true; + } + ImGui.PushID($"installed{index}{plugin.Manifest.InternalName}"); var hasChangelog = !plugin.Manifest.Changelog.IsNullOrEmpty(); @@ -1691,6 +1704,9 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller // Disable everything if the plugin is outdated disabled = disabled || (plugin.IsOutdated && !configuration.LoadAllApiLevels) || plugin.IsBanned; + // Disable everything if the plugin is orphaned + disabled = disabled || plugin.IsOrphaned; + // Disable everything if the plugin failed to load disabled = disabled || plugin.State == PluginState.LoadError || plugin.State == PluginState.DependencyResolutionFailed; @@ -1904,7 +1920,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller private void DrawDeletePluginButton(LocalPlugin plugin) { var unloaded = plugin.State == PluginState.Unloaded; - var showButton = unloaded && (plugin.IsDev || plugin.IsOutdated || plugin.IsBanned); + var showButton = unloaded && (plugin.IsDev || plugin.IsOutdated || plugin.IsBanned || plugin.IsOrphaned); if (!showButton) return; @@ -2264,6 +2280,8 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller public static string PluginTitleMod_OutdatedError => Loc.Localize("InstallerOutdatedError", " (outdated)"); public static string PluginTitleMod_BannedError => Loc.Localize("InstallerBannedError", " (automatically disabled)"); + + public static string PluginTitleMod_OrphanedError => Loc.Localize("InstallerOrphanedError", " (unknown repository)"); public static string PluginTitleMod_New => Loc.Localize("InstallerNewPlugin ", " New!"); @@ -2299,6 +2317,8 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller public static string PluginBody_Outdated => Loc.Localize("InstallerOutdatedPluginBody ", "This plugin is outdated and incompatible at the moment. Please wait for it to be updated by its author."); + public static string PluginBody_Orphaned => Loc.Localize("InstallerOrphanedPluginBody ", "This plugin's source repository is no longer available. You may need to reinstall it from its repository, or re-add the repository."); + public static string PluginBody_LoadFailed => Loc.Localize("InstallerLoadFailedPluginBody ", "This plugin failed to load. Please contact the author for more information."); public static string PluginBody_Banned => Loc.Localize("InstallerBannedPluginBody ", "This plugin was automatically disabled due to incompatibilities and is not available at the moment. Please wait for it to be updated by its author."); diff --git a/Dalamud/Plugin/Internal/PluginManager.cs b/Dalamud/Plugin/Internal/PluginManager.cs index 8879ce4f2..533b2acd9 100644 --- a/Dalamud/Plugin/Internal/PluginManager.cs +++ b/Dalamud/Plugin/Internal/PluginManager.cs @@ -658,11 +658,8 @@ internal partial class PluginManager : IDisposable, IServiceType manifest.Testing = true; } - if (repoManifest.SourceRepo.IsThirdParty) - { - // Only document the url if it came from a third party repo. - manifest.InstalledFromUrl = repoManifest.SourceRepo.PluginMasterUrl; - } + // Document the url the plugin was installed from + manifest.InstalledFromUrl = repoManifest.SourceRepo.PluginMasterUrl; manifest.Save(manifestFile); @@ -740,9 +737,14 @@ internal partial class PluginManager : IDisposable, IServiceType } else if (plugin.IsOutdated) { - // Out of date plugins get added so they can be updated. + // Out of date plugins get added, so they can be updated. Log.Information(ex, $"Plugin was outdated, adding anyways: {dllFile.Name}"); } + else if (plugin.IsOrphaned) + { + // Orphaned plugins get added, so that users aren't confused. + Log.Information(ex, $"Plugin was orphaned, adding anyways: {dllFile.Name}"); + } else if (isBoot) { // During boot load, plugins always get added to the list so they can be fiddled with in the UI