This commit is contained in:
Давид Чернопятов
2024-02-01 16:36:49 +02:00
parent e7c9473eb1
commit bbcfe59f01
9 changed files with 59 additions and 21 deletions
+2 -2
View File
@@ -56,7 +56,7 @@ public static class MaClient
{
if (account.SessionData != null)
{
ClientHandler.CookieContainer.SetSteamMobileCookies(account.SessionData);
ClientHandler.CookieContainer.SetSteamMobileCookiesWithMobileToken(account.SessionData);
}
else
{
@@ -116,7 +116,7 @@ public static class MaClient
}
Storage.UpdateMafile(mafile);
ClientHandler.CookieContainer.SetSteamMobileCookies(mafile.SessionData);
ClientHandler.CookieContainer.SetSteamMobileCookiesWithMobileToken(mafile.SessionData);
}
public static Task<bool> SendConfirmation(Mafile mafile, Confirmation confirmation, bool confirm)
+1 -1
View File
@@ -82,7 +82,7 @@ public static class SessionHandler
try
{
await MaClient.RefreshSession(mafile);
SnackbarController.SendSnackbar("Сессия была обновлена автоматически");
SnackbarController.SendSnackbar(LocManager.GetCodeBehindOrDefault("SessionWasRefreshedAutomatically", "SessionHandler", "SessionWasRefreshedAutomatically"));
return true;
}
catch (SessionInvalidException)
+1 -1
View File
@@ -10,7 +10,7 @@
<SatelliteResourceLanguages>en;ru;ua</SatelliteResourceLanguages>
<ApplicationIcon>Theme\nebula lock.ico</ApplicationIcon>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
<AssemblyVersion>1.4.4</AssemblyVersion>
<AssemblyVersion>1.4.5</AssemblyVersion>
</PropertyGroup>
<ItemGroup>
+7 -10
View File
@@ -99,14 +99,12 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<materialDesign:PackIcon VerticalAlignment="Center" Width="20" Height="20" Kind="ShoppingCart" Margin="0,0,10,0"></materialDesign:PackIcon>
<Image Grid.Column="1" VerticalAlignment="Center" DockPanel.Dock="Left" Width="32" Height="32" Source="{Binding ItemImageUri}" Margin="0,0,10,0"></Image>
<Border Grid.Column="1" Background="{DynamicResource MaterialDesignPaper}" MaxHeight="36" HorizontalAlignment="Center" BorderBrush="{DynamicResource PrimaryHueMidBrush}" BorderThickness="0.6" Margin="0,0,10,0">
<Image HorizontalAlignment="Center" VerticalAlignment="Center" MaxWidth="32" MaxHeight="32" Source="{Binding ItemImageUri}" ></Image>
</Border>
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock VerticalAlignment="Center" x:Name="ItemName" theme:FontScaleWindow.ResizeFont="True" TextWrapping="WrapWithOverflow" Text="{Binding ItemName}" >
</TextBlock>
<TextBlock VerticalAlignment="Center" x:Name="ItemName" theme:FontScaleWindow.ResizeFont="True" TextWrapping="WrapWithOverflow" Text="{Binding ItemName}"/>
<TextBlock Grid.Row="1" Foreground="LightGray" Text="{Binding PriceString}">
<TextBlock.FontSize>
<Binding ElementName="ItemName" Path="FontSize" ConverterParameter="0.7">
@@ -166,10 +164,9 @@
</Grid.ColumnDefinitions>
<materialDesign:PackIcon VerticalAlignment="Center" Width="20" Height="20" Kind="ShoppingCartPlus" Margin="0,0,10,0"></materialDesign:PackIcon>
<TextBlock VerticalAlignment="Center" Grid.Column="1">
<Run Text="{Tr MainWindow.ConfirmationTemplates.Market}"/>
<Run Text="{Tr MainWindow.ConfirmationTemplates.Market, IsDynamic=False}"/>
<Run Text="{Binding Confirmations.Count, Mode=OneWay}"/>
<Run> </Run>
<Run Text="{Tr Common.Abbreviations.Count, IsDynamic=False}"/>
<Run Text="{Tr Common.Abbreviations.Count.Items, IsDynamic=False}"/>
</TextBlock>
<TextBlock VerticalAlignment="Center" Grid.Column="2" HorizontalAlignment="Left" Margin="5,0,0,0" Text="{Binding Time, StringFormat=t}"/>
+1 -1
View File
@@ -140,7 +140,7 @@ public partial class LinkAccountVM : ObservableObject, IEmailProvider, IPhoneNum
IsFieldVisible = false;
HintText = string.Empty;
_sessionData = (MobileSessionData)await LoginV2Executor.DoLogin(_loginV2ExecutorOptions, userName, pass);
Handler.CookieContainer.SetSteamMobileCookies(_sessionData);
Handler.CookieContainer.SetSteamMobileCookiesWithMobileToken(_sessionData);
IsEmailCode = true;
}
catch (EResultException ex)
+7
View File
@@ -861,6 +861,13 @@
}
},
"SessionHandler": {
"SessionWasRefreshedAutomatically": {
"ru": "Сессия была обновлена автоматически",
"en": "Session was refreshed automatically",
"ua": "Сесія була оновлена автоматично"
}
},
"ProxyManagerVM": {
"WrongFormatSomeIdsMissing": {
"ru": "Неверный формат. Некоторые прокси не имеют ID",
+3 -3
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.4.4.0</version>
<url>https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/download/1.4.4/NebulaAuth.1.4.4.zip</url>
<changelog>https://achiez.github.io/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/changelog/1.4.4.html</changelog>
<version>1.4.5.0</version>
<url>https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/download/1.4.5/NebulaAuth.1.4.5.zip</url>
<changelog>https://achiez.github.io/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/changelog/1.4.5.html</changelog>
<mandatory>false</mandatory>
</item>
@@ -72,11 +72,45 @@ public static class AdmissionHelper
foreach (var domain in SteamDomains.AllDomains)
{
var token = mobileSession.GetToken(domain);
if (token == null) continue;
if (token == null || token.Value.IsExpired) continue;
AddTokenCookie(container, token.Value);
}
}
/// <summary>
/// Clear and set new session. Not recommended. Uses <see cref="IMobileSessionData.GetMobileToken()"/> for domain <see cref="SteamDomain.Community"/> instead of its own cookie. It's okay to use it only for confirmations. But Market, Trading and other pages won't be authenticated
/// </summary>
public static void SetSteamMobileCookiesWithMobileToken(this CookieContainer container, IMobileSessionData mobileSession,
string setLanguage = "english")
{
container.ClearSteamCookies(setLanguage);
container.AddMinimalMobileCookies();
AddRefreshToken(container, mobileSession.RefreshToken);
var community = SteamDomains.GetDomainUri(SteamDomain.Community);
container.Add(community, new Cookie("steamid", mobileSession.SteamId.Steam64.ToString()));
container.Add(community, new Cookie("sessionid", mobileSession.SessionId));
container.Add(community, new Cookie("Steam_Language", setLanguage));
TransferCommunityCookies(container);
var domainCookieSet = false;
foreach (var domain in SteamDomains.AllDomains)
{
var token = mobileSession.GetToken(domain);
if (token == null || token.Value.IsExpired) continue;
if(domain == SteamDomain.Community )
domainCookieSet = true;
AddTokenCookie(container, token.Value);
}
var mobileToken = mobileSession.GetMobileToken();
if (domainCookieSet == false && mobileToken is {IsExpired: false})
AddTokenCookie(container, SteamDomain.Community, mobileToken.Value);
}
public static void AddMinimalMobileCookies(this CookieContainer container)
{
@@ -146,7 +180,7 @@ public static class AdmissionHelper
}
private static void AddTokenCookie(CookieContainer container, SteamDomain domain, SteamAuthToken token)
{
var domainUri = SteamDomains.GetDomainUri(token.Domain);
var domainUri = SteamDomains.GetDomainUri(domain);
container.Add(domainUri, new Cookie(ACCESS_COOKIE_NAME, token.SignedToken)
{
HttpOnly = true,
+1 -1
View File
@@ -29,7 +29,7 @@ public static class ClientBuilder
}
else
{
container.SetSteamMobileCookies(sessionData);
container.SetSteamMobileCookiesWithMobileToken(sessionData);
}
ConfigureCommon(handler, client);