Changed the fingerprinting code for Kavita+. Optimized System tab to be way faster. (#2140)

This commit is contained in:
Joe Milazzo 2023-07-17 18:33:45 -05:00 committed by GitHub
parent 43cc771838
commit 5f505eaf6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 84 additions and 34 deletions

View file

@ -45,28 +45,7 @@ public static class HashUtil
public static string ServerToken()
{
var seed = new DeviceIdBuilder()
.AddMacAddress()
.AddUserName()
.AddComponent("ProcessorCount", new DeviceIdComponent($"{Environment.ProcessorCount}"))
.AddComponent("OSPlatform", new DeviceIdComponent($"{Environment.OSVersion.Platform}"))
.OnWindows(windows => windows
.AddProcessorId())
.OnLinux(linux =>
{
var osInfo = RunAndCapture("uname", "-a");
if (Regex.IsMatch(osInfo, @"\bUnraid\b"))
{
var cpuModel = RunAndCapture("lscpu", string.Empty);
var match = Regex.Match(cpuModel, @"Model name:\s+(.+)");
linux.AddComponent("CPUModel", new DeviceIdComponent($"{match.Groups[1].Value.Trim()}"));
return;
}
linux.AddMotherboardSerialNumber();
})
.OnMac(mac => mac.AddSystemDriveSerialNumber())
.ToString();
return CalculateCrc(seed);
return AnonymousToken();
}
/// <summary>