mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-15 02:33:33 +01:00
copy dashboard to the output folder and load from the file system, instead of using embedded resources
This commit is contained in:
@@ -63,9 +63,32 @@ namespace MediaBrowser.Api
|
||||
public static Dictionary<string, string> GetAuthorization(IHttpRequest httpReq)
|
||||
{
|
||||
var auth = httpReq.Headers[HttpHeaders.Authorization];
|
||||
if (auth == null) return null;
|
||||
|
||||
var parts = auth.Split(' ');
|
||||
return GetAuthorization(auth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the authorization.
|
||||
/// </summary>
|
||||
/// <param name="httpReq">The HTTP req.</param>
|
||||
/// <returns>Dictionary{System.StringSystem.String}.</returns>
|
||||
public static Dictionary<string, string> GetAuthorization(IRequestContext httpReq)
|
||||
{
|
||||
var auth = httpReq.GetHeader("Authorization");
|
||||
|
||||
return GetAuthorization(auth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the authorization.
|
||||
/// </summary>
|
||||
/// <param name="authorizationHeader">The authorization header.</param>
|
||||
/// <returns>Dictionary{System.StringSystem.String}.</returns>
|
||||
private static Dictionary<string, string> GetAuthorization(string authorizationHeader)
|
||||
{
|
||||
if (authorizationHeader == null) return null;
|
||||
|
||||
var parts = authorizationHeader.Split(' ');
|
||||
|
||||
// There should be at least to parts
|
||||
if (parts.Length < 2) return null;
|
||||
@@ -77,8 +100,8 @@ namespace MediaBrowser.Api
|
||||
}
|
||||
|
||||
// Remove uptil the first space
|
||||
auth = auth.Substring(auth.IndexOf(' '));
|
||||
parts = auth.Split(',');
|
||||
authorizationHeader = authorizationHeader.Substring(authorizationHeader.IndexOf(' '));
|
||||
parts = authorizationHeader.Split(',');
|
||||
|
||||
var result = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
|
||||
@@ -250,14 +250,14 @@ namespace MediaBrowser.Api.Images
|
||||
/// <param name="request">The request.</param>
|
||||
public void Post(PostUserImage request)
|
||||
{
|
||||
var pathInfo = PathInfo.Parse(Request.PathInfo);
|
||||
var pathInfo = PathInfo.Parse(RequestContext.PathInfo);
|
||||
var id = new Guid(pathInfo.GetArgumentValue<string>(1));
|
||||
|
||||
request.Type = (ImageType)Enum.Parse(typeof(ImageType), pathInfo.GetArgumentValue<string>(3), true);
|
||||
|
||||
var item = _userManager.Users.First(i => i.Id == id);
|
||||
|
||||
var task = PostImage(item, request.RequestStream, request.Type, Request.ContentType);
|
||||
var task = PostImage(item, request.RequestStream, request.Type, RequestContext.ContentType);
|
||||
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
@@ -624,7 +624,7 @@ namespace MediaBrowser.Api.Playback
|
||||
|
||||
var media = (IHasMediaStreams)item;
|
||||
|
||||
var url = Request.PathInfo;
|
||||
var url = RequestContext.PathInfo;
|
||||
|
||||
if (!request.AudioCodec.HasValue)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
|
||||
public object Get(GetHlsAudioSegment request)
|
||||
{
|
||||
var file = SegmentFilePrefix + request.SegmentId + Path.GetExtension(Request.PathInfo);
|
||||
var file = SegmentFilePrefix + request.SegmentId + Path.GetExtension(RequestContext.PathInfo);
|
||||
|
||||
file = Path.Combine(ApplicationPaths.EncodedMediaCachePath, file);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
|
||||
public object Get(GetHlsVideoSegment request)
|
||||
{
|
||||
var file = SegmentFilePrefix + request.SegmentId + Path.GetExtension(Request.PathInfo);
|
||||
var file = SegmentFilePrefix + request.SegmentId + Path.GetExtension(RequestContext.PathInfo);
|
||||
|
||||
file = Path.Combine(ApplicationPaths.EncodedMediaCachePath, file);
|
||||
|
||||
|
||||
@@ -87,15 +87,15 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||
/// </summary>
|
||||
private bool AddDlnaHeaders(StreamState state)
|
||||
{
|
||||
var headers = Request.Headers;
|
||||
var timeSeek = RequestContext.GetHeader("TimeSeekRange.dlna.org");
|
||||
|
||||
if (!string.IsNullOrEmpty(headers["TimeSeekRange.dlna.org"]))
|
||||
if (!string.IsNullOrEmpty(timeSeek))
|
||||
{
|
||||
Response.StatusCode = 406;
|
||||
return false;
|
||||
}
|
||||
|
||||
var transferMode = headers["transferMode.dlna.org"];
|
||||
var transferMode = RequestContext.GetHeader("transferMode.dlna.org");
|
||||
Response.AddHeader("transferMode.dlna.org", string.IsNullOrEmpty(transferMode) ? "Streaming" : transferMode);
|
||||
|
||||
var contentFeatures = string.Empty;
|
||||
|
||||
@@ -252,7 +252,7 @@ namespace MediaBrowser.Api
|
||||
{
|
||||
// We need to parse this manually because we told service stack not to with IRequiresRequestStream
|
||||
// https://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Text/ServiceStack.Text/Controller/PathInfo.cs
|
||||
var pathInfo = PathInfo.Parse(Request.PathInfo);
|
||||
var pathInfo = PathInfo.Parse(RequestContext.PathInfo);
|
||||
var id = new Guid(pathInfo.GetArgumentValue<string>(1));
|
||||
|
||||
var plugin = _appHost.Plugins.First(p => p.Id == id);
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||
{
|
||||
// We need to parse this manually because we told service stack not to with IRequiresRequestStream
|
||||
// https://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Text/ServiceStack.Text/Controller/PathInfo.cs
|
||||
var pathInfo = PathInfo.Parse(Request.PathInfo);
|
||||
var pathInfo = PathInfo.Parse(RequestContext.PathInfo);
|
||||
var id = new Guid(pathInfo.GetArgumentValue<string>(1));
|
||||
|
||||
var task = TaskManager.ScheduledTasks.FirstOrDefault(i => i.Id == id);
|
||||
|
||||
@@ -474,7 +474,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
{
|
||||
// We need to parse this manually because we told service stack not to with IRequiresRequestStream
|
||||
// https://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Text/ServiceStack.Text/Controller/PathInfo.cs
|
||||
var pathInfo = PathInfo.Parse(Request.PathInfo);
|
||||
var pathInfo = PathInfo.Parse(RequestContext.PathInfo);
|
||||
var userId = new Guid(pathInfo.GetArgumentValue<string>(1));
|
||||
var itemId = pathInfo.GetArgumentValue<string>(3);
|
||||
|
||||
@@ -595,7 +595,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
|
||||
var item = DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager, user.Id);
|
||||
|
||||
var auth = RequestFilterAttribute.GetAuthorization(Request);
|
||||
var auth = RequestFilterAttribute.GetAuthorization(RequestContext);
|
||||
|
||||
if (auth != null)
|
||||
{
|
||||
@@ -613,7 +613,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
|
||||
var item = DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager, user.Id);
|
||||
|
||||
var auth = RequestFilterAttribute.GetAuthorization(Request);
|
||||
var auth = RequestFilterAttribute.GetAuthorization(RequestContext);
|
||||
|
||||
if (auth != null)
|
||||
{
|
||||
@@ -633,7 +633,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
|
||||
var item = DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager, user.Id);
|
||||
|
||||
var auth = RequestFilterAttribute.GetAuthorization(Request);
|
||||
var auth = RequestFilterAttribute.GetAuthorization(RequestContext);
|
||||
|
||||
if (auth != null)
|
||||
{
|
||||
|
||||
@@ -274,7 +274,7 @@ namespace MediaBrowser.Api
|
||||
{
|
||||
// We need to parse this manually because we told service stack not to with IRequiresRequestStream
|
||||
// https://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Text/ServiceStack.Text/Controller/PathInfo.cs
|
||||
var pathInfo = PathInfo.Parse(Request.PathInfo);
|
||||
var pathInfo = PathInfo.Parse(RequestContext.PathInfo);
|
||||
var id = new Guid(pathInfo.GetArgumentValue<string>(1));
|
||||
|
||||
var dtoUser = request;
|
||||
|
||||
Reference in New Issue
Block a user