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 36 additions and 3 deletions
Showing only changes of commit 9f03c07fdf - Show all commits

No files matched your search

+4 -3
View File
@@ -29,10 +29,11 @@ public static class AdminEndpoints
ProtocolJson.Default.ListLogFileDto));
logs.MapGet("/files/{name}", (HttpContext context, string name, ServerOptions options) =>
{
// Only names of existing log files are served: the name never becomes part of a path.
// Only names of existing log files are served: the name never becomes part of a path. The current log keeps
// growing while it is sent, so the response holds the bytes it had when listed, as its Content-Length says.
if (LogFiles(options).FirstOrDefault(f => f.Name == name) is not { } file) return ApiErrors.NotFound(context, "log");
context.Response.Headers.CacheControl = "no-store";
return Results.File(file.FullName, "text/plain; charset=utf-8", file.Name, file.LastWriteTimeUtc, enableRangeProcessing: true);
return FileResponses.Serve(context, file, 0, file.Length, "text/plain; charset=utf-8", "no-store", downloadName: file.Name)
?? ApiErrors.NotFound(context, "log");
});
}
@@ -1,6 +1,8 @@
using System.Net;
using System.Net.Http.Json;
using System.Text.Json.Nodes;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Titano.Protocol;
using Titano.Testing;
@@ -66,6 +68,36 @@ public sealed class AdminTests(TestContext context)
await traversal.ExpectErrorAsync(HttpStatusCode.NotFound, "not_found");
}
[Test]
public async Task TheCurrentLogDownloadsWhileTheServerKeepsLogging()
{
await using var server = await TestServer.StartAsync(context, o => o.LogLevel = Microsoft.Extensions.Logging.LogLevel.Information);
var admin = await server.AdminAsync();
using var files = await admin.GetAsync("/api/v1/logs/files");
var name = (await files.ReadAsync(ProtocolJson.Default.ListLogFileDto)).First().Name;
var logger = server.Services.GetRequiredService<ILoggerFactory>().CreateLogger("Titano.Server.Tests");
using var stop = new CancellationTokenSource();
// Jobs, uploads and sign-ins keep writing to the file an administrator downloads.
var logging = Task.Run(() =>
{
while (!stop.IsCancellationRequested) logger.LogInformation("Busy");
});
try
{
for (var i = 0; i < 5; i++)
{
using var download = await admin.GetAsync($"/api/v1/logs/files/{name}");
await download.ExpectAsync(HttpStatusCode.OK);
Assert.Equal(download.Content.Headers.ContentLength, (await download.Content.ReadAsByteArrayAsync()).LongLength);
}
}
finally
{
await stop.CancelAsync();
await logging;
}
}
[Test]
public async Task ArchiveSettingsValidateTemplatesAndJobsNeedHandlers()
{