diff --git a/DysonNetwork.Drive/Storage/FileService.cs b/DysonNetwork.Drive/Storage/FileService.cs index 318e7e8..5f2f535 100644 --- a/DysonNetwork.Drive/Storage/FileService.cs +++ b/DysonNetwork.Drive/Storage/FileService.cs @@ -63,13 +63,9 @@ public class FileService( var cachedFile = await cache.GetAsync(cacheKey); if (cachedFile != null) - { cachedFiles[fileId] = cachedFile; - } else - { uncachedIds.Add(fileId); - } } // Load uncached files from database diff --git a/DysonNetwork.Drive/appsettings.json b/DysonNetwork.Drive/appsettings.json index 78b0850..6538ff6 100644 --- a/DysonNetwork.Drive/appsettings.json +++ b/DysonNetwork.Drive/appsettings.json @@ -1,7 +1,7 @@ { "Debug": true, "BaseUrl": "http://localhost:5071", - "GatewayUrl": "http://localhost:5094", + "GatewayUrl": "http://10.126.126.1:5094", "Logging": { "LogLevel": { "Default": "Information", diff --git a/DysonNetwork.Gateway/Program.cs b/DysonNetwork.Gateway/Program.cs index 3b97bbb..df7310a 100644 --- a/DysonNetwork.Gateway/Program.cs +++ b/DysonNetwork.Gateway/Program.cs @@ -8,6 +8,15 @@ builder.Services.AddControllers(); var app = builder.Build(); +app.UseCors(opts => + opts.SetIsOriginAllowed(_ => true) + .WithExposedHeaders("*") + .WithHeaders() + .AllowCredentials() + .AllowAnyHeader() + .AllowAnyMethod() +); + app.MapControllers(); app.MapReverseProxy(); diff --git a/DysonNetwork.Gateway/Properties/launchSettings.json b/DysonNetwork.Gateway/Properties/launchSettings.json index bb5bb2e..4551407 100644 --- a/DysonNetwork.Gateway/Properties/launchSettings.json +++ b/DysonNetwork.Gateway/Properties/launchSettings.json @@ -14,7 +14,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, - "applicationUrl": "https://localhost:7034;http://localhost:5094", + "applicationUrl": "https://localhost:7034;http://0.0.0.0:5094", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/DysonNetwork.Pass/Account/MagicSpellController.cs b/DysonNetwork.Pass/Account/MagicSpellController.cs index 4735c2a..5b4b347 100644 --- a/DysonNetwork.Pass/Account/MagicSpellController.cs +++ b/DysonNetwork.Pass/Account/MagicSpellController.cs @@ -38,7 +38,7 @@ public class MagicSpellController(AppDatabase db, MagicSpellService sp) : Contro } [HttpPost("{spellWord}/apply")] - public async Task ApplyMagicSpell([FromRoute] string spellWord, [FromBody] MagicSpellApplyRequest request) + public async Task ApplyMagicSpell([FromRoute] string spellWord, [FromBody] MagicSpellApplyRequest? request) { var word = Uri.UnescapeDataString(spellWord); var spell = await db.MagicSpells @@ -50,7 +50,7 @@ public class MagicSpellController(AppDatabase db, MagicSpellService sp) : Contro return NotFound(); try { - if (spell.Type == MagicSpellType.AuthPasswordReset && request.NewPassword is not null) + if (spell.Type == MagicSpellType.AuthPasswordReset && request?.NewPassword is not null) await sp.ApplyPasswordReset(spell, request.NewPassword); else await sp.ApplyMagicSpell(spell); diff --git a/DysonNetwork.Pass/appsettings.json b/DysonNetwork.Pass/appsettings.json index 8dbd4e6..fbd7b24 100644 --- a/DysonNetwork.Pass/appsettings.json +++ b/DysonNetwork.Pass/appsettings.json @@ -1,6 +1,6 @@ { "Debug": true, - "BaseUrl": "http://localhost:5071", + "BaseUrl": "http://10.126.126.1:5216", "Logging": { "LogLevel": { "Default": "Information", diff --git a/DysonNetwork.Shared/Cache/CacheService.cs b/DysonNetwork.Shared/Cache/CacheService.cs index 2157bb7..42cb21a 100644 --- a/DysonNetwork.Shared/Cache/CacheService.cs +++ b/DysonNetwork.Shared/Cache/CacheService.cs @@ -204,7 +204,7 @@ public class CacheServiceRedis : ICacheService _serializerSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver(), - PreserveReferencesHandling = PreserveReferencesHandling.Objects, + PreserveReferencesHandling = PreserveReferencesHandling.None, NullValueHandling = NullValueHandling.Include, DateParseHandling = DateParseHandling.None }; diff --git a/DysonNetwork.Shared/Proto/GrpcTypeHelper.cs b/DysonNetwork.Shared/Proto/GrpcTypeHelper.cs index e12dfa4..85ba823 100644 --- a/DysonNetwork.Shared/Proto/GrpcTypeHelper.cs +++ b/DysonNetwork.Shared/Proto/GrpcTypeHelper.cs @@ -19,7 +19,7 @@ public abstract class GrpcTypeHelper public static readonly JsonSerializerSettings SerializerSettings = new() { ContractResolver = new DefaultContractResolver { NamingStrategy = new SnakeCaseNamingStrategy() }, - PreserveReferencesHandling = PreserveReferencesHandling.Objects, + PreserveReferencesHandling = PreserveReferencesHandling.None, NullValueHandling = NullValueHandling.Include, DateParseHandling = DateParseHandling.None }; diff --git a/DysonNetwork.Sphere/Post/PostController.cs b/DysonNetwork.Sphere/Post/PostController.cs index 00b5407..751bb62 100644 --- a/DysonNetwork.Sphere/Post/PostController.cs +++ b/DysonNetwork.Sphere/Post/PostController.cs @@ -72,9 +72,6 @@ public class PostController( [HttpGet("{id:guid}")] public async Task> GetPost(Guid id) { - if (HttpContext.Items["IsWebPage"] as bool? ?? true) - return RedirectToPage("/Posts/PostDetail", new { PostId = id }); - HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); var currentUser = currentUserValue as Account; List userFriends = []; diff --git a/DysonNetwork.Sphere/Startup/ApplicationConfiguration.cs b/DysonNetwork.Sphere/Startup/ApplicationConfiguration.cs index 80c276a..d5dded7 100644 --- a/DysonNetwork.Sphere/Startup/ApplicationConfiguration.cs +++ b/DysonNetwork.Sphere/Startup/ApplicationConfiguration.cs @@ -20,15 +20,6 @@ public static class ApplicationConfiguration ConfigureForwardedHeaders(app, configuration); - app.UseCors(opts => - opts.SetIsOriginAllowed(_ => true) - .WithExposedHeaders("*") - .WithHeaders() - .AllowCredentials() - .AllowAnyHeader() - .AllowAnyMethod() - ); - app.UseWebSockets(); app.UseRateLimiter(); app.UseAuthentication(); diff --git a/DysonNetwork.sln.DotSettings.user b/DysonNetwork.sln.DotSettings.user index 1aded9d..56e9a8c 100644 --- a/DysonNetwork.sln.DotSettings.user +++ b/DysonNetwork.sln.DotSettings.user @@ -78,6 +78,7 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded