mirror of
https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies.git
synced 2026-07-25 14:24:32 +00:00
8ff960189e
- Update: Added "Copy Password" to Mafile context menu (if available) - Update: "Save Password" now pre-fills the current password in the "Login Again" dialog when encryption is enabled - Fix: Prevented overlapping confirmation cycles in AutoConfirmer - Fix: Added a Snackbar notification when a confirmation cycle is skipped due to a too frequent timer interval - Fix: Fixed a rare bug where the previous proxy was used instead of the current one during session refresh - Fix: Corrected "Session Permanently Expired" message showing on unrelated errors (e.g. network issues) - UI-Fix: Fixed visual glitch where proxy input appeared non-empty when switching to a mafile-specific proxy - Cleanup: Refactored and cleaned up codebase, improved styling and formatting via ReSharper
55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
using System.Net;
|
|
using System.Net.Http.Headers;
|
|
using AchiesUtilities.Web.Models;
|
|
using SteamLib.Authentication;
|
|
using SteamLib.Core.Interfaces;
|
|
|
|
namespace SteamLib.Web;
|
|
|
|
public static class ClientBuilder
|
|
{
|
|
public static HttpClientHandlerPair BuildMobileClient(IWebProxy? proxy, IMobileSessionData? sessionData,
|
|
bool disposeHandler = true)
|
|
{
|
|
sessionData?.EnsureValidated();
|
|
var handler = new HttpClientHandler();
|
|
var client = new HttpClient(handler, disposeHandler);
|
|
|
|
client.DefaultRequestHeaders.Accept.ParseAdd(
|
|
"application/json, text/javascript, text/html, application/xml, text/xml, */*");
|
|
client.DefaultRequestHeaders.UserAgent.ParseAdd("okhttp/3.12.12");
|
|
|
|
if (proxy != null)
|
|
{
|
|
handler.Proxy = proxy;
|
|
}
|
|
|
|
var container = handler.CookieContainer;
|
|
if (sessionData == null)
|
|
{
|
|
container.ClearMobileSessionCookies();
|
|
}
|
|
else
|
|
{
|
|
container.SetSteamMobileCookiesWithMobileToken(sessionData);
|
|
}
|
|
|
|
ConfigureCommon(handler, client);
|
|
return new HttpClientHandlerPair(client, handler);
|
|
}
|
|
|
|
|
|
private static void ConfigureCommon(HttpClientHandler handler, HttpClient client)
|
|
{
|
|
ConfigureCommonClient(client);
|
|
handler.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
|
|
}
|
|
|
|
private static void ConfigureCommonClient(HttpClient client)
|
|
{
|
|
client.Timeout = TimeSpan.FromSeconds(50);
|
|
client.DefaultRequestHeaders.Referrer = new Uri("https://steamcommunity.com");
|
|
client.DefaultRequestHeaders.Add("Origin", "https://steamcommunity.com");
|
|
client.DefaultRequestHeaders.AcceptLanguage.Add(new StringWithQualityHeaderValue("en-US"));
|
|
}
|
|
} |