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
@@ -0,0 +1,55 @@
using System.ComponentModel.DataAnnotations;
using AutoMapper;
using Govor.API.Common.Extensions;
using Govor.Application.Infrastructure.Extensions;
using Govor.Application.Reactions;
using Govor.Contracts.Responses;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Govor.API.Controllers;
[ApiController]
[Authorize(Roles = "Admin,User")]
[Route("api/reaction-packs")]
public class ReactionPacksController(IReactionPackService packs, ICurrentUserService currentUser, IMapper mapper) : ControllerBase
{
[HttpGet]
public async Task<IActionResult> List([FromQuery, Range(0, int.MaxValue)] int skip = 0,
[FromQuery, Range(1, 100)] int take = 50) =>
Ok(mapper.Map<List<ReactionPackResponse>>(await packs.ListAsync(currentUser.GetCurrentUserId(), skip: skip, take: take)));
[HttpGet("mine")]
public async Task<IActionResult> Mine([FromQuery, Range(0, int.MaxValue)] int skip = 0,
[FromQuery, Range(1, 100)] int take = 50) =>
Ok(mapper.Map<List<ReactionPackResponse>>(await packs.ListAsync(currentUser.GetCurrentUserId(), installedOnly: true, skip: skip, take: take)));
[HttpGet("{packId:guid}")]
public async Task<IActionResult> Get(Guid packId) => (await packs.GetAsync(packId))
.Map(p => mapper.Map<ReactionPackResponse>(p)).ToActionResult();
[HttpGet("shared/{shareCode}")]
public async Task<IActionResult> Shared(string shareCode) => (await packs.GetSharedAsync(shareCode))
.Map(p => mapper.Map<ReactionPackResponse>(p)).ToActionResult();
[HttpGet("/api/reactions/{reactionId:guid}")]
public async Task<IActionResult> Reaction(Guid reactionId) => (await packs.GetReactionAsync(reactionId))
.Map(r => mapper.Map<ReactionItemResponse>(r)).ToActionResult();
[HttpPut("{packId:guid}/subscription")]
public async Task<IActionResult> Subscribe(Guid packId) =>
(await packs.SubscribeAsync(currentUser.GetCurrentUserId(), packId, true)).ToActionResult();
[HttpDelete("{packId:guid}/subscription")]
public async Task<IActionResult> Unsubscribe(Guid packId) =>
(await packs.SubscribeAsync(currentUser.GetCurrentUserId(), packId, false)).ToActionResult();
[HttpGet("limits")]
public IActionResult Limits() => Ok(new
{
maxDimension = ReactionMediaLimits.MaxDimension, maxUploadBytes = ReactionMediaLimits.MaxUploadBytes,
maxImageBytes = ReactionMediaLimits.MaxImageBytes, maxGifBytes = ReactionMediaLimits.MaxGifBytes,
maxFrames = ReactionMediaLimits.MaxFrames, maxDurationMilliseconds = ReactionMediaLimits.MaxDurationMilliseconds,
maxItemsPerPack = 100
});
}