< Summary - Jellyfin

Information
Class: Jellyfin.Server.Migrations.Routines.ReaddDefaultPluginRepository
Assembly: jellyfin
File(s): /srv/git/jellyfin/Jellyfin.Server/Migrations/Routines/ReaddDefaultPluginRepository.cs
Line coverage
81%
Covered lines: 9
Uncovered lines: 2
Coverable lines: 11
Total lines: 42
Line coverage: 81.8%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Perform()50%3250%

File(s)

/srv/git/jellyfin/Jellyfin.Server/Migrations/Routines/ReaddDefaultPluginRepository.cs

#LineLine coverage
 1using System;
 2using MediaBrowser.Controller.Configuration;
 3using MediaBrowser.Model.Updates;
 4
 5namespace 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", 
 12public class ReaddDefaultPluginRepository : IMigrationRoutine
 13#pragma warning restore CS0618 // Type or member is obsolete
 14{
 15    private readonly IServerConfigurationManager _serverConfigurationManager;
 16
 2117    private readonly RepositoryInfo _defaultRepositoryInfo = new RepositoryInfo
 2118    {
 2119        Name = "Jellyfin Stable",
 2120        Url = "https://repo.jellyfin.org/releases/plugin/manifest-stable.json"
 2121    };
 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    {
 2129        _serverConfigurationManager = serverConfigurationManager;
 2130    }
 31
 32    /// <inheritdoc/>
 33    public void Perform()
 34    {
 35        // Only add if repository list is empty
 2136        if (_serverConfigurationManager.Configuration.PluginRepositories.Length == 0)
 37        {
 038            _serverConfigurationManager.Configuration.PluginRepositories = new[] { _defaultRepositoryInfo };
 039            _serverConfigurationManager.SaveConfiguration();
 40        }
 2141    }
 42}