|
|
|
@ -354,14 +354,6 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
CancellationToken.None);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a list of available fallback font files.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <response code="200">Information retrieved.</response>
|
|
|
|
|
/// <returns>An array of <see cref="FontFile"/> with the available font files.</returns>
|
|
|
|
|
[HttpGet("FallbackFont/Fonts")]
|
|
|
|
|
[Authorize(Policy = Policies.DefaultAuthorization)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a list of available fallback font files.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -378,7 +370,6 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
if (!string.IsNullOrEmpty(fallbackFontPath))
|
|
|
|
|
{
|
|
|
|
|
var files = _fileSystem.GetFiles(fallbackFontPath, new[] { ".woff", ".woff2", ".ttf", ".otf" }, false, false);
|
|
|
|
|
|
|
|
|
|
var fontFiles = files
|
|
|
|
|
.Select(i => new FontFile
|
|
|
|
|
{
|
|
|
|
@ -391,7 +382,6 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
.ThenBy(i => i.Name)
|
|
|
|
|
.ThenByDescending(i => i.DateModified)
|
|
|
|
|
.ThenByDescending(i => i.DateCreated);
|
|
|
|
|
|
|
|
|
|
// max total size 20M
|
|
|
|
|
const int MaxSize = 20971520;
|
|
|
|
|
var sizeCounter = 0L;
|
|
|
|
@ -403,7 +393,6 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
_logger.LogWarning("Some fonts will not be sent due to size limitations");
|
|
|
|
|
yield break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yield return fontFile;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -429,8 +418,6 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
var fallbackFontPath = encodingOptions.FallbackFontPath;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(fallbackFontPath))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var fontFile = _fileSystem.GetFiles(fallbackFontPath)
|
|
|
|
|
.First(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));
|
|
|
|
@ -448,18 +435,14 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
_logger.LogWarning("The selected font is null or empty");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError(ex, "Error reading fallback font");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_logger.LogWarning("The path of fallback font folder has not been set");
|
|
|
|
|
encodingOptions.EnableFallbackFont = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return File(Encoding.UTF8.GetBytes(string.Empty), MediaTypeNames.Text.Plain);
|
|
|
|
|
// returning HTTP 204 will break the SubtitlesOctopus
|
|
|
|
|
return Ok();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|