This commit is contained in:
snltty
2024-10-08 16:26:23 +08:00
parent 805374b632
commit f5aa996516
3 changed files with 6 additions and 10 deletions

View File

@@ -17,16 +17,12 @@ namespace linker.libs
} }
private static string GetSystemIdLinux() private static string GetSystemIdLinux()
{ {
string cpu = CommandHelper.Linux(string.Empty, ["cat /sys/class/dmi/id/product_uuid"]).TrimNewLineAndWhiteSapce(); string cpu = CommandHelper.Linux(string.Empty, ["cat /etc/machine-id"]).TrimNewLineAndWhiteSapce();
if (string.IsNullOrWhiteSpace(cpu) || cpu.Contains("No such file or directory")) if (string.IsNullOrWhiteSpace(cpu) || cpu.Contains("No such file or directory"))
{ {
cpu = CommandHelper.Linux(string.Empty, ["dmidecode -s system-uuid"]).TrimNewLineAndWhiteSapce(); cpu = string.Empty;
if (string.IsNullOrWhiteSpace(cpu) || cpu.Contains("dmidecode"))
{
LoggerHelper.Instance.Error(cpu);
return string.Empty;
}
} }
string username = CommandHelper.Linux(string.Empty, ["whoami"]).TrimNewLineAndWhiteSapce(); string username = CommandHelper.Linux(string.Empty, ["whoami"]).TrimNewLineAndWhiteSapce();
return $"{cpu}↓{username}↓{System.Runtime.InteropServices.RuntimeInformation.OSDescription}"; return $"{cpu}↓{username}↓{System.Runtime.InteropServices.RuntimeInformation.OSDescription}";
} }
@@ -34,8 +30,7 @@ namespace linker.libs
{ {
string cpu = CommandHelper.Osx(string.Empty, ["system_profiler SPHardwareDataType | grep \"Hardware UUID\""]).TrimNewLineAndWhiteSapce(); string cpu = CommandHelper.Osx(string.Empty, ["system_profiler SPHardwareDataType | grep \"Hardware UUID\""]).TrimNewLineAndWhiteSapce();
string username = CommandHelper.Osx(string.Empty, ["whoami"]).TrimNewLineAndWhiteSapce(); string username = CommandHelper.Osx(string.Empty, ["whoami"]).TrimNewLineAndWhiteSapce();
return $"{cpu.Trim()}↓{username}↓{System.Runtime.InteropServices.RuntimeInformation.OSDescription}"; return $"{cpu}↓{username}↓{System.Runtime.InteropServices.RuntimeInformation.OSDescription}";
} }
} }
} }

View File

@@ -64,6 +64,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="LiteDB" Version="5.0.17" /> <PackageReference Include="LiteDB" Version="5.0.17" />
<PackageReference Include="MemoryPack" Version="1.10.0" /> <PackageReference Include="MemoryPack" Version="1.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0-2.final" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="8.0.0" /> <PackageReference Include="System.ServiceProcess.ServiceController" Version="8.0.0" />
</ItemGroup> </ItemGroup>

View File

@@ -1,5 +1,5 @@
v1.4.8 v1.4.8
2024-10-08 00:20:15 2024-10-08 16:26:23
1. 优化减少信标流量 1. 优化减少信标流量
2. 增加upnp和NAT-PMP自动添加端口映射在无法进路由器时很有用 2. 增加upnp和NAT-PMP自动添加端口映射在无法进路由器时很有用
3. 可选禁用UDP广播可有效减少中继流量消耗 3. 可选禁用UDP广播可有效减少中继流量消耗