diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs index 9fac23ba..b7c581b6 100644 --- a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs +++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs @@ -185,8 +185,13 @@ internal sealed partial class LaunchGameViewModel : Abstraction.ViewModel private void UpdateSelectedGamePathEntry(GamePathEntry? value, bool setBack) { - if (SetProperty(ref selectedGamePathEntry, value) && setBack) + if (SetProperty(ref selectedGamePathEntry, value, nameof(SelectedGamePathEntry)) && setBack) { + if (IsViewDisposed) + { + return; + } + launchOptions.GamePath = value?.Path ?? string.Empty; GamePathSelectedAndValid = File.Exists(launchOptions.GamePath); } diff --git a/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/Takumi/GameRecord/CardClient.cs b/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/Takumi/GameRecord/CardClient.cs index 9ae3ffa8..bee74d16 100644 --- a/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/Takumi/GameRecord/CardClient.cs +++ b/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/Takumi/GameRecord/CardClient.cs @@ -43,17 +43,12 @@ internal sealed partial class CardClient return Response.Response.DefaultIfNull(resp); } - /// - /// 二次验证 - /// - /// 流水号 - /// 验证 - /// 取消令牌 - /// 验证结果 - public async ValueTask> VerifyVerificationAsync(string challenge, string validate, CancellationToken token) + public async ValueTask> VerifyVerificationAsync(CardVerifiationHeaders headers, string challenge, string validate, CancellationToken token) { HttpRequestMessageBuilder builder = httpRequestMessageBuilderFactory.Create() .SetRequestUri(ApiEndpoints.CardVerifyVerification) + .SetHeader("x-rpc-challenge_game", $"{headers.ChallengeGame}") + .SetHeader("x-rpc-challenge_path", headers.ChallengePath) .PostJson(new VerificationData(challenge, validate)); await builder.SignDataAsync(DataSignAlgorithmVersion.Gen2, SaltType.X4, false).ConfigureAwait(false); diff --git a/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/Takumi/GameRecord/Verification/HomaGeetestCardVerifier.cs b/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/Takumi/GameRecord/Verification/HomaGeetestCardVerifier.cs index f803edf5..4a08976b 100644 --- a/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/Takumi/GameRecord/Verification/HomaGeetestCardVerifier.cs +++ b/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/Takumi/GameRecord/Verification/HomaGeetestCardVerifier.cs @@ -24,7 +24,7 @@ internal sealed partial class HomaGeetestCardVerifier : IGeetestCardVerifier if (response is { Code: 0, Data.Validate: string validate }) { - Response.Response verifyResponse = await cardClient.VerifyVerificationAsync(registration.Challenge, validate, token).ConfigureAwait(false); + Response.Response verifyResponse = await cardClient.VerifyVerificationAsync(headers, registration.Challenge, validate, token).ConfigureAwait(false); if (verifyResponse.IsOk()) { VerificationResult result = verifyResponse.Data;