From 0df202e397bab18325bd461ee6878fc3908423a8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 4 Nov 2014 17:43:02 -0500 Subject: update connect login --- .../HttpServer/Security/AuthorizationContext.cs | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs') diff --git a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs index 925eb6a86..3cc703bbf 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs @@ -43,6 +43,47 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security token = httpReq.QueryString["api_key"]; } + // Hack until iOS is updated + // TODO: Remove + if (string.IsNullOrWhiteSpace(client)) + { + var userAgent = httpReq.Headers["User-Agent"] ?? string.Empty; + + if (userAgent.IndexOf("mediabrowserios", StringComparison.OrdinalIgnoreCase) != -1 || + userAgent.IndexOf("iphone", StringComparison.OrdinalIgnoreCase) != -1 || + userAgent.IndexOf("ipad", StringComparison.OrdinalIgnoreCase) != -1) + { + client = "iOS"; + } + + else if (userAgent.IndexOf("crKey", StringComparison.OrdinalIgnoreCase) != -1) + { + client = "Chromecast"; + } + } + + // Hack until iOS is updated + // TODO: Remove + if (string.IsNullOrWhiteSpace(device)) + { + var userAgent = httpReq.Headers["User-Agent"] ?? string.Empty; + + if (userAgent.IndexOf("iPhone", StringComparison.OrdinalIgnoreCase) != -1) + { + device = "iPhone"; + } + + else if (userAgent.IndexOf("iPad", StringComparison.OrdinalIgnoreCase) != -1) + { + device = "iPad"; + } + + else if (userAgent.IndexOf("crKey", StringComparison.OrdinalIgnoreCase) != -1) + { + device = "Chromecast"; + } + } + return new AuthorizationInfo { Client = client, -- cgit v1.2.3