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