Merge pull request #4260 from crobibero/api-data-file

Allow server to return .data files
This commit is contained in:
Bond-009 2020-10-02 23:05:01 +02:00 committed by GitHub
commit 1c6a45f7a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Net.Mime;
using Jellyfin.Api.TypeConverters; using Jellyfin.Api.TypeConverters;
using Jellyfin.Server.Extensions; using Jellyfin.Server.Extensions;
using Jellyfin.Server.Implementations; using Jellyfin.Server.Implementations;
@ -11,6 +12,7 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Extensions; using MediaBrowser.Controller.Extensions;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.FileProviders;
@ -123,10 +125,15 @@ namespace Jellyfin.Server
mainApp.UseStaticFiles(); mainApp.UseStaticFiles();
if (appConfig.HostWebClient()) if (appConfig.HostWebClient())
{ {
var extensionProvider = new FileExtensionContentTypeProvider();
// subtitles octopus requires .data files.
extensionProvider.Mappings.Add(".data", MediaTypeNames.Application.Octet);
mainApp.UseStaticFiles(new StaticFileOptions mainApp.UseStaticFiles(new StaticFileOptions
{ {
FileProvider = new PhysicalFileProvider(_serverConfigurationManager.ApplicationPaths.WebPath), FileProvider = new PhysicalFileProvider(_serverConfigurationManager.ApplicationPaths.WebPath),
RequestPath = "/web" RequestPath = "/web",
ContentTypeProvider = extensionProvider
}); });
} }