refactor!: rename Titano to Chronos and move CI and releases to Gitea (#6)
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
The owner renamed the product and moved the repository to the self-hosted Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control, and asked for Actions and a first automatic release with the server package and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md). - Chronos everywhere: a byte-exact rename of contents and paths, then a per-language review of the forms the old name's ending had dictated. - Gitea instead of GitHub: the update check, licence, issue and support links read ChronosReleasesUrl; the update check takes the highest stable version, offers a pre-release build its final release and reports a repository it cannot see as a failed check. EULA, security policy and Gitea issue forms live at the repository root. - Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release, nightly image and performance gates in the .NET SDK container with git checkout and the system SQLite. The release cross-compiles the Windows programs, checks their icon, version and DPI manifest, packs installers and zips, publishes the Gitea release and pushes the server image (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows runner (WINDOWS_RUNNER). - New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the docker-exec script, which Gitea's service containers do not allow; the throw-away server runs without durability) and pe-check. - Timed tests take their budget from TestTiming (CHRONOS_TEST_TIME_FACTOR, 3 on the shared runner; the weekly performance gates keep theirs). BREAKING CHANGE: programs, settings, data folders, file types, environment variables and the Docker image use the new name; nothing is migrated from Titano, which never had a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #6.
This commit is contained in:
1 parent
c99842cc86
commit
f2b58522b9
1801 files changed
+11804
-10676
No files matched your search
@@ -0,0 +1,80 @@
|
||||
using Microsoft.AspNetCore.Http.Metadata;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Protocol;
|
||||
using Chronos.Server.Security;
|
||||
using Chronos.Server.Storage;
|
||||
|
||||
namespace Chronos.Server.Api;
|
||||
|
||||
/// <summary>
|
||||
/// <c>/api/v1/uploads</c> (BRIEF §14.4). Chunk, state and cancel calls also serve render nodes uploading their output,
|
||||
/// which start and complete through the node endpoints. <c>POST /uploads/cards</c> takes the reports of a card import a
|
||||
/// client streams through these uploads and tells every connected client (BRIEF §14.3 <c>cardEvent</c>).
|
||||
/// </summary>
|
||||
public static class UploadEndpoints
|
||||
{
|
||||
private const int MaxCardName = 200;
|
||||
|
||||
/// <summary>The largest chunk size a server can be set to (<see cref="Configuration.ServerOptions.ChunkSizeBytes"/>).</summary>
|
||||
private const long MaxChunkBytes = 64L * 1024 * 1024;
|
||||
|
||||
public static void Map(RouteGroupBuilder api)
|
||||
{
|
||||
var uploads = api.MapGroup("/uploads").Requires(Permissions.Upload | Permissions.RenderNode);
|
||||
uploads.MapPost("", StartAsync).Requires(Permissions.Upload);
|
||||
uploads.MapPut("/{id:guid}/chunks/{index:int}", ChunkAsync).WithMetadata(new ChunkBodyLimit());
|
||||
uploads.MapGet("/{id:guid}", async (HttpContext context, Caller caller, Guid id, UploadService service) =>
|
||||
(await service.GetStateAsync(caller, id, context.RequestAborted)).ToResult(context, s => Results.Json(s, ProtocolJson.Default.UploadState)));
|
||||
uploads.MapDelete("/{id:guid}", async (HttpContext context, Caller caller, Guid id, UploadService service) =>
|
||||
(await service.CancelAsync(caller, id, context.RequestAborted)).ToResult(context, _ => Results.NoContent()));
|
||||
uploads.MapPost("/{id:guid}/complete", async (HttpContext context, Caller caller, Guid id, UploadService service) =>
|
||||
(await service.CompleteAsync(caller, id)).ToResult(context, r => Results.Json(r, ProtocolJson.Default.CompleteUploadResponse)))
|
||||
.Requires(Permissions.Upload);
|
||||
uploads.MapPost("/cards", ReportCard).Requires(Permissions.Upload);
|
||||
}
|
||||
|
||||
private static async Task<IResult> StartAsync(HttpContext context, Caller caller, StartUploadRequest request, UploadService service)
|
||||
{
|
||||
var outcome = await service.StartAsync(caller, request, context.RequestAborted);
|
||||
return outcome.ToResult(context, r => Results.Json(r, ProtocolJson.Default.StartUploadResponse,
|
||||
statusCode: r.AlreadyExists ? StatusCodes.Status200OK : StatusCodes.Status201Created));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A card import's start, progress or end, published as a <see cref="CardEvent"/> naming who imports it; 204, also for
|
||||
/// progress dropped because it came within a second of the last (<see cref="UploadService.PublishCard"/>).
|
||||
/// </summary>
|
||||
private static IResult ReportCard(HttpContext context, Caller caller, CardImportReport report, UploadService service)
|
||||
{
|
||||
if (report.ImportId == Guid.Empty) return ApiErrors.BadRequest(context, "bad_request", "importId");
|
||||
var card = report.Card?.Trim();
|
||||
if (string.IsNullOrEmpty(card) || card.Length > MaxCardName || card.Any(char.IsControl)) return ApiErrors.BadRequest(context, "bad_request", "card");
|
||||
if (!CardImportStates.IsKnown(report.State)) return ApiErrors.BadRequest(context, "bad_request", "state");
|
||||
if (report.Total < 0 || report.Done < 0 || report.Done > report.Total || report.Failed < 0 || report.Failed > report.Total)
|
||||
return ApiErrors.BadRequest(context, "bad_request", "done");
|
||||
return service.PublishCard(caller, new CardEvent(report.ImportId, card, report.State, report.Done, report.Total, report.Failed, caller.User.Username,
|
||||
caller.ClientName)).ToResult(context, _ => Results.NoContent());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chunks and proxies (<see cref="FileEndpoints"/>) are the only large request bodies; every other endpoint keeps
|
||||
/// Kestrel's small default limit. Routing raises it for this route (<see cref="ChunkBodyLimit"/>), and the service
|
||||
/// keeps it at least at the chunk size of this upload (fixed when it started) and of this server, so a body left
|
||||
/// unread by any answer can still be drained.
|
||||
/// </summary>
|
||||
private static async Task<IResult> ChunkAsync(HttpContext context, Caller caller, Guid id, int index, UploadService service)
|
||||
{
|
||||
var outcome = await service.ReceiveChunkAsync(caller, id, index, context.Request, context.RequestAborted);
|
||||
return outcome.ToResult(context, r => Results.Json(r, ProtocolJson.Default.ChunkReceived));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The chunk route's body limit, applied by routing as it selects the endpoint, before authentication can answer 401
|
||||
/// or 403 with the chunk unread. Kestrel drains an unread body only within the limit; above it, it closes the connection
|
||||
/// and the client sees a network error instead of the answer (an Uploader would retry rather than ask to sign in).
|
||||
/// </summary>
|
||||
private sealed class ChunkBodyLimit : IRequestSizeLimitMetadata
|
||||
{
|
||||
public long? MaxRequestBodySize => MaxChunkBytes;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user