| | 1 | | using System; |
| | 2 | | using MediaBrowser.Controller.Configuration; |
| | 3 | |
|
| | 4 | | namespace Jellyfin.Server.Migrations.Routines; |
| | 5 | |
|
| | 6 | | /// <summary> |
| | 7 | | /// Migration to update the default Jellyfin plugin repository. |
| | 8 | | /// </summary> |
| | 9 | | #pragma warning disable CS0618 // Type or member is obsolete |
| | 10 | | [JellyfinMigration("2025-04-20T17:00:00", nameof(UpdateDefaultPluginRepository), "852816E0-2712-49A9-9240-C6FC5FCAD1A8", |
| | 11 | | public class UpdateDefaultPluginRepository : IMigrationRoutine |
| | 12 | | #pragma warning restore CS0618 // Type or member is obsolete |
| | 13 | | { |
| | 14 | | private const string NewRepositoryUrl = "https://repo.jellyfin.org/files/plugin/manifest.json"; |
| | 15 | | private const string OldRepositoryUrl = "https://repo.jellyfin.org/releases/plugin/manifest-stable.json"; |
| | 16 | |
|
| | 17 | | private readonly IServerConfigurationManager _serverConfigurationManager; |
| | 18 | |
|
| | 19 | | /// <summary> |
| | 20 | | /// Initializes a new instance of the <see cref="UpdateDefaultPluginRepository"/> class. |
| | 21 | | /// </summary> |
| | 22 | | /// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</p |
| | 23 | | public UpdateDefaultPluginRepository(IServerConfigurationManager serverConfigurationManager) |
| | 24 | | { |
| 21 | 25 | | _serverConfigurationManager = serverConfigurationManager; |
| 21 | 26 | | } |
| | 27 | |
|
| | 28 | | /// <inheritdoc /> |
| | 29 | | public void Perform() |
| | 30 | | { |
| 21 | 31 | | var updated = false; |
| 84 | 32 | | foreach (var repo in _serverConfigurationManager.Configuration.PluginRepositories) |
| | 33 | | { |
| 21 | 34 | | if (string.Equals(repo.Url, OldRepositoryUrl, StringComparison.OrdinalIgnoreCase)) |
| | 35 | | { |
| 21 | 36 | | repo.Url = NewRepositoryUrl; |
| 21 | 37 | | updated = true; |
| | 38 | | } |
| | 39 | | } |
| | 40 | |
|
| 21 | 41 | | if (updated) |
| | 42 | | { |
| 21 | 43 | | _serverConfigurationManager.SaveConfiguration(); |
| | 44 | | } |
| 21 | 45 | | } |
| | 46 | | } |