Update to .NET 8
This commit is contained in:
@@ -117,7 +117,8 @@ public class ClientController : Controller
|
||||
});
|
||||
}
|
||||
|
||||
_logger.LogWarning("Invalid steam ticket specified, IsValid {IsValid}, HasValidSignature {Sig}, AppId {AppId}",
|
||||
_logger.LogWarning("Invalid steam ticket specified, IsExpired {IsExpired}, IsValid {IsValid}, HasValidSignature {Sig}, AppId {AppId}",
|
||||
ticket.IsExpired,
|
||||
ticket.IsValid,
|
||||
ticket.HasValidSignature,
|
||||
ticket.AppId);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using Microsoft.AspNetCore.Http.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Prospect.Server.Api.Middleware;
|
||||
|
||||
@@ -45,7 +45,12 @@ public class RequestLoggerMiddleware
|
||||
var body = await reader.ReadToEndAsync();
|
||||
if (body.StartsWith("{"))
|
||||
{
|
||||
return JsonConvert.SerializeObject(JsonConvert.DeserializeObject(body), Formatting.Indented);
|
||||
var bodyJson = JsonSerializer.SerializeToUtf8Bytes(JsonSerializer.Deserialize<object>(body), new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
});
|
||||
|
||||
return Encoding.UTF8.GetString(bodyJson);
|
||||
}
|
||||
|
||||
return body;
|
||||
|
||||
@@ -32,5 +32,5 @@ public class FUpdateUserDataRequest
|
||||
/// <summary>
|
||||
/// Unique PlayFab assigned ID of the user on whom the operation will be performed.
|
||||
/// </summary>
|
||||
public string PlayFabId { get; set; }
|
||||
public string? PlayFabId { get; set; }
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>true</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.14.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.27.0" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
|
||||
<PackageReference Include="Sigil" Version="5.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.15.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.6.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -16,7 +16,7 @@ public class DbUserDataService : BaseDbService<PlayFabUserData>
|
||||
return await Collection.Find(data => data.PlayFabId == playFabId && data.Key == key).AnyAsync();
|
||||
}
|
||||
|
||||
public async Task<PlayFabUserData> FindAsync(string playFabId, string key)
|
||||
public async Task<PlayFabUserData?> FindAsync(string playFabId, string key)
|
||||
{
|
||||
return await Collection.Find(data => data.PlayFabId == playFabId && data.Key == key).SingleOrDefaultAsync();
|
||||
}
|
||||
|
||||
@@ -120,14 +120,14 @@ public class UserDataService
|
||||
/// <param name="currentUserId">
|
||||
/// The authenticated user id.
|
||||
/// </param>
|
||||
/// <param name="requestUserId">
|
||||
/// The requested user id.
|
||||
/// <param name="targetUserId">
|
||||
/// The target user id.
|
||||
/// </param>
|
||||
/// <param name="changes"></param>
|
||||
/// <returns></returns>
|
||||
public async Task UpdateAsync(
|
||||
string currentUserId,
|
||||
string requestUserId,
|
||||
string? targetUserId,
|
||||
Dictionary<string, string> changes)
|
||||
{
|
||||
if (changes.Count == 0)
|
||||
@@ -140,13 +140,13 @@ public class UserDataService
|
||||
throw new ArgumentNullException(nameof(currentUserId));
|
||||
}
|
||||
|
||||
if (requestUserId == null)
|
||||
if (targetUserId == null)
|
||||
{
|
||||
requestUserId = currentUserId;
|
||||
targetUserId = currentUserId;
|
||||
}
|
||||
|
||||
// Whether we are updating someone else.
|
||||
var other = currentUserId != requestUserId;
|
||||
var other = currentUserId != targetUserId;
|
||||
|
||||
foreach (var (key, value) in changes)
|
||||
{
|
||||
@@ -155,10 +155,11 @@ public class UserDataService
|
||||
{
|
||||
if (other)
|
||||
{
|
||||
_logger.LogWarning("User {PlayFabId} attempted to update non-existing key {Key} of another user {PlayFabIdOther}", currentUserId, key, requestUserId);
|
||||
_logger.LogWarning("User {PlayFabId} attempted to update non-existing key {Key} of another user {PlayFabIdOther}", currentUserId, key, targetUserId);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogDebug("User {PlayFabId} created key {Key}", currentUserId, key);
|
||||
await _dbUserDataService.InsertAsync(currentUserId, key, value, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user