🐛 Trying to fix JSON float

This commit is contained in:
2025-09-07 12:16:28 +08:00
parent 4a27794ccc
commit 7452b14817
2 changed files with 8 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ using NodaTime;
using NodaTime.Serialization.SystemTextJson;
using StackExchange.Redis;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.RateLimiting;
using DysonNetwork.Pass.Auth.OidcProvider.Options;
using DysonNetwork.Pass.Auth.OidcProvider.Services;
@@ -51,9 +52,9 @@ public static class ServiceCollectionExtensions
options.MaxReceiveMessageSize = 16 * 1024 * 1024; // 16MB
options.MaxSendMessageSize = 16 * 1024 * 1024; // 16MB
});
services.AddPusherService();
// Register OIDC services
services.AddScoped<OidcService, GoogleOidcService>();
services.AddScoped<OidcService, AppleOidcService>();
@@ -70,6 +71,7 @@ public static class ServiceCollectionExtensions
services.AddControllers().AddJsonOptions(options =>
{
options.JsonSerializerOptions.NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals;
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower;
options.JsonSerializerOptions.DictionaryKeyPolicy = JsonNamingPolicy.SnakeCaseLower;
@@ -132,7 +134,8 @@ public static class ServiceCollectionExtensions
{
Version = "v1",
Title = "Dyson Pass",
Description = "The authentication service of the Dyson Network. Mainly handling authentication and authorization.",
Description =
"The authentication service of the Dyson Network. Mainly handling authentication and authorization.",
TermsOfService = new Uri("https://solsynth.dev/terms"),
License = new OpenApiLicense
{
@@ -203,7 +206,7 @@ public static class ServiceCollectionExtensions
services.AddScoped<SafetyService>();
services.AddScoped<SocialCreditService>();
services.AddScoped<ExperienceService>();
services.Configure<OidcProviderOptions>(configuration.GetSection("OidcProvider"));
services.AddScoped<OidcProviderService>();

View File

@@ -25,7 +25,7 @@ public class GeoIpService(IOptions<GeoIpOptions> options)
using var reader = new DatabaseReader(_databasePath);
var city = reader.City(ipAddress);
if (city?.Location == null || !city.Location.HasCoordinates)
if (city?.Location is not { HasCoordinates: true })
return null;
return _geometryFactory.CreatePoint(new Coordinate(