diff options
| author | crobibero <cody@robibe.ro> | 2020-06-12 14:35:51 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-06-12 14:35:51 -0600 |
| commit | 2fe65d99f6886d607d618903ac03f7474ce68df0 (patch) | |
| tree | 681efab6ef8fdbffc8b8ddb3e09bc811c733a10d /Jellyfin.Server/Formatters/CssOutputFormatter.cs | |
| parent | dfe873fc293cf940a4f3d25aacdc8dfc53f150dc (diff) | |
| parent | 6429e60c408c0b88edee6745c5c9c14faade3c9d (diff) | |
Merge remote-tracking branch 'upstream/api-migration' into api-swagger-auth
Diffstat (limited to 'Jellyfin.Server/Formatters/CssOutputFormatter.cs')
| -rw-r--r-- | Jellyfin.Server/Formatters/CssOutputFormatter.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Jellyfin.Server/Formatters/CssOutputFormatter.cs b/Jellyfin.Server/Formatters/CssOutputFormatter.cs new file mode 100644 index 000000000..b3771b7fe --- /dev/null +++ b/Jellyfin.Server/Formatters/CssOutputFormatter.cs @@ -0,0 +1,36 @@ +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.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()); + } + } +} |
