mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 09:59:06 -07:00
Add migration for new plugin repo
This commit is contained in:
parent
3bd1a5c557
commit
afacd8d025
@ -43,7 +43,8 @@ namespace Jellyfin.Server.Migrations
|
|||||||
typeof(Routines.MigrateAuthenticationDb),
|
typeof(Routines.MigrateAuthenticationDb),
|
||||||
typeof(Routines.FixPlaylistOwner),
|
typeof(Routines.FixPlaylistOwner),
|
||||||
typeof(Routines.MigrateRatingLevels),
|
typeof(Routines.MigrateRatingLevels),
|
||||||
typeof(Routines.AddDefaultCastReceivers)
|
typeof(Routines.AddDefaultCastReceivers),
|
||||||
|
typeof(Routines.UpdateDefaultPluginRepository)
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -50,7 +50,7 @@ namespace Jellyfin.Server.Implementations.Tests.Updates
|
|||||||
{
|
{
|
||||||
PackageInfo[] packages = await _installationManager.GetPackages(
|
PackageInfo[] packages = await _installationManager.GetPackages(
|
||||||
"Jellyfin Stable",
|
"Jellyfin Stable",
|
||||||
"https://repo.jellyfin.org/releases/plugin/manifest-stable.json",
|
"https://repo.jellyfin.org/files/plugin/manifest.json",
|
||||||
false);
|
false);
|
||||||
|
|
||||||
Assert.Equal(25, packages.Length);
|
Assert.Equal(25, packages.Length);
|
||||||
@ -61,7 +61,7 @@ namespace Jellyfin.Server.Implementations.Tests.Updates
|
|||||||
{
|
{
|
||||||
PackageInfo[] packages = await _installationManager.GetPackages(
|
PackageInfo[] packages = await _installationManager.GetPackages(
|
||||||
"Jellyfin Stable",
|
"Jellyfin Stable",
|
||||||
"https://repo.jellyfin.org/releases/plugin/manifest-stable.json",
|
"https://repo.jellyfin.org/files/plugin/manifest.json",
|
||||||
false);
|
false);
|
||||||
|
|
||||||
packages = _installationManager.FilterPackages(packages, "Anime").ToArray();
|
packages = _installationManager.FilterPackages(packages, "Anime").ToArray();
|
||||||
@ -73,7 +73,7 @@ namespace Jellyfin.Server.Implementations.Tests.Updates
|
|||||||
{
|
{
|
||||||
PackageInfo[] packages = await _installationManager.GetPackages(
|
PackageInfo[] packages = await _installationManager.GetPackages(
|
||||||
"Jellyfin Stable",
|
"Jellyfin Stable",
|
||||||
"https://repo.jellyfin.org/releases/plugin/manifest-stable.json",
|
"https://repo.jellyfin.org/files/plugin/manifest.json",
|
||||||
false);
|
false);
|
||||||
|
|
||||||
packages = _installationManager.FilterPackages(packages, id: new Guid("a4df60c5-6ab4-412a-8f79-2cab93fb2bc5")).ToArray();
|
packages = _installationManager.FilterPackages(packages, id: new Guid("a4df60c5-6ab4-412a-8f79-2cab93fb2bc5")).ToArray();
|
||||||
|
Loading…
Reference in New Issue
Block a user