global: add null safety checks

This commit is contained in:
Abdullah Atta
2025-10-14 21:15:51 +05:00
parent be432dfd24
commit 6e35edb715
109 changed files with 452 additions and 590 deletions

View File

@@ -26,7 +26,7 @@ namespace Streetwriters.Messenger.Helpers
{
public class SSEHelper
{
public static async Task SendEventToUserAsync(string data, IServerSentEventsService sseService, string userId, string originTokenId = null)
public static async Task SendEventToUserAsync(string data, IServerSentEventsService sseService, string userId, string? originTokenId = null)
{
var clients = sseService.GetClients().Where(c => c.User.FindFirstValue("sub") == userId);
foreach (var client in clients)

View File

@@ -51,7 +51,7 @@ namespace Streetwriters.Messenger
{
options.Limits.MaxRequestBodySize = long.MaxValue;
options.ListenAnyIP(Servers.MessengerServer.Port);
if (Servers.MessengerServer.IsSecure)
if (Servers.MessengerServer.IsSecure && Servers.MessengerServer.SSLCertificate != null)
{
options.ListenAnyIP(443, listenerOptions =>
{

View File

@@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<StartupObject>Streetwriters.Messenger.Program</StartupObject>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>