From afacd8d025ba6a166981ced1c73d968400b0f373 Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Sun, 3 Mar 2024 13:32:21 -0700 Subject: Add migration for new plugin repo --- .../Routines/UpdateDefaultPluginRepository.cs | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Jellyfin.Server/Migrations/Routines/UpdateDefaultPluginRepository.cs (limited to 'Jellyfin.Server/Migrations/Routines/UpdateDefaultPluginRepository.cs') diff --git a/Jellyfin.Server/Migrations/Routines/UpdateDefaultPluginRepository.cs b/Jellyfin.Server/Migrations/Routines/UpdateDefaultPluginRepository.cs new file mode 100644 index 000000000..7e8c8ac87 --- /dev/null +++ b/Jellyfin.Server/Migrations/Routines/UpdateDefaultPluginRepository.cs @@ -0,0 +1,52 @@ +using System; +using MediaBrowser.Controller.Configuration; + +namespace Jellyfin.Server.Migrations.Routines; + +/// +/// Migration to update the default Jellyfin plugin repository. +/// +public class UpdateDefaultPluginRepository : IMigrationRoutine +{ + private const string NewRepositoryUrl = "https://repo.jellyfin.org/files/plugin/manifest.json"; + private const string OldRepositoryUrl = "https://repo.jellyfin.org/releases/plugin/manifest-stable.json"; + + private readonly IServerConfigurationManager _serverConfigurationManager; + + /// + /// Initializes a new instance of the class. + /// + /// Instance of the interface. + public UpdateDefaultPluginRepository(IServerConfigurationManager serverConfigurationManager) + { + _serverConfigurationManager = serverConfigurationManager; + } + + /// + public Guid Id => new("852816E0-2712-49A9-9240-C6FC5FCAD1A8"); + + /// + public string Name => "UpdateDefaultPluginRepository10.9"; + + /// + public bool PerformOnNewInstall => true; + + /// + public void Perform() + { + var updated = false; + foreach (var repo in _serverConfigurationManager.Configuration.PluginRepositories) + { + if (string.Equals(repo.Url, OldRepositoryUrl, StringComparison.OrdinalIgnoreCase)) + { + repo.Url = NewRepositoryUrl; + updated = true; + } + } + + if (updated) + { + _serverConfigurationManager.SaveConfiguration(); + } + } +} -- cgit v1.2.3