added check for moonlight app for getting the device

This commit is contained in:
Daniel Balk
2023-06-17 17:51:34 +02:00
parent d5d77ae7da
commit f559f08e8d

View File

@@ -159,8 +159,17 @@ public class IdentityService
try
{
var userAgent = HttpContextAccessor.HttpContext.Request.Headers.UserAgent.ToString();
if (userAgent.Contains("Moonlight.App"))
{
var version = userAgent.Remove(0, "Moonlight.App/".Length).Split(' ').FirstOrDefault();
return "Moonlight App " + version;
}
var uaParser = Parser.GetDefault();
var info = uaParser.Parse(HttpContextAccessor.HttpContext.Request.Headers.UserAgent);
var info = uaParser.Parse(userAgent);
return $"{info.OS} - {info.Device}";
}