Include GUID in user-agent

This commit is contained in:
JustArchi 2018-12-08 17:51:32 +01:00
parent 9bfd26a3d8
commit 4b226b8569
2 changed files with 2 additions and 1 deletions

View file

@ -55,6 +55,7 @@ namespace ArchiSteamFarm {
internal static string HomeDirectory => Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
internal static Guid ModuleVersion => Assembly.GetEntryAssembly().ManifestModule.ModuleVersionId;
internal static string PrivateIdentifier => PublicIdentifier + "-" + (Program.GlobalDatabase?.Guid.ToString("N") ?? Guid.NewGuid().ToString("N"));
internal static string PublicIdentifier => AssemblyName + (BuildInfo.IsCustomBuild ? "-custom" : "");
internal static Version Version => Assembly.GetEntryAssembly().GetName().Version;

View file

@ -65,7 +65,7 @@ namespace ArchiSteamFarm {
// Most web services expect that UserAgent is set, so we declare it globally
// If you by any chance came here with a very "clever" idea of changing default ASF user-agent then here is a very good advice from me: don't, for your own safety - you've been warned
HttpClient.DefaultRequestHeaders.UserAgent.ParseAdd(SharedInfo.PublicIdentifier + "/" + SharedInfo.Version + " (+" + SharedInfo.ProjectURL + ")");
HttpClient.DefaultRequestHeaders.UserAgent.ParseAdd(SharedInfo.PrivateIdentifier + "/" + SharedInfo.Version + " (+" + SharedInfo.ProjectURL + ")");
}
public void Dispose() => HttpClient.Dispose();