╭ changed ──╮ │src/web.zig│ ╰───────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────╮ │47 git_ssh_port: ?u16, │ │48 git_ssh_prefix: []const u8, │ │49 }, │ │50 + │ │51 + // where this host's event writes go │ │52 + pub fn event(self: Host) evt.Host { │ │53 + return switch (self) { │ │54 + .local => .local, │ │55 + .server => |server| .{ .server = .{ .users_dir = server.users_dir } },│ │56 + }; │ │57 + } │ │58 }; │ │59 │ │60 // an on-disk repo resolved from a request url. server paths are owned. │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │148 return switch (@field(PostRoute, field.name)) { │ │149 .login => handleLogin(io, request, allocator, base, server.admin_repo_path, server.session_store), │ │150 .logout => handleLogout(request, base, server.session_store), │ │143 - .ansi => handleAnsi(io, request, allocator, base, server.admin_repo_path, server.session_store), │ │151 + .ansi => handleAnsi(io, request, allocator, base, server.admin_repo_path, server.users_dir, server.session_store),│ │152 .new => handleNew(io, request, allocator, base, host), │ │153 .edit => handleEdit(io, request, allocator, base, host), │ │154 .remove => handleRemove(io, request, allocator, base, host), │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │476 allocator: std.mem.Allocator, │ │477 base: []const u8, │ │478 admin_repo_path: []const u8, │ │479 + users_dir: []const u8, │ │480 session_store: SessionStore, │ │481 ) !void { │ │482 // the toggle re-emits the user's own event, so it takes a logged-in user│ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮ │489 var repo = try Repo.open(io, allocator, .{ .path = admin_repo_path }); │ │490 defer repo.deinit(io, allocator); │ │491 │ │483 - try evt.User.toggleAnsi(evt.admin_repo_opts, io, allocator, &repo, &user_id); │ │492 + try evt.User.toggleAnsi(evt.admin_repo_opts, io, allocator, &repo, users_dir, &user_id);│ │493 } │ │494 │ │495 // return to the settings tab the toggle came from so the change is visible. │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │750 switch (any_repo) { │ │751 inline else => |*repo| { │ │752 const result = if (kind == .patch) │ │744 - pch.writeBranchPatch(std.meta.activeTag(host), repo_kind, repo.self_repo_opts, io, allocator, repo, event_id_hex, event.event.patch orelse unreachable, null, author)│ │753 + pch.writeBranchPatch(host.event(), repo_kind, repo.self_repo_opts, io, allocator, repo, event_id_hex, event.event.patch orelse unreachable, null, author) │ │754 else │ │746 - evt.consume(std.meta.activeTag(host), .repo, repo_kind, repo.self_repo_opts, io, allocator, repo, evt.events_ref, &.{event}); │ │755 + evt.consume(host.event(), .repo, repo_kind, repo.self_repo_opts, io, allocator, repo, evt.events_ref, &.{event}); │ │756 result catch |err| { │ │757 if (kind != .patch) return err; │ │758 const failure = ui.Session.FormFeedback.PatchFailure.fromError(err) orelse return err; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │940 var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, source.localInitOpts()); │ │941 defer any_repo.deinit(io, allocator); │ │942 switch (any_repo) { │ │934 - inline else => |*repo| event_id_hex = try evt.Comment.create(std.meta.activeTag(host), repo_kind, repo.self_repo_opts, io, allocator, repo, &thread_id_hex, &parent_id_hex, body, author),│ │943 + inline else => |*repo| event_id_hex = try evt.Comment.create(host.event(), repo_kind, repo.self_repo_opts, io, allocator, repo, &thread_id_hex, &parent_id_hex, body, author), │ │944 } │ │945 }, │ │946 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1137 var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, source.localInitOpts()); │ │1138 defer any_repo.deinit(io, allocator); │ │1139 switch (any_repo) { │ │1131 - inline else => |*repo| _ = evt.Attachment.create(std.meta.activeTag(host), repo_kind, repo.self_repo_opts, io, allocator, repo, &parent_id_hex, blob, author) catch |err| switch (err) {│ │1140 + inline else => |*repo| _ = evt.Attachment.create(host.event(), repo_kind, repo.self_repo_opts, io, allocator, repo, &parent_id_hex, blob, author) catch |err| switch (err) { │ │1141 error.ParentNotFound => return respondAttachmentParentNotFound(request), │ │1142 else => return err, │ │1143 }, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1189 var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, source.localInitOpts()); │ │1190 defer any_repo.deinit(io, allocator); │ │1191 switch (any_repo) { │ │1183 - inline else => |*repo| try evt.Comment.update(std.meta.activeTag(host), repo_kind, repo.self_repo_opts, io, allocator, repo, &thread_id, &comment_id, body, author),│ │1192 + inline else => |*repo| try evt.Comment.update(host.event(), repo_kind, repo.self_repo_opts, io, allocator, repo, &thread_id, &comment_id, body, author), │ │1193 } │ │1194 }, │ │1195 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1283 var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, source.localInitOpts()); │ │1284 defer any_repo.deinit(io, allocator); │ │1285 switch (any_repo) { │ │1277 - inline else => |*repo| try Event.update(std.meta.activeTag(host), repo_kind, repo.self_repo_opts, io, allocator, repo, id, update, author),│ │1286 + inline else => |*repo| try Event.update(host.event(), repo_kind, repo.self_repo_opts, io, allocator, repo, id, update, author), │ │1287 } │ │1288 }, │ │1289 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1365 var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, source.localInitOpts()); │ │1366 defer any_repo.deinit(io, allocator); │ │1367 switch (any_repo) { │ │1359 - inline else => |*repo| evt.remove(std.meta.activeTag(host), .repo, repo_kind, repo.self_repo_opts, io, allocator, repo, &parts.id, parts.kind, author) catch |err| switch (err) {│ │1368 + inline else => |*repo| evt.remove(host.event(), .repo, repo_kind, repo.self_repo_opts, io, allocator, repo, &parts.id, parts.kind, author) catch |err| switch (err) { │ │1369 error.EventNotFound => return respondRemoveNotFound(request), │ │1370 else => |e| return e, │ │1371 }, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯