mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-21 13:10:45 +02:00
fixed dashboard caching option
This commit is contained in:
parent
2bdd9cc1f2
commit
8b32e3292a
|
@ -43,7 +43,40 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
public object GetResult(object content, string contentType, IDictionary<string, string> responseHeaders = null)
|
public object GetResult(object content, string contentType, IDictionary<string, string> responseHeaders = null)
|
||||||
{
|
{
|
||||||
var result = new HttpResult(content, contentType);
|
return GetHttpResult(content, contentType, responseHeaders);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the HTTP result.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="content">The content.</param>
|
||||||
|
/// <param name="contentType">Type of the content.</param>
|
||||||
|
/// <param name="responseHeaders">The response headers.</param>
|
||||||
|
/// <returns>IHasOptions.</returns>
|
||||||
|
private IHasOptions GetHttpResult(object content, string contentType, IDictionary<string, string> responseHeaders = null)
|
||||||
|
{
|
||||||
|
IHasOptions result;
|
||||||
|
|
||||||
|
var stream = content as Stream;
|
||||||
|
|
||||||
|
if (stream != null)
|
||||||
|
{
|
||||||
|
result = new StreamWriter(stream, contentType, _logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var bytes = content as byte[];
|
||||||
|
|
||||||
|
if (bytes != null)
|
||||||
|
{
|
||||||
|
result = new StreamWriter(bytes, contentType, _logger);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new HttpResult(content, contentType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (responseHeaders != null)
|
if (responseHeaders != null)
|
||||||
{
|
{
|
||||||
|
@ -376,7 +409,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||||
|
|
||||||
if (isHeadRequest)
|
if (isHeadRequest)
|
||||||
{
|
{
|
||||||
return new HttpResult(new byte[] { }, contentType);
|
return GetHttpResult(new byte[] { }, contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new StreamWriter(stream, contentType, _logger);
|
return new StreamWriter(stream, contentType, _logger);
|
||||||
|
@ -384,7 +417,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||||
|
|
||||||
if (isHeadRequest)
|
if (isHeadRequest)
|
||||||
{
|
{
|
||||||
return new HttpResult(new byte[] { }, contentType);
|
return GetHttpResult(new byte[] { }, contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
string content;
|
string content;
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
// ***********************************************************************
|
||||||
|
// Assembly : MediaBrowser.Server.Implementations
|
||||||
|
// Author : Luke
|
||||||
|
// Created : 03-06-2013
|
||||||
|
//
|
||||||
|
// Last Modified By : Luke
|
||||||
|
// Last Modified On : 03-24-2013
|
||||||
|
// ***********************************************************************
|
||||||
|
// <copyright file="HttpServer.cs" company="">
|
||||||
|
// Copyright (c) . All rights reserved.
|
||||||
|
// </copyright>
|
||||||
|
// <summary></summary>
|
||||||
|
// ***********************************************************************
|
||||||
using Funq;
|
using Funq;
|
||||||
using MediaBrowser.Common;
|
using MediaBrowser.Common;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
|
@ -208,6 +221,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||||
/// Format should be: http://127.0.0.1:8080/ or http://127.0.0.1:8080/somevirtual/
|
/// Format should be: http://127.0.0.1:8080/ or http://127.0.0.1:8080/somevirtual/
|
||||||
/// Note: the trailing slash is required! For more info see the
|
/// Note: the trailing slash is required! For more info see the
|
||||||
/// HttpListener.Prefixes property on MSDN.</param>
|
/// HttpListener.Prefixes property on MSDN.</param>
|
||||||
|
/// <exception cref="System.ArgumentNullException">urlBase</exception>
|
||||||
public override void Start(string urlBase)
|
public override void Start(string urlBase)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(urlBase))
|
if (string.IsNullOrEmpty(urlBase))
|
||||||
|
@ -457,6 +471,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||||
/// Logs the response.
|
/// Logs the response.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ctx">The CTX.</param>
|
/// <param name="ctx">The CTX.</param>
|
||||||
|
/// <param name="url">The URL.</param>
|
||||||
|
/// <param name="endPoint">The end point.</param>
|
||||||
private void LogResponse(HttpListenerContext ctx, string url, IPEndPoint endPoint)
|
private void LogResponse(HttpListenerContext ctx, string url, IPEndPoint endPoint)
|
||||||
{
|
{
|
||||||
if (!EnableHttpRequestLogging)
|
if (!EnableHttpRequestLogging)
|
||||||
|
@ -554,9 +570,13 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||||
{
|
{
|
||||||
_restServices.AddRange(services);
|
_restServices.AddRange(services);
|
||||||
|
|
||||||
|
_logger.Info("Calling EndpointHost.ConfigureHost");
|
||||||
EndpointHost.ConfigureHost(this, ServerName, CreateServiceManager());
|
EndpointHost.ConfigureHost(this, ServerName, CreateServiceManager());
|
||||||
|
|
||||||
|
_logger.Info("Registering protobuf as a content type filter");
|
||||||
ContentTypeFilters.Register(ContentType.ProtoBuf, (reqCtx, res, stream) => ProtobufSerializer.SerializeToStream(res, stream), (type, stream) => ProtobufSerializer.DeserializeFromStream(stream, type));
|
ContentTypeFilters.Register(ContentType.ProtoBuf, (reqCtx, res, stream) => ProtobufSerializer.SerializeToStream(res, stream), (type, stream) => ProtobufSerializer.DeserializeFromStream(stream, type));
|
||||||
|
|
||||||
|
_logger.Info("Calling ServiceStack AppHost.Init");
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||||
/// Gets or sets the source stream.
|
/// Gets or sets the source stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The source stream.</value>
|
/// <value>The source stream.</value>
|
||||||
public Stream SourceStream { get; set; }
|
private Stream SourceStream { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _options
|
/// The _options
|
||||||
|
@ -53,6 +53,17 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||||
Options["Content-Type"] = contentType;
|
Options["Content-Type"] = contentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="StreamWriter"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">The source.</param>
|
||||||
|
/// <param name="contentType">Type of the content.</param>
|
||||||
|
/// <param name="logger">The logger.</param>
|
||||||
|
public StreamWriter(byte[] source, string contentType, ILogger logger)
|
||||||
|
: this(new MemoryStream(source), contentType, logger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes to.
|
/// Writes to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -153,6 +153,7 @@ namespace MediaBrowser.Server.Implementations.ServerManager
|
||||||
}
|
}
|
||||||
|
|
||||||
ReloadUdpServer();
|
ReloadUdpServer();
|
||||||
|
|
||||||
ReloadHttpServer();
|
ReloadHttpServer();
|
||||||
|
|
||||||
if (!SupportsNativeWebSocket)
|
if (!SupportsNativeWebSocket)
|
||||||
|
@ -268,6 +269,9 @@ namespace MediaBrowser.Server.Implementations.ServerManager
|
||||||
{
|
{
|
||||||
// The port number can't be in configuration because we don't want it to ever change
|
// The port number can't be in configuration because we don't want it to ever change
|
||||||
UdpServer = _applicationHost.Resolve<IUdpServer>();
|
UdpServer = _applicationHost.Resolve<IUdpServer>();
|
||||||
|
|
||||||
|
_logger.Info("Starting udp server");
|
||||||
|
|
||||||
UdpServer.Start(_kernel.UdpServerPortNumber);
|
UdpServer.Start(_kernel.UdpServerPortNumber);
|
||||||
}
|
}
|
||||||
catch (SocketException ex)
|
catch (SocketException ex)
|
||||||
|
@ -428,6 +432,8 @@ namespace MediaBrowser.Server.Implementations.ServerManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void RegisterServerWithAdministratorAccess()
|
private void RegisterServerWithAdministratorAccess()
|
||||||
{
|
{
|
||||||
|
_logger.Info("Requesting administrative access to authorize http server");
|
||||||
|
|
||||||
// Create a temp file path to extract the bat file to
|
// Create a temp file path to extract the bat file to
|
||||||
var tmpFile = Path.Combine(ConfigurationManager.CommonApplicationPaths.TempDirectory, Guid.NewGuid() + ".bat");
|
var tmpFile = Path.Combine(ConfigurationManager.CommonApplicationPaths.TempDirectory, Guid.NewGuid() + ".bat");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue