Merge pull request #5666 from duplicati/feature/report-package-type-id

Added package type ids when sending usage reports to track individual…
This commit is contained in:
Kenneth Skovhede
2024-11-14 11:12:24 +01:00
committed by GitHub
2 changed files with 15 additions and 1 deletions
@@ -338,6 +338,7 @@ namespace Duplicati.Library.AutoUpdater
request.Headers.Add(System.Net.HttpRequestHeader.UserAgent.ToString(), string.Format("{0} v{1}{2}", APPNAME, SelfVersion.Version, string.IsNullOrWhiteSpace(InstallID) ? "" : " -" + InstallID));
request.Headers.Add("X-Install-ID", InstallID);
request.Headers.Add("X-Package-Type-ID", PackageTypeId);
using var timeoutToken = new CancellationTokenSource();
timeoutToken.CancelAfter(TimeSpan.FromSeconds(SHORT_OPERATION_TIMEOUT_SECONDS));
+14 -1
View File
@@ -38,6 +38,7 @@ namespace Duplicati.Library.UsageReporter
private static string Cached_AppName;
private static string Cached_AppVersion;
private static string Cached_Assembly;
private static string Cached_PackageTypeId;
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static void DoInitUID()
@@ -49,7 +50,7 @@ namespace Duplicati.Library.UsageReporter
private static void DoInitOS()
{
if (OperatingSystem.IsMacOS())
Cached_OSType = "OSX";
Cached_OSType = "MacOS";
else if (OperatingSystem.IsLinux())
Cached_OSType = "Linux";
else if (OperatingSystem.IsWindows())
@@ -60,6 +61,12 @@ namespace Duplicati.Library.UsageReporter
Cached_OSVersion = OSInfoHelper.PlatformString;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static void DoInitPackageType()
{
Cached_PackageTypeId = Library.AutoUpdater.UpdaterManager.PackageTypeId;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static void DoInitCLR()
{
@@ -90,6 +97,9 @@ namespace Duplicati.Library.UsageReporter
try { DoInitOS(); }
catch { }
try { DoInitPackageType(); }
catch { }
try { DoInitCLR(); }
catch { }
@@ -109,6 +119,8 @@ namespace Duplicati.Library.UsageReporter
public string OSVersion { get; set; }
[JsonProperty("clrversion")]
public string CLRVersion { get; set; }
[JsonProperty("pkgid")]
public string PackageTypeId { get; set; }
[JsonProperty("appname")]
public string AppName { get; set; }
[JsonProperty("appversion")]
@@ -126,6 +138,7 @@ namespace Duplicati.Library.UsageReporter
this.OSType = Cached_OSType;
this.OSVersion = Cached_OSVersion;
this.CLRVersion = Cached_CLRVersion;
this.PackageTypeId = Cached_PackageTypeId;
this.AppName = Cached_AppName;
this.AppVersion = Cached_AppVersion;
this.Assembly = Cached_Assembly;