diff --git a/Dalamud/Plugin/Internal/Types/LocalPlugin.cs b/Dalamud/Plugin/Internal/Types/LocalPlugin.cs index f9fe09b68..344ba3c28 100644 --- a/Dalamud/Plugin/Internal/Types/LocalPlugin.cs +++ b/Dalamud/Plugin/Internal/Types/LocalPlugin.cs @@ -209,6 +209,12 @@ internal class LocalPlugin : IDisposable /// public bool IsTesting => this.Manifest.IsTestingExclusive || this.Manifest.Testing; + /// + /// Gets a value indicating whether or not this plugin is orphaned(belongs to a repo) or not. + /// + public bool IsOrphaned => !this.IsDev && !this.Manifest.InstalledFromUrl.IsNullOrEmpty() && + Service.Get().Repos.All(x => x.PluginMasterUrl != this.Manifest.InstalledFromUrl); + /// /// Gets a value indicating whether this plugin has been banned. /// @@ -302,6 +308,9 @@ internal class LocalPlugin : IDisposable if (this.Manifest.Disabled) throw new InvalidPluginOperationException($"Unable to load {this.Name}, disabled"); + if (this.IsOrphaned) + throw new InvalidPluginOperationException($"Plugin {this.Name} had no associated repo."); + this.State = PluginState.Loading; Log.Information($"Loading {this.DllFile.Name}"); diff --git a/Dalamud/Plugin/Internal/Types/LocalPluginManifest.cs b/Dalamud/Plugin/Internal/Types/LocalPluginManifest.cs index 261f28b0e..0853b19be 100644 --- a/Dalamud/Plugin/Internal/Types/LocalPluginManifest.cs +++ b/Dalamud/Plugin/Internal/Types/LocalPluginManifest.cs @@ -1,5 +1,6 @@ using System.IO; +using Dalamud.Utility; using Newtonsoft.Json; namespace Dalamud.Plugin.Internal.Types; @@ -33,7 +34,7 @@ internal record LocalPluginManifest : PluginManifest /// Gets a value indicating whether this manifest is associated with a plugin that was installed from a third party /// repo. Unless the manifest has been manually modified, this is determined by the InstalledFromUrl being null. /// - public bool IsThirdParty => !string.IsNullOrEmpty(this.InstalledFromUrl); + public bool IsThirdParty => !this.InstalledFromUrl.IsNullOrEmpty() && this.InstalledFromUrl != PluginRepository.MainRepoUrl; /// /// Save a plugin manifest to file. diff --git a/Dalamud/Plugin/Internal/Types/PluginRepository.cs b/Dalamud/Plugin/Internal/Types/PluginRepository.cs index 63ea5c5d4..82e4fb13d 100644 --- a/Dalamud/Plugin/Internal/Types/PluginRepository.cs +++ b/Dalamud/Plugin/Internal/Types/PluginRepository.cs @@ -15,7 +15,10 @@ namespace Dalamud.Plugin.Internal.Types; /// internal class PluginRepository { - private const string DalamudPluginsMasterUrl = "https://kamori.goats.dev/Plugin/PluginMaster"; + /// + /// The URL of the official main repository. + /// + public const string MainRepoUrl = "https://kamori.goats.dev/Plugin/PluginMaster"; private static readonly ModuleLog Log = new("PLUGINR"); @@ -38,14 +41,14 @@ internal class PluginRepository public PluginRepository(string pluginMasterUrl, bool isEnabled) { this.PluginMasterUrl = pluginMasterUrl; - this.IsThirdParty = pluginMasterUrl != DalamudPluginsMasterUrl; + this.IsThirdParty = pluginMasterUrl != MainRepoUrl; this.IsEnabled = isEnabled; } /// /// Gets a new instance of the class for the main repo. /// - public static PluginRepository MainRepo => new(DalamudPluginsMasterUrl, true); + public static PluginRepository MainRepo => new(MainRepoUrl, true); /// /// Gets the pluginmaster.json URL.