feat(server): API v1 with auth, uploads, sync, jobs, render nodes and events
- Security: PBKDF2-SHA512 (210,000 iterations) hashes, opaque bearer tokens stored as SHA-256 with sliding expiry and revocation, HttpOnly/Secure/ SameSite=Strict admin cookie with a session-bound CSRF token, sign-in rate limit and lockout, role/permission metadata on every endpoint, audit log, first-run administrator bootstrap. - Sequences with keyset paging, ETags and settings_version conflicts; sync manifest; frames, proxies, thumbnails and exports streamed with Range. - Chunked resumable uploads with hash short-circuit, quota and disk checks, staging on the archive volume, SHA-256 verification and IArchiveIngest. - Job engine host, jobs API, render nodes with heartbeat timeout and reassignment, WebSocket events, LAN discovery beacon, upload cleanup. - Windows service host over advapi32 (--service, --install-service, --uninstall-service); fails fast without the archive module services. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
56 files changed
+4726
-108
No files matched your search
@@ -1,11 +1,53 @@
|
||||
using System.ComponentModel;
|
||||
using Titano.Server.Configuration;
|
||||
using Titano.Server.Hosting;
|
||||
using Titano.Server.Hosting.Windows;
|
||||
|
||||
if (args.Contains("--healthcheck")) return await HealthProbe.RunAsync();
|
||||
var command = ServerCommandLine.Parse(args);
|
||||
if (command.Error is not null)
|
||||
{
|
||||
await Console.Error.WriteLineAsync(command.Error);
|
||||
return 2;
|
||||
}
|
||||
|
||||
var app = ServerHost.Build(ServerOptions.Load(), args);
|
||||
await app.RunAsync();
|
||||
return 0;
|
||||
switch (command.Command)
|
||||
{
|
||||
case ServerCommand.Help:
|
||||
Console.WriteLine(ServerCommandLine.Usage);
|
||||
return 0;
|
||||
case ServerCommand.HealthCheck:
|
||||
return await HealthProbe.RunAsync();
|
||||
case ServerCommand.Service or ServerCommand.InstallService or ServerCommand.UninstallService when !OperatingSystem.IsWindows():
|
||||
await Console.Error.WriteLineAsync("Windows services are available on Windows only.");
|
||||
return 2;
|
||||
case ServerCommand.InstallService when OperatingSystem.IsWindows():
|
||||
return ServiceAction(ServiceInstaller.Install, $"Installed the {WindowsServiceHost.ServiceName} service.");
|
||||
case ServerCommand.UninstallService when OperatingSystem.IsWindows():
|
||||
return ServiceAction(ServiceInstaller.Uninstall, $"Removed the {WindowsServiceHost.ServiceName} service.");
|
||||
case ServerCommand.Service when OperatingSystem.IsWindows():
|
||||
if (WindowsServiceHost.Run(() => ServerHost.Build(ServerOptions.Load(), [.. command.HostArguments]))) return 0;
|
||||
await Console.Error.WriteLineAsync("--service is used by the Service Control Manager; start the service with 'sc start TitanoServer'.");
|
||||
return 1;
|
||||
default:
|
||||
var app = ServerHost.Build(ServerOptions.Load(), [.. command.HostArguments]);
|
||||
await app.RunAsync();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ServiceAction(Action action, string done)
|
||||
{
|
||||
try
|
||||
{
|
||||
action();
|
||||
Console.WriteLine(done);
|
||||
return 0;
|
||||
}
|
||||
catch (Win32Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine(ex.Message);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Entry point type, visible to the in-process test host.</summary>
|
||||
public partial class Program;
|
||||
Reference in new issue
Block a user