From 7cf03886b7e1152cc91dda24df6329c1c6438bfd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 03:54:21 +0000 Subject: [PATCH 1/6] Bump Orc.FileAssociation from 5.0.0-alpha0061 to 5.0.0 Bumps [Orc.FileAssociation](https://github.com/wildgums/orc.FileAssociation) from 5.0.0-alpha0061 to 5.0.0. - [Changelog](https://github.com/WildGums/Orc.FileAssociation/blob/develop/GitReleaseManager.yaml) - [Commits](https://github.com/wildgums/orc.FileAssociation/commits/5.0.0) --- updated-dependencies: - dependency-name: Orc.FileAssociation dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Wabbajack.App.Wpf/Wabbajack.App.Wpf.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Wabbajack.App.Wpf/Wabbajack.App.Wpf.csproj b/Wabbajack.App.Wpf/Wabbajack.App.Wpf.csproj index a31fc461..c01c5a93 100644 --- a/Wabbajack.App.Wpf/Wabbajack.App.Wpf.csproj +++ b/Wabbajack.App.Wpf/Wabbajack.App.Wpf.csproj @@ -93,7 +93,7 @@ - + From a1da63984b5cdcd77e3ef696e00f8640d46ea069 Mon Sep 17 00:00:00 2001 From: EzioTheDeadPoet <52624146+EzioTheDeadPoet@users.noreply.github.com> Date: Tue, 28 May 2024 18:41:18 +0200 Subject: [PATCH 2/6] update dependency --- Wabbajack.CLI/Wabbajack.CLI.csproj | 2 +- .../Wabbajack.Hashing.PHash.Test.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Wabbajack.CLI/Wabbajack.CLI.csproj b/Wabbajack.CLI/Wabbajack.CLI.csproj index f3af5d29..2f289c5f 100644 --- a/Wabbajack.CLI/Wabbajack.CLI.csproj +++ b/Wabbajack.CLI/Wabbajack.CLI.csproj @@ -25,7 +25,7 @@ - + diff --git a/Wabbajack.Hashing.PHash.Test/Wabbajack.Hashing.PHash.Test.csproj b/Wabbajack.Hashing.PHash.Test/Wabbajack.Hashing.PHash.Test.csproj index da6b6c5c..34fd44db 100644 --- a/Wabbajack.Hashing.PHash.Test/Wabbajack.Hashing.PHash.Test.csproj +++ b/Wabbajack.Hashing.PHash.Test/Wabbajack.Hashing.PHash.Test.csproj @@ -14,7 +14,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive From 12409ababbeabab97f57d995c2c8e68d5feb9247 Mon Sep 17 00:00:00 2001 From: EzioTheDeadPoet <52624146+EzioTheDeadPoet@users.noreply.github.com> Date: Tue, 28 May 2024 18:45:03 +0200 Subject: [PATCH 3/6] refactor interface name to the naming convention for interfaces --- Wabbajack.CLI/Verbs/SetNexusApiKey.cs | 14 ++++---------- Wabbajack.Networking.NexusApi/AuthInfo.cs | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Wabbajack.CLI/Verbs/SetNexusApiKey.cs b/Wabbajack.CLI/Verbs/SetNexusApiKey.cs index 95775d7f..a6657644 100644 --- a/Wabbajack.CLI/Verbs/SetNexusApiKey.cs +++ b/Wabbajack.CLI/Verbs/SetNexusApiKey.cs @@ -1,29 +1,23 @@ - -using System.CommandLine; -using System.CommandLine.Invocation; -using System.CommandLine.NamingConventionBinder; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Wabbajack.CLI.Builder; using Wabbajack.DTOs.Logins; -using Wabbajack.Paths; -using Wabbajack.Paths.IO; using Wabbajack.Services.OSIntegrated; namespace Wabbajack.CLI.Verbs; public class SetNexusApiKey { - private readonly EncryptedJsonTokenProvider _tokenProvider; + private readonly EncryptedJsonTokenProvider _tokenProvider; private readonly ILogger _logger; - public SetNexusApiKey(EncryptedJsonTokenProvider tokenProvider, ILogger logger) + public SetNexusApiKey(EncryptedJsonTokenProvider tokenProvider, ILogger logger) { _tokenProvider = tokenProvider; _logger = logger; } - public static VerbDefinition Definition = new VerbDefinition("set-nexus-api-key", + public static VerbDefinition Definition = new("set-nexus-api-key", "Sets the Nexus API key to the specified value", [ new OptionDefinition(typeof(string), "k", "key", "The Nexus API key") @@ -38,7 +32,7 @@ public class SetNexusApiKey } else { - await _tokenProvider.SetToken(new NexusApiState { ApiKey = key }); + await _tokenProvider.SetToken(new() { ApiKey = key }); _logger.LogInformation("Set Nexus API Key to {key}", key); return 0; } diff --git a/Wabbajack.Networking.NexusApi/AuthInfo.cs b/Wabbajack.Networking.NexusApi/AuthInfo.cs index fa25d3f8..7699e1b4 100644 --- a/Wabbajack.Networking.NexusApi/AuthInfo.cs +++ b/Wabbajack.Networking.NexusApi/AuthInfo.cs @@ -3,6 +3,6 @@ using Wabbajack.Networking.Http.Interfaces; namespace Wabbajack.Networking.NexusApi; -public interface AuthInfo : ITokenProvider +public interface IAuthInfo : ITokenProvider { } \ No newline at end of file From 1b949b538a291ea66a745cbc5d7ac0c757b5ed4d Mon Sep 17 00:00:00 2001 From: EzioTheDeadPoet <52624146+EzioTheDeadPoet@users.noreply.github.com> Date: Tue, 28 May 2024 18:46:47 +0200 Subject: [PATCH 4/6] fix SetNexusApiKey CLI command --- .../TokenProviders/NexusApiTokenProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Wabbajack.Services.OSIntegrated/TokenProviders/NexusApiTokenProvider.cs b/Wabbajack.Services.OSIntegrated/TokenProviders/NexusApiTokenProvider.cs index 03302585..0556a4fa 100644 --- a/Wabbajack.Services.OSIntegrated/TokenProviders/NexusApiTokenProvider.cs +++ b/Wabbajack.Services.OSIntegrated/TokenProviders/NexusApiTokenProvider.cs @@ -5,7 +5,7 @@ using Wabbajack.Networking.NexusApi; namespace Wabbajack.Services.OSIntegrated.TokenProviders; -public class NexusApiTokenProvider : EncryptedJsonTokenProvider, AuthInfo +public class NexusApiTokenProvider : EncryptedJsonTokenProvider, IAuthInfo { public NexusApiTokenProvider(ILogger logger, DTOSerializer dtos) : base(logger, dtos, "nexus-oauth-info") From 720a3b1f45b7e3edbf0e4555668e2236f2a92585 Mon Sep 17 00:00:00 2001 From: EzioTheDeadPoet <52624146+EzioTheDeadPoet@users.noreply.github.com> Date: Tue, 28 May 2024 19:20:09 +0200 Subject: [PATCH 5/6] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f72ca7b..b777d46d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ### Changelog +#### Version - 3.6.1.1 - TBD +* Fixed `set-nexus-api-key` CLI command + #### Version - 3.6.1.0 - 5/26/2024 * Fixed a race condition on renewing Nexus Mods OAuth2 tokens * Added `set-nexus-api-key` CLI command From cd03d2991f31616d0275c2f14818f57661778a27 Mon Sep 17 00:00:00 2001 From: trawzified <55751269+tr4wzified@users.noreply.github.com> Date: Fri, 31 May 2024 01:03:31 +0200 Subject: [PATCH 6/6] OAuth Nexus fixes (#2569) * Missing a lock in the validate method that could cause refresh to trigger a lot of times asynchronously * Fix refreshing Nexus OAuth token not working properly * Fix accidental deadlock on NexusApi.Validate(), add extra validation logging --- Wabbajack.Downloaders.Dispatcher/DownloadDispatcher.cs | 3 ++- Wabbajack.Downloaders.Nexus/NexusDownloader.cs | 3 ++- Wabbajack.Networking.NexusApi/NexusApi.cs | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Wabbajack.Downloaders.Dispatcher/DownloadDispatcher.cs b/Wabbajack.Downloaders.Dispatcher/DownloadDispatcher.cs index c01eb31e..5511a58b 100644 --- a/Wabbajack.Downloaders.Dispatcher/DownloadDispatcher.cs +++ b/Wabbajack.Downloaders.Dispatcher/DownloadDispatcher.cs @@ -148,8 +148,9 @@ public class DownloadDispatcher return result; } - catch (HttpException) + catch (HttpException ex) { + _logger.LogError($"Failed verifying {a.State.PrimaryKeyString}: {ex}"); await _verificationCache.Put(a.State, false); return false; } diff --git a/Wabbajack.Downloaders.Nexus/NexusDownloader.cs b/Wabbajack.Downloaders.Nexus/NexusDownloader.cs index 74a86805..1168cb5c 100644 --- a/Wabbajack.Downloaders.Nexus/NexusDownloader.cs +++ b/Wabbajack.Downloaders.Nexus/NexusDownloader.cs @@ -217,8 +217,9 @@ public class NexusDownloader : ADownloader, IUrlDownloader return fileInfo.info.FileId == state.FileID; } - catch (HttpException) + catch (HttpException ex) { + _logger.LogError($"HttpException: {ex} on {archive.Name}"); return false; } } diff --git a/Wabbajack.Networking.NexusApi/NexusApi.cs b/Wabbajack.Networking.NexusApi/NexusApi.cs index b512d265..77d56277 100644 --- a/Wabbajack.Networking.NexusApi/NexusApi.cs +++ b/Wabbajack.Networking.NexusApi/NexusApi.cs @@ -188,7 +188,6 @@ public class NexusApi protected virtual async ValueTask GenerateMessage(HttpMethod method, string uri, params object?[] parameters) { - using var _ = await _authLock.WaitAsync(); var msg = new HttpRequestMessage(); msg.Method = method; @@ -232,6 +231,7 @@ public class NexusApi private async ValueTask<(bool IsApiKey, string code)> GetAuthInfo() { + using var _ = await _authLock.WaitAsync(); if (AuthInfo.HaveToken()) { var info = await AuthInfo.Get(); @@ -272,6 +272,8 @@ public class NexusApi var response = await _client.PostAsync($"https://users.nexusmods.com/oauth/token", content, cancel); var responseString = await response.Content.ReadAsStringAsync(cancel); var newJwt = JsonSerializer.Deserialize(responseString); + if (newJwt != null) + newJwt.ReceivedAt = DateTime.UtcNow.ToFileTimeUtc(); state.OAuth = newJwt; await AuthInfo.SetToken(state);