From 2880acb585ae950eecdaf14658b86daf7bb73230 Mon Sep 17 00:00:00 2001 From: Lucas Morgan Date: Mon, 29 Jan 2024 13:00:20 -0600 Subject: [PATCH] Upgrade to .net 8 --- Shogi.Api/Shogi.Api.csproj | 18 +++++++------- Shogi.Contracts/Shogi.Contracts.csproj | 2 +- Shogi.Domain/Shogi.Domain.csproj | 2 +- Shogi.UI/Pages/Home/Api/ShogiApi.cs | 4 +-- Shogi.UI/Pages/Home/LoginModal.razor | 11 +-------- Shogi.UI/Shared/ShogiSocket.cs | 10 ++++---- Shogi.UI/Shogi.UI.csproj | 14 +++++------ Shogi.UI/wwwroot/appsettings.json | 3 ++- Tests/AcceptanceTests/AcceptanceTests.csproj | 26 ++++++++++---------- Tests/E2ETests/E2ETests.csproj | 17 +++++++------ Tests/UnitTests/UnitTests.csproj | 12 ++++----- global.json | 2 +- 12 files changed, 58 insertions(+), 63 deletions(-) diff --git a/Shogi.Api/Shogi.Api.csproj b/Shogi.Api/Shogi.Api.csproj index acf4fa9..0871023 100644 --- a/Shogi.Api/Shogi.Api.csproj +++ b/Shogi.Api/Shogi.Api.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 true 5 enable @@ -23,15 +23,15 @@ - - - - - - - + + + + + + + - + diff --git a/Shogi.Contracts/Shogi.Contracts.csproj b/Shogi.Contracts/Shogi.Contracts.csproj index b80b4ad..14dcce0 100644 --- a/Shogi.Contracts/Shogi.Contracts.csproj +++ b/Shogi.Contracts/Shogi.Contracts.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 true 5 enable diff --git a/Shogi.Domain/Shogi.Domain.csproj b/Shogi.Domain/Shogi.Domain.csproj index e21c6b5..deb29af 100644 --- a/Shogi.Domain/Shogi.Domain.csproj +++ b/Shogi.Domain/Shogi.Domain.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 disable enable diff --git a/Shogi.UI/Pages/Home/Api/ShogiApi.cs b/Shogi.UI/Pages/Home/Api/ShogiApi.cs index b2af3a6..e17f72a 100644 --- a/Shogi.UI/Pages/Home/Api/ShogiApi.cs +++ b/Shogi.UI/Pages/Home/Api/ShogiApi.cs @@ -35,7 +35,7 @@ namespace Shogi.UI.Pages.Home.Api public async Task GuestLogout() { - var response = await this.guestHttpClient.PutAsync(new Uri("User/GuestLogout", UriKind.Relative), null); + var response = await this.guestHttpClient.PutAsync(RelativeUri("User/TestGuestLogout"), null); response.EnsureSuccessStatusCode(); } @@ -74,7 +74,7 @@ namespace Shogi.UI.Pages.Home.Api var content = await response.Content.ReadAsStringAsync(); if (!string.IsNullOrEmpty(content)) { - return await response.Content.ReadFromJsonAsync(serializerOptions); + return JsonSerializer.Deserialize(content, serializerOptions); } } return null; diff --git a/Shogi.UI/Pages/Home/LoginModal.razor b/Shogi.UI/Pages/Home/LoginModal.razor index 9a419a9..69120d9 100644 --- a/Shogi.UI/Pages/Home/LoginModal.razor +++ b/Shogi.UI/Pages/Home/LoginModal.razor @@ -7,17 +7,8 @@ @if (guestAccountDescriptionIsVisible) {

What's the difference?

- @**@

- Guest accounts are session based, meaning that the account lives exclusively within the device and browser you create the account on. + Guest accounts are session based, meaning that the account lives exclusively within the device and browser you play on as a guest. This is the only difference between guest and email accounts.

diff --git a/Shogi.UI/Shared/ShogiSocket.cs b/Shogi.UI/Shared/ShogiSocket.cs index 27bd0ea..a832c48 100644 --- a/Shogi.UI/Shared/ShogiSocket.cs +++ b/Shogi.UI/Shared/ShogiSocket.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Http.Extensions; +using Microsoft.AspNetCore.WebUtilities; using Shogi.Contracts.Socket; using Shogi.Contracts.Types; using System.Buffers; @@ -16,7 +16,7 @@ public class ShogiSocket : IDisposable private ClientWebSocket socket; private readonly JsonSerializerOptions serializerOptions; - private readonly UriBuilder uriBuilder; + private readonly string baseUrl; private readonly CancellationTokenSource cancelToken; private readonly IMemoryOwner memoryOwner; private bool disposedValue; @@ -25,7 +25,7 @@ public class ShogiSocket : IDisposable { this.socket = new ClientWebSocket(); this.serializerOptions = serializerOptions; - this.uriBuilder = new UriBuilder(configuration["SocketUrl"] ?? throw new InvalidOperationException("SocketUrl configuration is missing.")); + this.baseUrl = configuration["SocketUrl"] ?? throw new InvalidOperationException("SocketUrl configuration is missing."); this.cancelToken = new CancellationTokenSource(); this.memoryOwner = MemoryPool.Shared.Rent(1024 * 2); } @@ -46,8 +46,8 @@ public class ShogiSocket : IDisposable Console.WriteLine("Opening socket and existing socket state is " + this.socket.State.ToString()); } - uriBuilder.Query = new QueryBuilder { { "token", token } }.ToQueryString().Value; - await socket.ConnectAsync(this.uriBuilder.Uri, cancelToken.Token); + var uri = new Uri(QueryHelpers.AddQueryString(this.baseUrl, "token", token), UriKind.Absolute); + await socket.ConnectAsync(uri, cancelToken.Token); // Fire and forget! I'm way too lazy to write my own javascript interop to a web worker. Nooo thanks. _ = Listen() .ContinueWith(async antecedent => diff --git a/Shogi.UI/Shogi.UI.csproj b/Shogi.UI/Shogi.UI.csproj index a78f68c..8c082c3 100644 --- a/Shogi.UI/Shogi.UI.csproj +++ b/Shogi.UI/Shogi.UI.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable enable @@ -14,12 +14,12 @@ - - - - - - + + + + + + diff --git a/Shogi.UI/wwwroot/appsettings.json b/Shogi.UI/wwwroot/appsettings.json index 8401787..6fe48df 100644 --- a/Shogi.UI/wwwroot/appsettings.json +++ b/Shogi.UI/wwwroot/appsettings.json @@ -12,8 +12,9 @@ "api://c1e94676-cab0-42ba-8b6c-9532b8486fff/DefaultScope" ] }, - "ShogiApiUrl2": "https://localhost:5001", "ShogiApiUrl": "https://api.lucaserver.space/Shogi.Api/", "SocketUrl": "wss://api.lucaserver.space/Shogi.Api/", + + "ShogiApiUrl2": "https://localhost:5001", "SocketUrl2": "wss://localhost:5001" } \ No newline at end of file diff --git a/Tests/AcceptanceTests/AcceptanceTests.csproj b/Tests/AcceptanceTests/AcceptanceTests.csproj index 75bd680..15efd8f 100644 --- a/Tests/AcceptanceTests/AcceptanceTests.csproj +++ b/Tests/AcceptanceTests/AcceptanceTests.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable enable @@ -21,21 +21,21 @@ - - - - - - - - - - - + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Tests/E2ETests/E2ETests.csproj b/Tests/E2ETests/E2ETests.csproj index 8814f3d..4cb444e 100644 --- a/Tests/E2ETests/E2ETests.csproj +++ b/Tests/E2ETests/E2ETests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable @@ -9,12 +9,15 @@ - - - - - - + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Tests/UnitTests/UnitTests.csproj b/Tests/UnitTests/UnitTests.csproj index cf04e8c..7885685 100644 --- a/Tests/UnitTests/UnitTests.csproj +++ b/Tests/UnitTests/UnitTests.csproj @@ -1,21 +1,21 @@  - net7.0 + net8.0 enable false - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/global.json b/global.json index b48bb00..9e0754e 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.2", + "version": "8.0.0", "rollForward": "latestFeature" } } \ No newline at end of file