Include project link in default user-agent

This commit is contained in:
JustArchi
2018-07-28 05:17:52 +02:00
parent 16d002f99b
commit 37d58b78a0
2 changed files with 5 additions and 3 deletions

View File

@@ -43,6 +43,7 @@ namespace ArchiSteamFarm {
internal const string KeysUsedExtension = ".used";
internal const string LogFile = "log.txt";
internal const string MobileAuthenticatorExtension = ".maFile";
internal const string ProjectURL = "https://github.com/" + GithubRepo;
internal const string SentryHashExtension = ".bin";
internal const string StatisticsServer = "asf.justarchi.net";
internal const string UlongCompatibilityStringPrefix = "s_";
@@ -87,4 +88,4 @@ namespace ArchiSteamFarm {
internal static bool IsCustomBuild => Variant == SourceVariant;
}
}
}
}

View File

@@ -63,7 +63,8 @@ namespace ArchiSteamFarm {
HttpClient = new HttpClient(httpClientHandler) { Timeout = TimeSpan.FromSeconds(extendedTimeout ? ExtendedTimeoutMultiplier * Program.GlobalConfig.ConnectionTimeout : Program.GlobalConfig.ConnectionTimeout) };
// Most web services expect that UserAgent is set, so we declare it globally
HttpClient.DefaultRequestHeaders.UserAgent.ParseAdd(SharedInfo.PublicIdentifier + "/" + SharedInfo.Version);
// 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 + ")");
}
public void Dispose() => HttpClient.Dispose();
@@ -549,4 +550,4 @@ namespace ArchiSteamFarm {
}
}
}
}
}