mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-02 23:06:31 +01:00
make channel access opt-in rather than opt out
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using MediaBrowser.Api.Playback;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
using MediaBrowser.Controller.Session;
|
||||
@@ -39,6 +40,7 @@ namespace MediaBrowser.Api
|
||||
private readonly IServerConfigurationManager _config;
|
||||
|
||||
private readonly ISessionManager _sessionManager;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public readonly SemaphoreSlim TranscodingStartLock = new SemaphoreSlim(1, 1);
|
||||
|
||||
@@ -48,11 +50,12 @@ namespace MediaBrowser.Api
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="sessionManager">The session manager.</param>
|
||||
/// <param name="config">The configuration.</param>
|
||||
public ApiEntryPoint(ILogger logger, ISessionManager sessionManager, IServerConfigurationManager config)
|
||||
public ApiEntryPoint(ILogger logger, ISessionManager sessionManager, IServerConfigurationManager config, IFileSystem fileSystem)
|
||||
{
|
||||
Logger = logger;
|
||||
_sessionManager = sessionManager;
|
||||
_config = config;
|
||||
_fileSystem = fileSystem;
|
||||
|
||||
Instance = this;
|
||||
}
|
||||
@@ -91,7 +94,7 @@ namespace MediaBrowser.Api
|
||||
foreach (var file in Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories)
|
||||
.ToList())
|
||||
{
|
||||
File.Delete(file);
|
||||
_fileSystem.DeleteFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,7 +465,7 @@ namespace MediaBrowser.Api
|
||||
/// <param name="outputFilePath">The output file path.</param>
|
||||
private void DeleteProgressivePartialStreamFiles(string outputFilePath)
|
||||
{
|
||||
File.Delete(outputFilePath);
|
||||
_fileSystem.DeleteFile(outputFilePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -479,13 +482,13 @@ namespace MediaBrowser.Api
|
||||
.ToList();
|
||||
|
||||
Exception e = null;
|
||||
|
||||
|
||||
foreach (var file in filesToDelete)
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.Info("Deleting HLS file {0}", file);
|
||||
File.Delete(file);
|
||||
_fileSystem.DeleteFile(file);
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace MediaBrowser.Api
|
||||
[ApiMember(Name = "ExcludeLibraries", Description = "ExcludeLibraries", IsRequired = true, DataType = "string", ParameterType = "body", Verb = "POST")]
|
||||
public string ExcludedLibraries { get; set; }
|
||||
|
||||
[ApiMember(Name = "ExcludedChannels", Description = "ExcludedChannels", IsRequired = true, DataType = "string", ParameterType = "body", Verb = "POST")]
|
||||
public string ExcludedChannels { get; set; }
|
||||
[ApiMember(Name = "EnabledChannels", Description = "EnabledChannels", IsRequired = true, DataType = "string", ParameterType = "body", Verb = "POST")]
|
||||
public string EnabledChannels { get; set; }
|
||||
|
||||
[ApiMember(Name = "EnableLiveTv", Description = "EnableLiveTv", IsRequired = true, DataType = "string", ParameterType = "body", Verb = "POST")]
|
||||
public bool EnableLiveTv { get; set; }
|
||||
@@ -96,7 +96,7 @@ namespace MediaBrowser.Api
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i))
|
||||
.ToArray();
|
||||
|
||||
var excludedChannels = (request.ExcludedChannels ?? string.Empty)
|
||||
var enabledChannels = (request.EnabledChannels ?? string.Empty)
|
||||
.Split(',')
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i))
|
||||
.ToArray();
|
||||
@@ -106,7 +106,7 @@ namespace MediaBrowser.Api
|
||||
ConnectUserName = request.ConnectUsername,
|
||||
SendingUserId = request.SendingUserId,
|
||||
ExcludedLibraries = excludeLibraries,
|
||||
ExcludedChannels = excludedChannels,
|
||||
EnabledChannels = enabledChannels,
|
||||
EnableLiveTv = request.EnableLiveTv
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace MediaBrowser.Api.Library
|
||||
|
||||
if (!string.IsNullOrEmpty(shortcut))
|
||||
{
|
||||
File.Delete(shortcut);
|
||||
fileSystem.DeleteFile(shortcut);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -348,7 +348,7 @@ namespace MediaBrowser.Api.Library
|
||||
|
||||
try
|
||||
{
|
||||
Directory.Delete(path, true);
|
||||
_fileSystem.DeleteDirectory(path, true);
|
||||
|
||||
// Need to add a delay here or directory watchers may still pick up the changes
|
||||
var delayTask = Task.Delay(1000);
|
||||
|
||||
@@ -210,10 +210,10 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
File.Delete(file.FullName);
|
||||
FileSystem.DeleteFile(file.FullName);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
|
||||
@@ -489,7 +489,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(file.FullName);
|
||||
FileSystem.DeleteFile(file.FullName);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
|
||||
@@ -245,6 +245,11 @@ namespace MediaBrowser.Api.Session
|
||||
|
||||
[ApiMember(Name = "SupportsUniqueIdentifier", Description = "Determines whether the device supports a unique identifier.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "POST")]
|
||||
public bool SupportsUniqueIdentifier { get; set; }
|
||||
|
||||
public PostCapabilities()
|
||||
{
|
||||
SupportsUniqueIdentifier = true;
|
||||
}
|
||||
}
|
||||
|
||||
[Route("/Sessions/Capabilities/Full", "POST", Summary = "Updates capabilities for a device")]
|
||||
|
||||
@@ -62,6 +62,8 @@ namespace MediaBrowser.Api
|
||||
{
|
||||
_config.Configuration.IsStartupWizardCompleted = true;
|
||||
_config.Configuration.EnableLocalizedGuids = true;
|
||||
_config.Configuration.StoreArtistsInMetadata = true;
|
||||
_config.Configuration.EnableLibraryMetadataSubFolder = true;
|
||||
_config.SaveConfiguration();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user