|
@@ -11,6 +11,7 @@ using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Net.Http;
|
|
|
using System.Reflection;
|
|
|
+using System.Runtime.InteropServices;
|
|
|
using System.Text;
|
|
|
using System.Text.Json;
|
|
|
using System.Text.RegularExpressions;
|
|
@@ -228,9 +229,22 @@ namespace TEAMModelOS.Controllers
|
|
|
IpPort = "127.0.0.1";
|
|
|
}
|
|
|
string ip = IpPort.Split(":")[0];
|
|
|
+ string os = "";
|
|
|
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
|
+ {//Linux
|
|
|
+ os = "Linux";
|
|
|
+ }
|
|
|
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
|
+ {//Windows
|
|
|
+ os = "Windows";
|
|
|
+ }
|
|
|
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|
|
+ {//OSX
|
|
|
+ os = "OSX";
|
|
|
+ }
|
|
|
string region = await _searcher.SearchIpAsync(ip);
|
|
|
|
|
|
- return Ok(new { version, description, nowtime, region, ip });
|
|
|
+ return Ok(new { os, version, description, nowtime, region, ip });
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 网页截图参数
|
|
@@ -258,6 +272,13 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
Directory.CreateDirectory(dir);
|
|
|
}
|
|
|
+ var bfOptions = new BrowserFetcherOptions();
|
|
|
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
|
+ {
|
|
|
+ bfOptions.Path = Path.GetTempPath();
|
|
|
+ }
|
|
|
+ var bf = new BrowserFetcher(bfOptions);
|
|
|
+
|
|
|
await new BrowserFetcher().DownloadAsync("970485");
|
|
|
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
|
|
|
{
|