Добавить панель системы и временный внешний доступ

This commit is contained in:
Никита
2026-11-10 11:25:50 +03:00
parent 0e0efe5614
commit a81c0bad34
19 changed files with 383 additions and 8 deletions
@@ -20,6 +20,13 @@ public static class UiEndpoints
return Results.Ok(await presence.ReadAsync());
});
app.MapGet("/api/ui/users/{username}",async(string username,HttpContext ctx,SessionService sessions,AppDatabase db)=> {
var(actor,_)=await sessions.AuthenticateAsync(ctx);if(actor is null)return Unauthorized(ctx);
if(!System.Text.RegularExpressions.Regex.IsMatch(username,"\\A[a-z0-9_]{3,32}\\z"))return ApiError(ctx,400,"invalid_request","Некорректный логин");
var user=await db.FindUserByUsernameAsync(username);
return user is null?ApiError(ctx,404,"not_found","Пользователь не найден"):Results.Ok(user.ToDto());
});
app.MapGet("/api/ui/chats", async (HttpContext context, SessionService sessions, AppDatabase database) =>
{
var (actor, _) = await sessions.AuthenticateAsync(context);