From 1ad30ba49d1551a6915b15a787996ed37dcb0883 Mon Sep 17 00:00:00 2001 From: achiez Date: Thu, 17 Jul 2025 22:49:22 +0300 Subject: [PATCH] 1.7.3 Add automatic ack on confirming Trades accordingly to new update --- NebulaAuth.sln | 1 + NebulaAuth/update.xml | 6 +- changelog/1.7.1.html | 8 +- changelog/1.7.2.html | 2 +- changelog/1.7.3.html | 87 +++++++++++++++++++ src/NebulaAuth/App.xaml | 8 +- src/NebulaAuth/Model/MAAC/PortableMaClient.cs | 18 +++- src/NebulaAuth/Model/MaClient.cs | 34 ++++++-- src/NebulaAuth/NebulaAuth.csproj | 4 +- src/NebulaAuth/PlannedChanges.txt | 7 +- .../View/ConfirmationTemplates.xaml | 2 +- src/NebulaAuth/localization.loc.json | 60 ++++++------- .../Api/Mobile/SteamMobileConfirmationsApi.cs | 4 +- src/SteamLibForked/Api/Trade/SteamTradeApi.cs | 27 ++++++ .../Models/Core/Session/SessionData.cs | 2 +- .../Concrete[folder]/PurchaseConfirmation.cs | 3 +- src/SteamLibForked/Web/ClientBuilder.cs | 1 + .../JSON/MobileConfirmationScrapper.cs | 2 +- 18 files changed, 212 insertions(+), 64 deletions(-) create mode 100644 changelog/1.7.3.html create mode 100644 src/SteamLibForked/Api/Trade/SteamTradeApi.cs diff --git a/NebulaAuth.sln b/NebulaAuth.sln index 55d5d79..62c963b 100644 --- a/NebulaAuth.sln +++ b/NebulaAuth.sln @@ -21,6 +21,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "changelog", "changelog", "{ changelog\1.5.6.html = changelog\1.5.6.html changelog\1.7.1.html = changelog\1.7.1.html changelog\1.7.2.html = changelog\1.7.2.html + changelog\1.7.3.html = changelog\1.7.3.html EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamLibForked", "src\SteamLibForked\SteamLibForked.csproj", "{224F9DB0-3D20-A614-BA2A-12F22B13A2C6}" diff --git a/NebulaAuth/update.xml b/NebulaAuth/update.xml index 56c7e6f..fdb4a43 100644 --- a/NebulaAuth/update.xml +++ b/NebulaAuth/update.xml @@ -1,8 +1,8 @@  - 1.7.2.0 - https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/download/1.7.2/NebulaAuth.1.7.2.zip - https://achiez.github.io/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/changelog/1.7.2.html + 1.7.3.0 + https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/download/1.7.3/NebulaAuth.1.7.3.zip + https://achiez.github.io/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/changelog/1.7.3.html false \ No newline at end of file diff --git a/changelog/1.7.1.html b/changelog/1.7.1.html index 9a7fab9..bc7d42d 100644 --- a/changelog/1.7.1.html +++ b/changelog/1.7.1.html @@ -76,10 +76,10 @@ t.me/nebulaauth -
  • UPDATE: Added support for a new confirmation type — Purchase.
  • -
  • UPDATE: Merged Global 1.7.0 updates into the release version (patch notes).
  • -
  • FIX: Fixed a crash occurring during confirmation loading.
  • -
  • ENHANCEMENT: Improved localization and system messages.
  • +
  • UPDATE: Added support for a new confirmation type — Purchase.
  • +
  • UPDATE: Merged Global 1.7.0 updates into the release version (patch notes).
  • +
  • FIX: Fixed a crash occurring during confirmation loading.
  • +
  • ENHANCEMENT: Improved localization and system messages.
  • diff --git a/changelog/1.7.2.html b/changelog/1.7.2.html index b1a3532..80c2bac 100644 --- a/changelog/1.7.2.html +++ b/changelog/1.7.2.html @@ -76,7 +76,7 @@ t.me/nebulaauth -
  • FIX: Crash on loading trade confirmations
  • +
  • FIX: Crash on loading trade confirmations
  • diff --git a/changelog/1.7.3.html b/changelog/1.7.3.html new file mode 100644 index 0000000..58eda7c --- /dev/null +++ b/changelog/1.7.3.html @@ -0,0 +1,87 @@ + + + + + + Changelog + + + + +
    + +
    +
    Version 1.7.3
    +
    17.07.2025
    +
    +
      +
    • + NEWS: Official Telegram group now available! Join us at + + t.me/nebulaauth + +
    • +
    • UPDATE: Added automatic acknowledgment request for sending trade confirmation
    • +
    • FIX: Fixed notifications text in auto-confirm timer
    • +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/src/NebulaAuth/App.xaml b/src/NebulaAuth/App.xaml index e8f7dd6..f33b575 100644 --- a/src/NebulaAuth/App.xaml +++ b/src/NebulaAuth/App.xaml @@ -1,17 +1,13 @@  + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> - + diff --git a/src/NebulaAuth/Model/MAAC/PortableMaClient.cs b/src/NebulaAuth/Model/MAAC/PortableMaClient.cs index 33dd601..5c12e6f 100644 --- a/src/NebulaAuth/Model/MAAC/PortableMaClient.cs +++ b/src/NebulaAuth/Model/MAAC/PortableMaClient.cs @@ -13,6 +13,7 @@ using NebulaAuth.Core; using NebulaAuth.Model.Entities; using NebulaAuth.Utility; using SteamLib.Api.Mobile; +using SteamLib.Api.Trade; using SteamLib.Authentication; using SteamLib.Exceptions.Authorization; using SteamLib.SteamMobile.Confirmations; @@ -90,7 +91,7 @@ public partial class PortableMaClient : ObservableObject, IDisposable var toConfirm = new List(); if (AutoConfirmMarket) { - var market = conf.Where(c => + var market = conf.Where(c => c.ConfType is ConfirmationType.MarketSellTransaction or ConfirmationType.Purchase); toConfirm.AddRange(market); } @@ -107,6 +108,7 @@ public partial class PortableMaClient : ObservableObject, IDisposable Shell.Logger.Debug("Timer {accountName}: Sending confirmations. Count: {count}", Mafile.AccountName, toConfirm.Count); var success = await HandleTimerRequest(() => SendConfirmations(toConfirm)); + //TODO: handle success == false Shell.Logger.Debug("Timer {accountName}: Confirmation sent: {confirmResult}", Mafile.AccountName, success); return toConfirm.Count; } @@ -126,7 +128,19 @@ public partial class PortableMaClient : ObservableObject, IDisposable private async Task SendConfirmations(IEnumerable confirmations) { - return await SteamMobileConfirmationsApi.SendMultipleConfirmations(Client, confirmations, + var conf = confirmations.ToList(); + var res = await SteamMobileConfirmationsApi.SendMultipleConfirmations(Client, conf, + Mafile.SessionData!.SteamId, Mafile, true, _cts.Token); + + if (!res && conf.Any(c => c.ConfType == ConfirmationType.Trade)) + { + Shell.Logger.Warn("Timer {accountName}: Failed to send trade confirmations. Sending ack", + Mafile.AccountName); + await SteamTradeApi.Acknowledge(Client, Mafile.SessionData!.SessionId, _cts.Token); + await Task.Delay(10, _cts.Token); + } + + return await SteamMobileConfirmationsApi.SendMultipleConfirmations(Client, conf, Mafile.SessionData!.SteamId, Mafile, true, _cts.Token); } diff --git a/src/NebulaAuth/Model/MaClient.cs b/src/NebulaAuth/Model/MaClient.cs index 62944ca..3ef0b4d 100644 --- a/src/NebulaAuth/Model/MaClient.cs +++ b/src/NebulaAuth/Model/MaClient.cs @@ -8,6 +8,7 @@ using AchiesUtilities.Web.Proxy; using NebulaAuth.Model.Entities; using SteamLib.Api.Mobile; using SteamLib.Api.Services; +using SteamLib.Api.Trade; using SteamLib.Authentication; using SteamLib.Exceptions.Authorization; using SteamLib.ProtoCore.Services; @@ -78,26 +79,49 @@ public static class MaClient return SessionHandler.RefreshMobileToken(new HttpClientHandlerPair(Client, ClientHandler), mafile); } - public static Task SendConfirmation(Mafile mafile, Confirmation confirmation, bool confirm) + public static async Task SendConfirmation(Mafile mafile, Confirmation confirmation, bool confirm) { ValidateMafile(mafile); SetProxy(mafile); - return SteamMobileConfirmationsApi.SendConfirmation(Client, confirmation, mafile.SessionData!.SteamId, mafile, + var res = await SteamMobileConfirmationsApi.SendConfirmation(Client, confirmation, mafile.SessionData!.SteamId, + mafile, + confirm); + if (!res && confirmation.ConfType == ConfirmationType.Trade) + { + Shell.Logger.Warn("Failed to send trade confirmation for {accountName}. Sending ack", mafile.AccountName); + await SteamTradeApi.Acknowledge(Client, mafile.SessionData.SessionId); + await Task.Delay(10); + } + + return await SteamMobileConfirmationsApi.SendConfirmation(Client, confirmation, mafile.SessionData!.SteamId, + mafile, confirm); } - public static Task SendMultipleConfirmation(Mafile mafile, IEnumerable confirmations, + public static async Task SendMultipleConfirmation(Mafile mafile, IEnumerable confirmations, bool confirm) { var enumerable = confirmations.ToList(); if (enumerable.Count == 0) { - return Task.FromResult(false); + return false; } ValidateMafile(mafile); SetProxy(mafile); - return SteamMobileConfirmationsApi.SendMultipleConfirmations(Client, enumerable, mafile.SessionData!.SteamId, + + var res = await SteamMobileConfirmationsApi.SendMultipleConfirmations(Client, enumerable, + mafile.SessionData!.SteamId, + mafile, confirm); + if (!res && enumerable.Any(c => c.ConfType == ConfirmationType.Trade)) + { + Shell.Logger.Warn("Failed to send trade confirmations for {accountName}. Sending ack", mafile.AccountName); + await SteamTradeApi.Acknowledge(Client, mafile.SessionData.SessionId); + await Task.Delay(10); + } + + return await SteamMobileConfirmationsApi.SendMultipleConfirmations(Client, enumerable, + mafile.SessionData!.SteamId, mafile, confirm); } diff --git a/src/NebulaAuth/NebulaAuth.csproj b/src/NebulaAuth/NebulaAuth.csproj index a87c67f..f5d8543 100644 --- a/src/NebulaAuth/NebulaAuth.csproj +++ b/src/NebulaAuth/NebulaAuth.csproj @@ -10,7 +10,7 @@ en;ru;ua Theme\lock.ico 7.0 - 1.7.2 + 1.7.3 true @@ -36,7 +36,7 @@ - Never + Never Never diff --git a/src/NebulaAuth/PlannedChanges.txt b/src/NebulaAuth/PlannedChanges.txt index a38bff5..98c6856 100644 --- a/src/NebulaAuth/PlannedChanges.txt +++ b/src/NebulaAuth/PlannedChanges.txt @@ -1,10 +1,6 @@ -• Есть люди которым нужна функция просмотра и завершения сессий аккаунта. Скорее всего в следующей версии это будет реализовано -• Сейчас, при наличии новой версии, отображается стандартное окно обновлений из библиотеки. Планируется сделать кастомный дизайн, для соответствия общему стилю. +• Сейчас, при наличии новой версии, отображается стандартное окно обновлений из библиотеки. Планируется сделать кастомный дизайн, для соответствия общему стилю. • В приложении реализованы "совмещённые" подтверждения для торговой площадки. Т.е. при наличии более одного предмета, ожидающего подтверждение, можно либо отменить, либо подтвердить все. В планах добавить расширенный функционал, с возможностью точечного управления. • Добавить кнопку "открыть мафайл" в меню "Файл" по аналогии с открытием папки -• Ускорить появление подсказок в интерфейсе -• Добавить запоминание пароля при привязке мафайла -• Функция переноса гуарда с мобильного устройства на ПК с созданием мафайла • Добавить полное шифрование мафайлов по аналогии с SDA • Сделать автоматический билд и загрузку обновления на Github при изменении в мастер ветке • Антик-окно как в MarketApp, возможность сразу открыть браузер напр. на CefSharp с залогиненым аккаунтом @@ -12,3 +8,4 @@ • Безопасное сохранение мафайлов через .tmp / .bak • Создание механизма накопления ошибок, чтобы исправить Patch Tuesday, условно аккаунт может игнорировать ошибки 1-2 часа (настриавемо) +• Исправить "Перенос гуарда". Иногда не хочет принимать код / подтверждение \ No newline at end of file diff --git a/src/NebulaAuth/View/ConfirmationTemplates.xaml b/src/NebulaAuth/View/ConfirmationTemplates.xaml index 9568309..ad0bad6 100644 --- a/src/NebulaAuth/View/ConfirmationTemplates.xaml +++ b/src/NebulaAuth/View/ConfirmationTemplates.xaml @@ -7,7 +7,7 @@ xmlns:entities="clr-namespace:NebulaAuth.Model.Entities" xmlns:vm="clr-namespace:NebulaAuth.ViewModel"> - + diff --git a/src/NebulaAuth/localization.loc.json b/src/NebulaAuth/localization.loc.json index db25661..9ce7eff 100644 --- a/src/NebulaAuth/localization.loc.json +++ b/src/NebulaAuth/localization.loc.json @@ -260,7 +260,7 @@ "en": "Purchase", "ru": "Покупка", "ua": "Покупка" - } + } }, "CodeCopied": { "ru": "Скопировано", @@ -1286,36 +1286,36 @@ "ru": "Ошибка SMS-кода, попробуйте еще раз", "ua": "Помилка SMS-коду, спробуйте ще раз" } - } - }, - "MAAC": { - "TimerConfirmed": { - "ru": "Авто: подтверждено ", - "en": "Auto: confirmed ", - "ua": "Авто: підтверджено " }, - "TimerNotConfirmed": { - "ru": "Авто: подтверждение не сработало", - "en": "Auto: confirmation was unsuccessful", - "ua": "Авто: підтвердження не спрацювало" - }, - "TimerSessionError": { - "ru": "необходимо обновить сессию или перелогиниться", - "en": "need to refresh session or relogin", - "ua": "необхідно оновити сесію або перелогінитися" - }, - "TimerPrefix": { - "ru": "Авто ", - "en": "Auto ", - "ua": "Авто " - }, - "TimerPreventedOverlap": { - "ru": - "Авто: таймер подтверждений пытался начать новый цикл, когда предыдущий еще не завершился. Советуем увеличить задержку", - "en": - "Auto: confirmation timer tried to start new cycle when previous one was not finished yet. We recommend to increase delay", - "ua": - "Авто: таймер підтверджень намагався запустити новий цикл, коли попередній ще не закінчився. Рекомендуємо збільшити затримку" + "MAAC": { + "TimerConfirmed": { + "ru": "Авто: подтверждено ", + "en": "Auto: confirmed ", + "ua": "Авто: підтверджено " + }, + "TimerNotConfirmed": { + "ru": "Авто: подтверждение не сработало", + "en": "Auto: confirmation was unsuccessful", + "ua": "Авто: підтвердження не спрацювало" + }, + "TimerSessionError": { + "ru": "необходимо обновить сессию или перелогиниться", + "en": "need to refresh session or relogin", + "ua": "необхідно оновити сесію або перелогінитися" + }, + "TimerPrefix": { + "ru": "Авто ", + "en": "Auto ", + "ua": "Авто " + }, + "TimerPreventedOverlap": { + "ru": + "Авто: таймер подтверждений пытался начать новый цикл, когда предыдущий еще не завершился. Советуем увеличить задержку", + "en": + "Auto: confirmation timer tried to start new cycle when previous one was not finished yet. We recommend to increase delay", + "ua": + "Авто: таймер підтверджень намагався запустити новий цикл, коли попередній ще не закінчився. Рекомендуємо збільшити затримку" + } } }, "CantAlignTimeError": { diff --git a/src/SteamLibForked/Api/Mobile/SteamMobileConfirmationsApi.cs b/src/SteamLibForked/Api/Mobile/SteamMobileConfirmationsApi.cs index b02517b..fe84af7 100644 --- a/src/SteamLibForked/Api/Mobile/SteamMobileConfirmationsApi.cs +++ b/src/SteamLibForked/Api/Mobile/SteamMobileConfirmationsApi.cs @@ -72,8 +72,8 @@ public static class SteamMobileConfirmationsApi var op = confirm ? "allow" : "cancel"; var query = GetConfirmationKvp(steamId, data.DeviceId, data.IdentitySecret, op).ToList(); query.Insert(0, new KeyValuePair("op", op)); - - foreach (var confirmation in confirmations) + var list = confirmations.ToList(); + foreach (var confirmation in list) { query.Add(new KeyValuePair("cid[]", confirmation.Id.ToString())); query.Add(new KeyValuePair("ck[]", confirmation.Nonce.ToString())); diff --git a/src/SteamLibForked/Api/Trade/SteamTradeApi.cs b/src/SteamLibForked/Api/Trade/SteamTradeApi.cs new file mode 100644 index 0000000..9a6160c --- /dev/null +++ b/src/SteamLibForked/Api/Trade/SteamTradeApi.cs @@ -0,0 +1,27 @@ +using SteamLib.Core; + +namespace SteamLib.Api.Trade; + +public static class SteamTradeApi +{ + public static async Task Acknowledge(HttpClient client, string sessionId, + CancellationToken cancellationToken = default) + { + var data = new Dictionary + { + {"sessionid", sessionId}, + {"message", "1"} + }; + var req = new HttpRequestMessage(HttpMethod.Post, Routes.ACKNOWLEDGE); + req.Content = new FormUrlEncodedContent(data); + var resp = await client.SendAsync(req, cancellationToken); + var cont = await resp.EnsureSuccessStatusCode().Content.ReadAsStringAsync(cancellationToken); + return cont == "[]"; + //{"success":false} - unauthenticated + } + + public static class Routes + { + public const string ACKNOWLEDGE = SteamConstants.STEAM_COMMUNITY + "//trade/new/acknowledge"; //Not a typo + } +} \ No newline at end of file diff --git a/src/SteamLibForked/Models/Core/Session/SessionData.cs b/src/SteamLibForked/Models/Core/Session/SessionData.cs index 26d44f5..1d060cc 100644 --- a/src/SteamLibForked/Models/Core/Session/SessionData.cs +++ b/src/SteamLibForked/Models/Core/Session/SessionData.cs @@ -21,7 +21,7 @@ public class SessionData : ISessionData public SteamAuthToken RefreshToken { get; } public ConcurrentDictionary Tokens { get; } - + [JsonConstructor] public SessionData(string sessionId, SteamId steamId, SteamAuthToken refreshToken, IDictionary? tokens) diff --git a/src/SteamLibForked/SteamMobile/Confirmations/Concrete[folder]/PurchaseConfirmation.cs b/src/SteamLibForked/SteamMobile/Confirmations/Concrete[folder]/PurchaseConfirmation.cs index 158d1e4..dccc2e2 100644 --- a/src/SteamLibForked/SteamMobile/Confirmations/Concrete[folder]/PurchaseConfirmation.cs +++ b/src/SteamLibForked/SteamMobile/Confirmations/Concrete[folder]/PurchaseConfirmation.cs @@ -2,7 +2,8 @@ public class PurchaseConfirmation : Confirmation { - public PurchaseConfirmation(long id, ulong nonce, int intType, ulong creatorId, string typeName) : base(id, nonce, intType, creatorId, ConfirmationType.Purchase, typeName) + public PurchaseConfirmation(long id, ulong nonce, ulong creatorId, string typeName) : base(id, nonce, 12, creatorId, + ConfirmationType.Purchase, typeName) { } } \ No newline at end of file diff --git a/src/SteamLibForked/Web/ClientBuilder.cs b/src/SteamLibForked/Web/ClientBuilder.cs index ebfdf6e..9118d7a 100644 --- a/src/SteamLibForked/Web/ClientBuilder.cs +++ b/src/SteamLibForked/Web/ClientBuilder.cs @@ -33,6 +33,7 @@ public static class ClientBuilder { container.SetSteamMobileCookiesWithMobileToken(sessionData); } + //Nebula tweak: handler.CookieContainer.InjectWebTradeEligibilityCookie(); ConfigureCommon(handler, client); diff --git a/src/SteamLibForked/Web/Scrappers/JSON/MobileConfirmationScrapper.cs b/src/SteamLibForked/Web/Scrappers/JSON/MobileConfirmationScrapper.cs index da20b34..d1f02b1 100644 --- a/src/SteamLibForked/Web/Scrappers/JSON/MobileConfirmationScrapper.cs +++ b/src/SteamLibForked/Web/Scrappers/JSON/MobileConfirmationScrapper.cs @@ -170,7 +170,7 @@ public static class MobileConfirmationScrapper private static PurchaseConfirmation GetPurchaseConfirmation(ConfirmationJson confirmation) { - return new PurchaseConfirmation(confirmation.Id, confirmation.Nonce, (int) confirmation.Type, + return new PurchaseConfirmation(confirmation.Id, confirmation.Nonce, confirmation.CreatorId, confirmation.TypeName) { Time = confirmation.CreationTime.ToLocalDateTime()