ReaddDefaultPluginRepository.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using MediaBrowser.Controller.Configuration;
  3. using MediaBrowser.Model.Updates;
  4. namespace Jellyfin.Server.Migrations.Routines;
  5. /// <summary>
  6. /// Migration to initialize system configuration with the default plugin repository.
  7. /// </summary>
  8. #pragma warning disable CS0618 // Type or member is obsolete
  9. [JellyfinMigration("2025-04-20T11:00:00", nameof(ReaddDefaultPluginRepository), "5F86E7F6-D966-4C77-849D-7A7B40B68C4E", RunMigrationOnSetup = true)]
  10. public class ReaddDefaultPluginRepository : IMigrationRoutine
  11. #pragma warning restore CS0618 // Type or member is obsolete
  12. {
  13. private readonly IServerConfigurationManager _serverConfigurationManager;
  14. private readonly RepositoryInfo _defaultRepositoryInfo = new RepositoryInfo
  15. {
  16. Name = "Jellyfin Stable",
  17. Url = "https://repo.jellyfin.org/releases/plugin/manifest-stable.json"
  18. };
  19. /// <summary>
  20. /// Initializes a new instance of the <see cref="ReaddDefaultPluginRepository"/> class.
  21. /// </summary>
  22. /// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</param>
  23. public ReaddDefaultPluginRepository(IServerConfigurationManager serverConfigurationManager)
  24. {
  25. _serverConfigurationManager = serverConfigurationManager;
  26. }
  27. /// <inheritdoc/>
  28. public void Perform()
  29. {
  30. // Only add if repository list is empty
  31. if (_serverConfigurationManager.Configuration.PluginRepositories.Length == 0)
  32. {
  33. _serverConfigurationManager.Configuration.PluginRepositories = new[] { _defaultRepositoryInfo };
  34. _serverConfigurationManager.SaveConfiguration();
  35. }
  36. }
  37. }