feat: first-run claim wizard (no default admin, claim code from the backend log); owner list shows account and passkey; container install first [CI]
ci/woodpecker/push/main-amd64-build Pipeline was successful

This commit is contained in:
justme committed 2026-10-08 06:47:10 +08:00
1 parent 2ae63653c4
commit f22fdf8b68
31 files changed
+799 -49

No files matched your search

@@ -3,7 +3,7 @@ using Microsoft.Extensions.Hosting;
namespace MoShiro.Backend.Application;
/// <summary>
/// 启动时最先执行:截断没有索引记录的段文件尾部、创建初始管理员、创建默认的线路任务模板。
/// 启动时最先执行:截断没有索引记录的段文件尾部、(用配置里的凭据创建管理员,没有的话把首次认领码写进日志)创建默认的线路任务模板。
/// 宿主按注册顺序依次等待各个 IHostedService 启动,所以它需要最先注册。
/// </summary>
public sealed class StartupTasks : IHostedService
@@ -12,9 +12,11 @@ public sealed class StartupTasks : IHostedService
private readonly AuthService _auth;
private readonly TaskService _tasks;
private readonly ServerIdentityService _identity;
private readonly SetupService _setup;
public StartupTasks(IRawStore raw, AuthService auth, TaskService tasks, ServerIdentityService identity)
public StartupTasks(IRawStore raw, AuthService auth, TaskService tasks, ServerIdentityService identity, SetupService setup)
{
_setup = setup;
_identity = identity;
_raw = raw;
_auth = auth;
@@ -25,6 +27,7 @@ public sealed class StartupTasks : IHostedService
{
await _raw.RecoverAsync(cancellationToken);
await _auth.EnsureInitialAdminAsync(cancellationToken);
await _setup.AnnounceAsync(cancellationToken);
await _tasks.SeedDefaultsAsync(cancellationToken);
await _identity.EnsureAsync(cancellationToken);
}