mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-05 00:20:08 +00:00
Update dependency SteamKit2 to v2.5.0-Beta.2 (#3056)
* Update dependency SteamKit2 to v2.5.0-Beta.2 * Fix breaking changes --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Archi <JustArchi@JustArchi.net>
This commit is contained in:
@@ -63,7 +63,6 @@ public static class SharedInfo {
|
||||
internal const string MobileAuthenticatorExtension = ".maFile";
|
||||
internal const string PluginsDirectory = "plugins";
|
||||
internal const string ProjectURL = $"https://github.com/{GithubRepo}";
|
||||
internal const string SentryHashExtension = ".bin";
|
||||
internal const ushort ShortInformationDelay = InformationDelay / 2;
|
||||
internal const string UlongCompatibilityStringPrefix = "s_";
|
||||
internal const string UpdateDirectory = "_old";
|
||||
|
||||
@@ -31,7 +31,6 @@ using System.IdentityModel.Tokens.Jwt;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -349,7 +348,6 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
|
||||
CallbackManager.Subscribe<SteamUser.LoggedOffCallback>(OnLoggedOff);
|
||||
CallbackManager.Subscribe<SteamUser.LoggedOnCallback>(OnLoggedOn);
|
||||
CallbackManager.Subscribe<SteamUser.PlayingSessionStateCallback>(OnPlayingSessionState);
|
||||
CallbackManager.Subscribe<SteamUser.UpdateMachineAuthCallback>(OnMachineAuth);
|
||||
CallbackManager.Subscribe<SteamUser.VanityURLChangedCallback>(OnVanityURLChangedCallback);
|
||||
|
||||
CallbackManager.Subscribe<SharedLibraryLockStatusCallback>(OnSharedLibraryLockStatus);
|
||||
@@ -636,7 +634,6 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
|
||||
EFileType.KeysToRedeemUnused => $"{botPath}{SharedInfo.KeysExtension}{SharedInfo.KeysUnusedExtension}",
|
||||
EFileType.KeysToRedeemUsed => $"{botPath}{SharedInfo.KeysExtension}{SharedInfo.KeysUsedExtension}",
|
||||
EFileType.MobileAuthenticator => $"{botPath}{SharedInfo.MobileAuthenticatorExtension}",
|
||||
EFileType.SentryFile => $"{botPath}{SharedInfo.SentryHashExtension}",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(fileType))
|
||||
};
|
||||
}
|
||||
@@ -2585,31 +2582,6 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
|
||||
return;
|
||||
}
|
||||
|
||||
string sentryFilePath = GetFilePath(EFileType.SentryFile);
|
||||
|
||||
if (string.IsNullOrEmpty(sentryFilePath)) {
|
||||
ArchiLogger.LogNullError(sentryFilePath);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
byte[]? sentryFileHash = null;
|
||||
|
||||
if (File.Exists(sentryFilePath)) {
|
||||
try {
|
||||
byte[] sentryFileContent = await File.ReadAllBytesAsync(sentryFilePath).ConfigureAwait(false);
|
||||
sentryFileHash = CryptoHelper.SHAHash(sentryFileContent);
|
||||
} catch (Exception e) {
|
||||
ArchiLogger.LogGenericException(e);
|
||||
|
||||
try {
|
||||
File.Delete(sentryFilePath);
|
||||
} catch {
|
||||
// Ignored, we can only try to delete faulted file at best
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!await InitLoginAndPassword(string.IsNullOrEmpty(RefreshToken)).ConfigureAwait(false)) {
|
||||
Stop();
|
||||
|
||||
@@ -2698,7 +2670,6 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
|
||||
AccessToken = RefreshToken,
|
||||
CellID = ASF.GlobalDatabase?.CellID,
|
||||
LoginID = LoginID,
|
||||
SentryFileHash = sentryFileHash,
|
||||
ShouldRememberPassword = BotConfig.UseLoginKeys,
|
||||
Username = username
|
||||
};
|
||||
@@ -3250,67 +3221,6 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
|
||||
await PluginsCore.OnBotLoggedOn(this).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnMachineAuth(SteamUser.UpdateMachineAuthCallback callback) {
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
string sentryFilePath = GetFilePath(EFileType.SentryFile);
|
||||
|
||||
if (string.IsNullOrEmpty(sentryFilePath)) {
|
||||
ArchiLogger.LogNullError(sentryFilePath);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
long fileSize;
|
||||
byte[] sentryHash;
|
||||
|
||||
try {
|
||||
#pragma warning disable CA2000 // False positive, we're actually wrapping it in the using clause below exactly for that purpose
|
||||
FileStream fileStream = File.Open(sentryFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
||||
#pragma warning restore CA2000 // False positive, we're actually wrapping it in the using clause below exactly for that purpose
|
||||
|
||||
await using (fileStream.ConfigureAwait(false)) {
|
||||
fileStream.Seek(callback.Offset, SeekOrigin.Begin);
|
||||
|
||||
await fileStream.WriteAsync(callback.Data.AsMemory(0, callback.BytesToWrite)).ConfigureAwait(false);
|
||||
|
||||
fileSize = fileStream.Length;
|
||||
fileStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
#pragma warning disable CA5350 // This is actually a fair warning, but there is nothing we can do about Steam using weak cryptographic algorithms
|
||||
using SHA1 hashAlgorithm = SHA1.Create();
|
||||
|
||||
sentryHash = await hashAlgorithm.ComputeHashAsync(fileStream).ConfigureAwait(false);
|
||||
#pragma warning restore CA5350 // This is actually a fair warning, but there is nothing we can do about Steam using weak cryptographic algorithms
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ArchiLogger.LogGenericException(e);
|
||||
|
||||
try {
|
||||
File.Delete(sentryFilePath);
|
||||
} catch {
|
||||
// Ignored, we can only try to delete faulted file at best
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Inform the steam servers that we're accepting this sentry file
|
||||
SteamUser.SendMachineAuthResponse(
|
||||
new SteamUser.MachineAuthDetails {
|
||||
BytesWritten = callback.BytesToWrite,
|
||||
FileName = callback.FileName,
|
||||
FileSize = (int) fileSize,
|
||||
JobID = callback.JobID,
|
||||
LastError = 0,
|
||||
Offset = callback.Offset,
|
||||
OneTimePassword = callback.OneTimePassword,
|
||||
Result = EResult.OK,
|
||||
SentryFileHash = sentryHash
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private async void OnPersonaState(SteamFriends.PersonaStateCallback callback) {
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
@@ -3928,7 +3838,6 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
|
||||
KeysToRedeem,
|
||||
KeysToRedeemUnused,
|
||||
KeysToRedeemUsed,
|
||||
MobileAuthenticator,
|
||||
SentryFile
|
||||
MobileAuthenticator
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageVersion Include="Nito.AsyncEx.Coordination" Version="5.1.2" />
|
||||
<PackageVersion Include="NLog.Web.AspNetCore" Version="5.3.5" />
|
||||
<PackageVersion Include="SteamKit2" Version="2.5.0-Beta.1" />
|
||||
<PackageVersion Include="SteamKit2" Version="2.5.0-Beta.2" />
|
||||
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
<PackageVersion Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
|
||||
<PackageVersion Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.5.0" />
|
||||
|
||||
Reference in New Issue
Block a user