mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-17 19:08:53 -07:00
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
|
using System;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using Microsoft.AspNetCore.Http;
|
|||
|
using Microsoft.AspNetCore.Mvc.Formatters;
|
|||
|
|
|||
|
namespace Jellyfin.Server.Formatters
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Css output formatter.
|
|||
|
/// </summary>
|
|||
|
public class CssOutputFormatter : TextOutputFormatter
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Initializes a new instance of the <see cref="CssOutputFormatter"/> class.
|
|||
|
/// </summary>
|
|||
|
public CssOutputFormatter()
|
|||
|
{
|
|||
|
SupportedMediaTypes.Clear();
|
|||
|
SupportedMediaTypes.Add("text/css");
|
|||
|
|
|||
|
SupportedEncodings.Add(Encoding.UTF8);
|
|||
|
SupportedEncodings.Add(Encoding.Unicode);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Write context object to stream.
|
|||
|
/// </summary>
|
|||
|
/// <param name="context">Writer context.</param>
|
|||
|
/// <param name="selectedEncoding">Unused. Writer encoding.</param>
|
|||
|
/// <returns>Write stream task.</returns>
|
|||
|
public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
|
|||
|
{
|
|||
|
return context.HttpContext.Response.WriteAsync(context.Object?.ToString());
|
|||
|
}
|
|||
|
}
|
|||
|
}
|