Add Support for Device Generator for Open Actions ...

This commit is contained in:
2025-11-05 05:05:51 +03:30
parent 8f7faffb5d
commit 94cc36d338
2 changed files with 53 additions and 0 deletions
+3
View File
@@ -297,6 +297,9 @@ namespace xIdentityService.Interfaces
//
#region Open Actions ...
//
Task<XDeviceDto> GetDevice();
//
Task<XOpenActionInnerDto> OpenGet(
XOpenActionInnerDto model
+50
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using MongoDB.Bson;
using xCommons.Constants;
@@ -15,6 +16,55 @@ namespace xIdentityService.Providers
{
public partial class XIdentityProvider
{
/// <summary>
/// Prepare API Based Device to Open Actions ...
/// </summary>
/// <returns></returns>
public async Task<XDeviceDto> GetDevice()
{
//
var os = "XSaherElmOS";
bool isOSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
bool isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
if (isOSX)
{
os = "MacOs";
}
else if (isLinux)
{
os = "Linux";
}
else if (isWindows)
{
os = "Windows";
}
var agent = RuntimeInformation.FrameworkDescription;
if (agent.IsNullOrEmpty())
{
agent = "XSaherElmOSAgent";
}
var version = RuntimeInformation.OSArchitecture + ", " + RuntimeInformation.OSDescription;
if (version.IsNullOrEmpty())
{
version = "XSaherElmOSVersion";
}
var browser = "XSaherElmBrowser_" + RevisionSecretKey.ToMd5String();
//
var result = new XDeviceDto
{
Os = os,
Browser = browser,
UserAgent = agent,
OsVersion = version,
DeviceType = XDeviceType.Desktop,
};
//
return result;
}
//
#region OpenGet ...
public async Task<XOpenActionInnerDto> OpenGet(