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,87 @@
|
||||
using System.Text;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data;
|
||||
using Chronos.Server.Configuration;
|
||||
using Chronos.Server.Hosting;
|
||||
|
||||
namespace Chronos.Server.Security;
|
||||
|
||||
/// <summary>
|
||||
/// First-run administrator (BRIEF §14.9): when no admin account exists, one is created from
|
||||
/// <c>CHRONOS_ADMIN_USER</c>/<c>CHRONOS_ADMIN_PASSWORD</c> and must change its password at first sign-in. Without a
|
||||
/// configured password a temporary one is generated and written to <c>/data/initial-admin-password.txt</c> (owner-only;
|
||||
/// on Windows readable by the server's account and Administrators), never to the log; the file is removed once an
|
||||
/// administrator changes their password.
|
||||
/// </summary>
|
||||
public static class AdminBootstrap
|
||||
{
|
||||
public const string DefaultUsername = "admin";
|
||||
private const string PasswordFileName = "initial-admin-password.txt";
|
||||
|
||||
public static async Task RunAsync(ChronosDatabase db, ServerOptions options, TimeProvider time, ILogger logger, CancellationToken cancellationToken)
|
||||
{
|
||||
var users = await db.Users.ListAsync(cancellationToken).ConfigureAwait(false);
|
||||
if (users.Any(u => u.Role == UserRole.Admin))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(options.AdminPassword))
|
||||
logger.LogInformation("An administrator exists; CHRONOS_ADMIN_USER and CHRONOS_ADMIN_PASSWORD are ignored");
|
||||
return;
|
||||
}
|
||||
|
||||
var username = string.IsNullOrWhiteSpace(options.AdminUser) ? DefaultUsername : options.AdminUser.Trim();
|
||||
if (!Accounts.IsValidUsername(username))
|
||||
throw new InvalidOperationException("CHRONOS_ADMIN_USER may only contain letters, digits, dot, dash and underscore (up to 64 characters).");
|
||||
if (users.Any(u => Accounts.Key(u.Username) == Accounts.Key(username)))
|
||||
throw new InvalidOperationException($"No administrator exists and CHRONOS_ADMIN_USER '{username}' names an existing account; choose another name.");
|
||||
|
||||
var password = options.AdminPassword;
|
||||
string? passwordFile = null;
|
||||
if (string.IsNullOrEmpty(password))
|
||||
{
|
||||
password = TemporaryPassword.Generate();
|
||||
passwordFile = Path.Combine(options.DataPath, PasswordFileName);
|
||||
DataFolderAccess.WritePrivateFile(passwordFile, Encoding.UTF8.GetBytes(password + Environment.NewLine));
|
||||
}
|
||||
|
||||
var admin = new User
|
||||
{
|
||||
Id = Guid.CreateVersion7(),
|
||||
Username = username,
|
||||
DisplayName = null,
|
||||
PasswordHash = PasswordHasher.Hash(password),
|
||||
Role = UserRole.Admin,
|
||||
Permissions = Permissions.All,
|
||||
MustChangePassword = true,
|
||||
Created = time.GetUtcNow(),
|
||||
};
|
||||
await db.Users.CreateAsync(admin, cancellationToken).ConfigureAwait(false);
|
||||
await db.Audit.AppendAsync(new AuditEntry
|
||||
{
|
||||
Id = Guid.CreateVersion7(),
|
||||
At = admin.Created,
|
||||
Action = "user_created",
|
||||
TargetKind = "user",
|
||||
TargetId = admin.Id.ToString(),
|
||||
Details = "admin",
|
||||
Username = username,
|
||||
}, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (passwordFile is null)
|
||||
logger.LogWarning("Created administrator '{User}' from CHRONOS_ADMIN_USER/CHRONOS_ADMIN_PASSWORD; the password must be changed at first sign-in", username);
|
||||
else
|
||||
logger.LogWarning("Created administrator '{User}'; its temporary password is in {File} and must be changed at first sign-in", username, passwordFile);
|
||||
}
|
||||
|
||||
/// <summary>Removes the generated password file (called when an administrator sets their own password).</summary>
|
||||
public static void ForgetInitialPassword(ServerOptions options)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(Path.Combine(options.DataPath, PasswordFileName));
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// Best effort: the file holds a password that no longer works.
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user