diff options
Diffstat (limited to 'MediaBrowser.Api')
| -rw-r--r-- | MediaBrowser.Api/AuthorizationRequestFilterAttribute.cs | 25 | ||||
| -rw-r--r-- | MediaBrowser.Api/Playback/BaseStreamingService.cs | 8 | ||||
| -rw-r--r-- | MediaBrowser.Api/WebSocket/LogFileWebSocketListener.cs | 6 |
3 files changed, 25 insertions, 14 deletions
diff --git a/MediaBrowser.Api/AuthorizationRequestFilterAttribute.cs b/MediaBrowser.Api/AuthorizationRequestFilterAttribute.cs index 6cecbd0b6..6c56083cb 100644 --- a/MediaBrowser.Api/AuthorizationRequestFilterAttribute.cs +++ b/MediaBrowser.Api/AuthorizationRequestFilterAttribute.cs @@ -98,17 +98,20 @@ namespace MediaBrowser.Api { var auth = GetAuthorizationDictionary(httpReq); - string userId; - string deviceId; - string device; - string client; - string version; - - auth.TryGetValue("UserId", out userId); - auth.TryGetValue("DeviceId", out deviceId); - auth.TryGetValue("Device", out device); - auth.TryGetValue("Client", out client); - auth.TryGetValue("Version", out version); + string userId = null; + string deviceId = null; + string device = null; + string client = null; + string version = null; + + if (auth != null) + { + auth.TryGetValue("UserId", out userId); + auth.TryGetValue("DeviceId", out deviceId); + auth.TryGetValue("Device", out device); + auth.TryGetValue("Client", out client); + auth.TryGetValue("Version", out version); + } return new AuthorizationInfo { diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index f872b7274..394ca69d5 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -1007,6 +1007,13 @@ namespace MediaBrowser.Api.Playback throw new InvalidOperationException("You asked for a debug error, you got one."); } + var user = AuthorizationRequestFilterAttribute.GetCurrentUser(Request, UserManager); + + if (user != null && !user.Configuration.EnableMediaPlayback) + { + throw new ArgumentException(string.Format("{0} is not allowed to play media.", user.Name)); + } + var url = Request.PathInfo; if (!request.AudioCodec.HasValue) @@ -1060,6 +1067,7 @@ namespace MediaBrowser.Api.Playback //state.RunTimeTicks = recording.RunTimeTicks; state.ReadInputAtNativeFramerate = recording.RecordingInfo.Status == RecordingStatus.InProgress; + state.SendInputOverStandardInput = recording.RecordingInfo.Status == RecordingStatus.InProgress; state.AudioSync = 1000; state.DeInterlace = true; } diff --git a/MediaBrowser.Api/WebSocket/LogFileWebSocketListener.cs b/MediaBrowser.Api/WebSocket/LogFileWebSocketListener.cs index eae232f11..4193cc797 100644 --- a/MediaBrowser.Api/WebSocket/LogFileWebSocketListener.cs +++ b/MediaBrowser.Api/WebSocket/LogFileWebSocketListener.cs @@ -111,9 +111,9 @@ namespace MediaBrowser.Api.WebSocket { var line = await reader.ReadLineAsync().ConfigureAwait(false); - if (line.IndexOf(", Info,", StringComparison.OrdinalIgnoreCase) != -1 || - line.IndexOf(", Warn,", StringComparison.OrdinalIgnoreCase) != -1 || - line.IndexOf(", Error,", StringComparison.OrdinalIgnoreCase) != -1) + if (line.IndexOf("Info", StringComparison.OrdinalIgnoreCase) != -1 || + line.IndexOf("Warn", StringComparison.OrdinalIgnoreCase) != -1 || + line.IndexOf("Error", StringComparison.OrdinalIgnoreCase) != -1) { lines.Add(line); } |
