From 75885311f258ef6685a9910a5c2744c50ba90645 Mon Sep 17 00:00:00 2001
From: goat <16760685+goaaats@users.noreply.github.com>
Date: Sun, 21 Aug 2022 18:15:05 +0200
Subject: [PATCH] fix: don't use URL to indicate official repo plugins
---
Dalamud/Plugin/Internal/PluginManager.cs | 2 +-
Dalamud/Plugin/Internal/Types/LocalPlugin.cs | 6 ++++--
Dalamud/Plugin/Internal/Types/LocalPluginManifest.cs | 5 ++++-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/Dalamud/Plugin/Internal/PluginManager.cs b/Dalamud/Plugin/Internal/PluginManager.cs
index 2634cbd30..52059da7e 100644
--- a/Dalamud/Plugin/Internal/PluginManager.cs
+++ b/Dalamud/Plugin/Internal/PluginManager.cs
@@ -763,7 +763,7 @@ internal partial class PluginManager : IDisposable, IServiceType
}
// Document the url the plugin was installed from
- manifest.InstalledFromUrl = repoManifest.SourceRepo.PluginMasterUrl;
+ manifest.InstalledFromUrl = repoManifest.SourceRepo.IsThirdParty ? repoManifest.SourceRepo.PluginMasterUrl : LocalPluginManifest.FlagMainRepo;
manifest.Save(manifestFile);
diff --git a/Dalamud/Plugin/Internal/Types/LocalPlugin.cs b/Dalamud/Plugin/Internal/Types/LocalPlugin.cs
index bd9351585..da4872ca0 100644
--- a/Dalamud/Plugin/Internal/Types/LocalPlugin.cs
+++ b/Dalamud/Plugin/Internal/Types/LocalPlugin.cs
@@ -217,8 +217,10 @@ internal class LocalPlugin : IDisposable
///
/// 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);
+ public bool IsOrphaned => !this.IsDev &&
+ !this.Manifest.InstalledFromUrl.IsNullOrEmpty() && // TODO(api8): Remove this, all plugins will have a proper flag
+ Service.Get().Repos.All(x => x.PluginMasterUrl != this.Manifest.InstalledFromUrl) &&
+ this.Manifest.InstalledFromUrl != LocalPluginManifest.FlagMainRepo;
///
/// Gets a value indicating whether this plugin has been banned.
diff --git a/Dalamud/Plugin/Internal/Types/LocalPluginManifest.cs b/Dalamud/Plugin/Internal/Types/LocalPluginManifest.cs
index 634fbc75c..e3c44c21d 100644
--- a/Dalamud/Plugin/Internal/Types/LocalPluginManifest.cs
+++ b/Dalamud/Plugin/Internal/Types/LocalPluginManifest.cs
@@ -12,6 +12,9 @@ namespace Dalamud.Plugin.Internal.Types;
///
internal record LocalPluginManifest : PluginManifest
{
+ [JsonIgnore]
+ public const string FlagMainRepo = "OFFICIAL";
+
///
/// Gets or sets a value indicating whether the plugin is disabled and should not be loaded.
/// This value supersedes the ".disabled" file functionality and should not be included in the plugin master.
@@ -40,7 +43,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 => !this.InstalledFromUrl.IsNullOrEmpty() && this.InstalledFromUrl != PluginRepository.MainRepoUrl;
+ public bool IsThirdParty => !this.InstalledFromUrl.IsNullOrEmpty() && this.InstalledFromUrl != FlagMainRepo;
///
/// Gets the effective version of this plugin.