Add reactions, reliable push & session checks

Implements message reactions and reaction packs (domain models, services, admin HTTP API, media processing via ImageSharp and limits) and adds reliable push delivery (ChatPushNotification, ChatPushDispatcher, ChatPushWorker, improved ChatNotificationService). Enhances message reading (ReadChat API, unread counts, concurrency-safe receipts) and tightens session security (access-token session validation in JWT, hub filter, SessionAuthorization). Improves SignalR behavior (session groups, reaction/channel events, hub/error mappings). Adds EF migrations, many controller fixes (Forbid handling, password API), tests (Govor.Server.Tests), docs, CI and tooling updates (Dockerfile → .NET 10, GH Actions matrix for sqlite/postgres, Govor.Server.slnx, global.json), and small infra changes (AutoMapper bump, NullPushProvider, storage/token handling).
This commit is contained in:
Artemy
2026-10-03 17:42:24 +07:00
parent 4603be9f71
commit 29cc51ee0c
127 changed files with 7290 additions and 2488 deletions
@@ -4,6 +4,7 @@ using Govor.Application.Users.UserSessions.Crypto;
using Govor.Contracts.Requests;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Govor.Contracts.DTOs;
namespace Govor.API.Controllers.Authentication;
@@ -27,7 +28,8 @@ public class SessionKeysController : Controller
ICurrentUserSessionService currentSession,
ISessionKeyAttacher sessionKeyAttacher,
ISessionKeysReader sessionKeysReader,
ICurrentUserService currentUser)
ICurrentUserService currentUser,
IOneTimePreKeysRotator oneTimePreKeysRotator)
{
_logger = logger;
_friendshipService = friendshipService;
@@ -35,6 +37,7 @@ public class SessionKeysController : Controller
_sessionKeyAttacher = sessionKeyAttacher;
_sessionKeysReader = sessionKeysReader;
_currentUser = currentUser;
_oneTimePreKeysRotator = oneTimePreKeysRotator;
}
[HttpPost("keys")]
@@ -63,11 +66,24 @@ public class SessionKeysController : Controller
var requesterId = _currentUser.GetCurrentUserId();
if (!(await _friendshipService.GetFriendsAsync(userId)).Select(u => u.Id).Contains(requesterId))
return Forbid("You can only access keys of your friends");
return Forbid();
var keys = await _sessionKeysReader.GetAllActiveKeysAsync(userId);
return Ok(keys);
return Ok(keys.Select(k => new PublicSessionKeysDto
{
IdentityKey = Convert.ToBase64String(k.PublicIdentityKey),
SignedPreKey = k.SignedPreKey is null ? null : new SignedPreKeyDto
{
Id = k.SignedPreKey.Id,
Key = Convert.ToBase64String(k.SignedPreKey.PublicSignedPreKey),
Signature = Convert.ToBase64String(k.SignedPreKey.SignedPreKeySignature)
},
OneTimePreKeys = k.OneTimePreKeys.Where(p => !p.IsUsed).Select(p => new OneTimePreKeyDto
{
Id = p.Id, Key = Convert.ToBase64String(p.PublicKey)
}).ToList()
}));
}
[HttpPost("keys/rotate")]
@@ -106,4 +122,4 @@ public class SessionKeysController : Controller
return Ok("Marked as used.");
}
}
}