| | 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 | | public class AddDefaultPluginRepository : IMigrationRoutine |
| | 11 | | { |
| | 12 | | private readonly IServerConfigurationManager _serverConfigurationManager; |
| | 13 | |
|
| 0 | 14 | | private readonly RepositoryInfo _defaultRepositoryInfo = new RepositoryInfo |
| 0 | 15 | | { |
| 0 | 16 | | Name = "Jellyfin Stable", |
| 0 | 17 | | Url = "https://repo.jellyfin.org/releases/plugin/manifest-stable.json" |
| 0 | 18 | | }; |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// Initializes a new instance of the <see cref="AddDefaultPluginRepository"/> class. |
| | 22 | | /// </summary> |
| | 23 | | /// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface |
| | 24 | | public AddDefaultPluginRepository(IServerConfigurationManager serverConfigurationManager) |
| | 25 | | { |
| 0 | 26 | | _serverConfigurationManager = serverConfigurationManager; |
| 0 | 27 | | } |
| | 28 | |
|
| | 29 | | /// <inheritdoc/> |
| 0 | 30 | | public Guid Id => Guid.Parse("EB58EBEE-9514-4B9B-8225-12E1A40020DF"); |
| | 31 | |
|
| | 32 | | /// <inheritdoc/> |
| 0 | 33 | | public string Name => "AddDefaultPluginRepository"; |
| | 34 | |
|
| | 35 | | /// <inheritdoc/> |
| 0 | 36 | | public bool PerformOnNewInstall => true; |
| | 37 | |
|
| | 38 | | /// <inheritdoc/> |
| | 39 | | public void Perform() |
| | 40 | | { |
| 0 | 41 | | _serverConfigurationManager.Configuration.PluginRepositories = new[] { _defaultRepositoryInfo }; |
| 0 | 42 | | _serverConfigurationManager.SaveConfiguration(); |
| 0 | 43 | | } |
| | 44 | | } |
| | 45 | | } |