Prepared for 1.5.2 release

HOTFIX: Resolved an issue introduced by the September 18, 2024, Steam update, where an error occurred during session refresh due to changes in Steam's response model.
This commit is contained in:
Давид Чернопятов
2024-09-18 14:16:32 +03:00
parent e6ae762d5a
commit 80d7c09b0d
5 changed files with 94 additions and 66 deletions
+42 -49
View File
@@ -1,14 +1,7 @@
using AutoUpdaterDotNET;
using MaterialDesignThemes.Wpf;
using NebulaAuth.Model;
using NebulaAuth.View;
using NebulaAuth.ViewModel.Other;
using System;
using System.IO;
using System.Net;
using System.Windows.Forms;
using System.Windows.Threading;
using Application = System.Windows.Application;
namespace NebulaAuth.Core;
@@ -29,55 +22,55 @@ public static class UpdateManager
}
static UpdateManager()
{
//AutoUpdater.CheckForUpdateEvent += AutoUpdaterOnCheckForUpdateEvent;
//static UpdateManager()
//{
// //AutoUpdater.CheckForUpdateEvent += AutoUpdaterOnCheckForUpdateEvent;
}
//}
private static async void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
{
if (args.Error == null)
{
if (args.IsUpdateAvailable)
{
DialogResult dialogResult;
var dialog = new UpdaterView()
{
DataContext = new UpdaterVM(args)
};
//private static async void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
//{
// if (args.Error == null)
// {
// if (args.IsUpdateAvailable)
// {
// DialogResult dialogResult;
// var dialog = new UpdaterView()
// {
// DataContext = new UpdaterVM(args)
// };
await DialogHost.Show(dialog);
Application.Current.Shutdown();
// await DialogHost.Show(dialog);
// Application.Current.Shutdown();
}
else
{
// }
// else
// {
}
}
else
{
if (args.Error is WebException)
{
// }
// }
// else
// {
// if (args.Error is WebException)
// {
}
else
{
// }
// else
// {
}
}
// }
// }
}
//}
private static void RunUpdate(UpdateInfoEventArgs args)
{
Application.Current.Dispatcher.Invoke(() =>
{
if (AutoUpdater.DownloadUpdate(args))
{
Application.Current.Shutdown();
}
}, DispatcherPriority.ContextIdle);
}
//private static void RunUpdate(UpdateInfoEventArgs args)
//{
// Application.Current.Dispatcher.Invoke(() =>
// {
// if (AutoUpdater.DownloadUpdate(args))
// {
// Application.Current.Shutdown();
// }
// }, DispatcherPriority.ContextIdle);
//}
}
@@ -5,7 +5,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:theme="clr-namespace:NebulaAuth.Theme"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
theme:FontScaleWindow.ResizeFont="True" theme:FontScaleWindow.Scale="1"
Foreground="WhiteSmoke"
Background="{DynamicResource WindowBackground}">
+3 -3
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.5.1.0</version>
<url>https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/download/1.5.1/NebulaAuth.1.5.1.zip</url>
<changelog>https://achiez.github.io/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/changelog/1.5.1.html</changelog>
<version>1.5.2.0</version>
<url>https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/download/1.5.2/NebulaAuth.1.5.2.zip</url>
<changelog>https://achiez.github.io/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/changelog/1.5.2.html</changelog>
<mandatory>false</mandatory>
</item>
+39 -4
View File
@@ -1,9 +1,12 @@
using Newtonsoft.Json;
using AchiesUtilities.Models;
using AchiesUtilities.Newtonsoft.JSON.Converters.Special;
using Newtonsoft.Json;
using SteamLib.Authentication;
using SteamLib.Core;
using SteamLib.Core.Enums;
using SteamLib.Core.StatusCodes;
using SteamLib.Exceptions;
using SteamLib.Exceptions.General;
namespace SteamLib.Api;
@@ -27,7 +30,17 @@ public static class SteamGlobalApi
var cont = new FormUrlEncodedContent(data);
var resp = await client.PostAsync("https://login.steampowered.com/jwt/ajaxrefresh", cont, cancellationToken);
var respStr = await resp.EnsureSuccessStatusCode().Content.ReadAsStringAsync(cancellationToken);
var jwtRefresh = JsonConvert.DeserializeObject<JwtRefreshJson>(respStr);
JwtRefreshJson? jwtRefresh;
try
{
jwtRefresh = JsonConvert.DeserializeObject<JwtRefreshJson>(respStr);
}
catch (Exception ex)
{
throw new UnsupportedResponseException(respStr, ex);
}
if (jwtRefresh?.Success != true)
{
Exception? inner = null;
@@ -52,14 +65,26 @@ public static class SteamGlobalApi
cont = new FormUrlEncodedContent(data);
var update = await client.PostAsync(jwtRefresh.LoginUrl, cont, cancellationToken);
var updateResp = await update.Content.ReadAsStringAsync(cancellationToken);
if (updateResp != "{\"result\":1}")
JwtUpdateJson result;
try
{
result = JsonConvert.DeserializeObject<JwtUpdateJson>(updateResp) ?? throw new NullReferenceException();
}
catch (Exception ex)
{
throw new UnsupportedResponseException(updateResp, ex);
}
var resultStatus = SteamStatusCode.Translate<SteamStatusCode>(result.Result, out _);
if (resultStatus.Equals(SteamStatusCode.Ok) == false)
{
throw new SessionInvalidException(
"AjaxRefresh (set-token) response was not successful. Response string stored in Exception.Data")
{
Data = {{"Response", updateResp}}
Data = { { "Response", updateResp } }
};
}
return SteamTokenHelper.ExtractJwtFromSetCookiesHeader(update.Headers);
}
@@ -74,5 +99,15 @@ public static class SteamGlobalApi
[JsonProperty("auth")] public string Auth { get; set; } = string.Empty;
[JsonProperty("error")] public int? Error { get; set; }
}
private class JwtUpdateJson
{
[JsonProperty("result")]
public int Result { get; set; }
[JsonProperty("rtExpiry")]
[JsonConverter(typeof(UnixTimeStampConverter))]
public UnixTimeStamp RtExpiry { get; set; }
}
}
+10 -9
View File
@@ -67,16 +67,17 @@
<!-- Changelog entry -->
<div class="change">
<div class="version">Version 1.5.2</div>
<div class="date">DATE</div>
<div class="date">18.09.2024</div>
<div class="description">
- FIX: Potentially fixed problem with memory-leak on some devices (Windows 10, 11 Home/Professional)<br />
- FIX: Small performance improvements<br />
- UI: Added splash screen on application start <br/>
- UI: Added "Copy Login" in context menu of account on right-click. <br/>
- UI: Small localization update <br/>
- UI: Added tooltip to "Use Indicator" setting <br/>
- UI: Small design improvements <br/>
- UPDATE: most of the libraries were updated to the last version<br />
- HOTFIX: Resolved an issue introduced by the September 18, 2024, Steam update, where an error occurred during session refresh due to changes in Steam's response model.<br />
- FIX: Potentially resolved a memory leak issue on some devices (Windows 10, 11 Home/Professional).<br />
- FIX: Minor performance improvements.<br />
- UI: Added a splash screen on application startup.<br />
- UI: Added "Copy Login" option in the account context menu on right-click.<br />
- UI: Minor localization updates.<br />
- UI: Added a tooltip to the "Use Indicator" setting.<br />
- UI: Minor design improvements.<br />
- UPDATE: Most libraries have been updated to their latest versions.
</div>
</div>
</div>