aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Formatters/CssOutputFormatter.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-06-13 15:07:04 -0600
committercrobibero <cody@robibe.ro>2020-06-13 15:07:04 -0600
commitbd0975397613cc87bb97ae20a0608257487d0f77 (patch)
tree8588828ec26b4d86ff2a597c5f069ee45abe75cc /Jellyfin.Server/Formatters/CssOutputFormatter.cs
parentfd913d73e35491c64e39a76a266689c302a91b11 (diff)
parent0011e8df47380936742302ef40639a4626a780ed (diff)
Merge remote-tracking branch 'upstream/api-migration' into api-image
Diffstat (limited to 'Jellyfin.Server/Formatters/CssOutputFormatter.cs')
-rw-r--r--Jellyfin.Server/Formatters/CssOutputFormatter.cs36
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());
+ }
+ }
+}