fix: don't use URL to indicate official repo plugins

This commit is contained in:
goat 2022-08-21 18:15:05 +02:00
parent 4fd1f7a22f
commit 75885311f2
No known key found for this signature in database
GPG key ID: 7773BB5B43BA52E5
3 changed files with 9 additions and 4 deletions

View file

@ -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);

View file

@ -217,8 +217,10 @@ internal class LocalPlugin : IDisposable
/// <summary>
/// Gets a value indicating whether or not this plugin is orphaned(belongs to a repo) or not.
/// </summary>
public bool IsOrphaned => !this.IsDev && !this.Manifest.InstalledFromUrl.IsNullOrEmpty() &&
Service<PluginManager>.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<PluginManager>.Get().Repos.All(x => x.PluginMasterUrl != this.Manifest.InstalledFromUrl) &&
this.Manifest.InstalledFromUrl != LocalPluginManifest.FlagMainRepo;
/// <summary>
/// Gets a value indicating whether this plugin has been banned.

View file

@ -12,6 +12,9 @@ namespace Dalamud.Plugin.Internal.Types;
/// </summary>
internal record LocalPluginManifest : PluginManifest
{
[JsonIgnore]
public const string FlagMainRepo = "OFFICIAL";
/// <summary>
/// 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.
/// </summary>
public bool IsThirdParty => !this.InstalledFromUrl.IsNullOrEmpty() && this.InstalledFromUrl != PluginRepository.MainRepoUrl;
public bool IsThirdParty => !this.InstalledFromUrl.IsNullOrEmpty() && this.InstalledFromUrl != FlagMainRepo;
/// <summary>
/// Gets the effective version of this plugin.