Titano: Library completion, remote editing, accessibility and RTL pass, remaining translations #3

Merged
Alby96 merged 117 commits from claude/keen-knuth-uhxv8w into main 2026-10-12 09:24:21 +02:00
2 changed files with 12 additions and 5 deletions
Showing only changes of commit dcb20be9bc - Show all commits

No files matched your search

@@ -20,13 +20,19 @@ public sealed class AuditRepository
public Task<Page<AuditEntry>> ListAsync(Guid? userId = null, int limit = 100, string? cursor = null, CancellationToken cancellationToken = default) => public Task<Page<AuditEntry>> ListAsync(Guid? userId = null, int limit = 100, string? cursor = null, CancellationToken cancellationToken = default) =>
ListAsync(userId, action: null, limit, cursor, cancellationToken); ListAsync(userId, action: null, limit, cursor, cancellationToken);
/// <summary>Entries newest first, optionally of one user and one action (e.g. the sign-in log).</summary> /// <summary>Entries newest first, optionally of one user and one action.</summary>
public Task<Page<AuditEntry>> ListAsync(Guid? userId, string? action, int limit = 100, string? cursor = null, CancellationToken cancellationToken = default) public Task<Page<AuditEntry>> ListAsync(Guid? userId, string? action, int limit = 100, string? cursor = null, CancellationToken cancellationToken = default) =>
ListByActionsAsync(userId, action is null ? [] : [action], limit, cursor, cancellationToken);
/// <summary>Entries newest first, optionally of one user, of any of the actions (none: all), e.g. the sign-in log with failed attempts.</summary>
public Task<Page<AuditEntry>> ListByActionsAsync(Guid? userId, IReadOnlyCollection<string> actions, int limit = 100, string? cursor = null,
CancellationToken cancellationToken = default)
{ {
ArgumentNullException.ThrowIfNull(actions);
var p = new SqlParameters(); var p = new SqlParameters();
var where = new List<string>(); var where = new List<string>();
if (userId is { } user) where.Add($"user_id = {p.Add(user)}"); if (userId is { } user) where.Add($"user_id = {p.Add(user)}");
if (action is not null) where.Add($"action = {p.Add(action)}"); if (actions.Count > 0) where.Add($"action IN ({string.Join(", ", actions.Select(a => p.Add(a)))})");
if (cursor is not null) if (cursor is not null)
{ {
var (value, id) = Cursor.Decode("audit", cursor); var (value, id) = Cursor.Decode("audit", cursor);
+3 -2
View File
@@ -81,10 +81,11 @@ public static class AdminEndpoints
return Results.Json(store.Current(), ProtocolJson.Default.ServerSettingsDto); return Results.Json(store.Current(), ProtocolJson.Default.ServerSettingsDto);
} }
/// <summary>The audit log, newest first; <c>action</c> may list several actions separated by commas (<c>login,login_failed</c>).</summary>
private static async Task<IResult> AuditAsync(HttpContext context, TitanoDatabase db, Guid? user, string? action, string? cursor, int? limit) private static async Task<IResult> AuditAsync(HttpContext context, TitanoDatabase db, Guid? user, string? action, string? cursor, int? limit)
{ {
var page = await db.Audit.ListAsync(user, string.IsNullOrWhiteSpace(action) ? null : action, limit ?? 100, var actions = (action ?? string.Empty).Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
string.IsNullOrEmpty(cursor) ? null : cursor, context.RequestAborted); var page = await db.Audit.ListByActionsAsync(user, actions, limit ?? 100, string.IsNullOrEmpty(cursor) ? null : cursor, context.RequestAborted);
return Results.Json(new Page<AuditEntryDto>([.. page.Items.Select(Dto.Audit)], page.NextCursor, null), ProtocolJson.Default.PageAuditEntryDto); return Results.Json(new Page<AuditEntryDto>([.. page.Items.Select(Dto.Audit)], page.NextCursor, null), ProtocolJson.Default.PageAuditEntryDto);
} }