aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2024-03-03 16:58:44 -0500
committerGitHub <noreply@github.com>2024-03-03 16:58:44 -0500
commit83d2bc3f9f13c62f6d3ef16c4fe75f0f5a18110d (patch)
treeb5d6b867432b51785dee1c57fc3b8291c60552c4
parent6e5ec99ea10557c141ed8d755e672cef628d35f0 (diff)
parentafacd8d025ba6a166981ced1c73d968400b0f373 (diff)
Merge pull request #11100 from crobibero/plugin-repo-10.9
Add migration for new plugin repo
-rw-r--r--Jellyfin.Server/Migrations/MigrationRunner.cs3
-rw-r--r--Jellyfin.Server/Migrations/Routines/UpdateDefaultPluginRepository.cs52
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/Test Data/Updates/manifest.json (renamed from tests/Jellyfin.Server.Implementations.Tests/Test Data/Updates/manifest-stable.json)0
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/Updates/InstallationManagerTests.cs6
4 files changed, 57 insertions, 4 deletions
diff --git a/Jellyfin.Server/Migrations/MigrationRunner.cs b/Jellyfin.Server/Migrations/MigrationRunner.cs
index 757b56a49..44aa43044 100644
--- a/Jellyfin.Server/Migrations/MigrationRunner.cs
+++ b/Jellyfin.Server/Migrations/MigrationRunner.cs
@@ -43,7 +43,8 @@ namespace Jellyfin.Server.Migrations
typeof(Routines.MigrateAuthenticationDb),
typeof(Routines.FixPlaylistOwner),
typeof(Routines.MigrateRatingLevels),
- typeof(Routines.AddDefaultCastReceivers)
+ typeof(Routines.AddDefaultCastReceivers),
+ typeof(Routines.UpdateDefaultPluginRepository)
};
/// <summary>
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;
+
+/// <summary>
+/// Migration to update the default Jellyfin plugin repository.
+/// </summary>
+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;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="UpdateDefaultPluginRepository"/> class.
+ /// </summary>
+ /// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</param>
+ public UpdateDefaultPluginRepository(IServerConfigurationManager serverConfigurationManager)
+ {
+ _serverConfigurationManager = serverConfigurationManager;
+ }
+
+ /// <inheritdoc />
+ public Guid Id => new("852816E0-2712-49A9-9240-C6FC5FCAD1A8");
+
+ /// <inheritdoc />
+ public string Name => "UpdateDefaultPluginRepository10.9";
+
+ /// <inheritdoc />
+ public bool PerformOnNewInstall => true;
+
+ /// <inheritdoc />
+ 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();
+ }
+ }
+}
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Test Data/Updates/manifest-stable.json b/tests/Jellyfin.Server.Implementations.Tests/Test Data/Updates/manifest.json
index 57367ce88..57367ce88 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/Test Data/Updates/manifest-stable.json
+++ b/tests/Jellyfin.Server.Implementations.Tests/Test Data/Updates/manifest.json
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Updates/InstallationManagerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Updates/InstallationManagerTests.cs
index 5caf7d124..f58a3276b 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/Updates/InstallationManagerTests.cs
+++ b/tests/Jellyfin.Server.Implementations.Tests/Updates/InstallationManagerTests.cs
@@ -50,7 +50,7 @@ namespace Jellyfin.Server.Implementations.Tests.Updates
{
PackageInfo[] packages = await _installationManager.GetPackages(
"Jellyfin Stable",
- "https://repo.jellyfin.org/releases/plugin/manifest-stable.json",
+ "https://repo.jellyfin.org/files/plugin/manifest.json",
false);
Assert.Equal(25, packages.Length);
@@ -61,7 +61,7 @@ namespace Jellyfin.Server.Implementations.Tests.Updates
{
PackageInfo[] packages = await _installationManager.GetPackages(
"Jellyfin Stable",
- "https://repo.jellyfin.org/releases/plugin/manifest-stable.json",
+ "https://repo.jellyfin.org/files/plugin/manifest.json",
false);
packages = _installationManager.FilterPackages(packages, "Anime").ToArray();
@@ -73,7 +73,7 @@ namespace Jellyfin.Server.Implementations.Tests.Updates
{
PackageInfo[] packages = await _installationManager.GetPackages(
"Jellyfin Stable",
- "https://repo.jellyfin.org/releases/plugin/manifest-stable.json",
+ "https://repo.jellyfin.org/files/plugin/manifest.json",
false);
packages = _installationManager.FilterPackages(packages, id: new Guid("a4df60c5-6ab4-412a-8f79-2cab93fb2bc5")).ToArray();