aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-09-01 16:22:51 -0400
committerGitHub <noreply@github.com>2016-09-01 16:22:51 -0400
commite617e218bd6ce92f63e5105161d3cdd922249d57 (patch)
treee5861873690ba3adc52acb745c2edaa2377b7dc4 /MediaBrowser.Server.Implementations
parentf56d3a077ab3b30e6f88dee9277d51f0a4f84dc0 (diff)
parent2f67a007cd30596fa1559852de23134d2194a23a (diff)
Merge pull request #2133 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Server.Implementations')
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs27
-rw-r--r--MediaBrowser.Server.Implementations/Library/UserViewManager.cs4
2 files changed, 21 insertions, 10 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs
index 28b7824c8..8e46f8f03 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -102,14 +102,14 @@ namespace MediaBrowser.Server.Implementations.HttpServer
// new SessionAuthProvider(_containerAdapter.Resolve<ISessionContext>()),
//}));
- PreRequestFilters.Add((httpReq, httpRes) =>
- {
- //Handles Request and closes Responses after emitting global HTTP Headers
- if (string.Equals(httpReq.Verb, "OPTIONS", StringComparison.OrdinalIgnoreCase))
- {
- httpRes.EndRequest(); //add a 'using ServiceStack;'
- }
- });
+ //PreRequestFilters.Add((httpReq, httpRes) =>
+ //{
+ // //Handles Request and closes Responses after emitting global HTTP Headers
+ // if (string.Equals(httpReq.Verb, "OPTIONS", StringComparison.OrdinalIgnoreCase))
+ // {
+ // httpRes.EndRequest(); //add a 'using ServiceStack;'
+ // }
+ //});
HostContext.GlobalResponseFilters.Add(new ResponseFilter(_logger).FilterResponse);
}
@@ -403,6 +403,17 @@ namespace MediaBrowser.Server.Implementations.HttpServer
return;
}
+ if (string.Equals(httpReq.Verb, "OPTIONS", StringComparison.OrdinalIgnoreCase))
+ {
+ httpRes.StatusCode = 200;
+ httpRes.AddHeader("Access-Control-Allow-Origin", "*");
+ httpRes.AddHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
+ httpRes.AddHeader("Access-Control-Allow-Headers", "Content-Type, Authorization, Range, X-MediaBrowser-Token, X-Emby-Authorization");
+ httpRes.ContentType = "text/html";
+
+ httpRes.Close();
+ }
+
var operationName = httpReq.OperationName;
var localPath = url.LocalPath;
diff --git a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
index 5fffa3d1f..2cbee7c97 100644
--- a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
@@ -120,8 +120,8 @@ namespace MediaBrowser.Server.Implementations.Library
}, cancellationToken).ConfigureAwait(false);
var channels = channelResult.Items;
-
- if (user.Configuration.EnableChannelView && channels.Length > 0)
+
+ if (_config.Configuration.EnableChannelView && channels.Length > 0)
{
list.Add(await _channelManager.GetInternalChannelFolder(cancellationToken).ConfigureAwait(false));
}