╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ───────────────╮ │src/ui/widget/thread.zig│ ╰────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2634 defer any_repo.deinit(io, allocator); │ │2635 switch (any_repo) { │ │2636 inline else => |*repo| if (supports_drafts) { │ │2645 - Event.update(repo_kind, repo.self_repo_opts, io, allocator, repo, &id_bytes, .{ .fields = .{ │ │2637 + Event.update(self.session.data.host_kind, repo_kind, repo.self_repo_opts, io, allocator, repo, &id_bytes, .{ .fields = .{│ │2638 .title = title, │ │2639 .tags = tags, │ │2640 .description = description, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2646 }, │ │2647 else => |other| return other, │ │2648 }; │ │2657 - if (comptime kind == .patch and repo_kind == .xit) { │ │2658 - if (!self.session.data.is_local) pch.refreshMergeability(repo.self_repo_opts, io, allocator, repo, id_bytes); │ │2659 - } │ │2649 } else if (has_status) │ │2661 - try Event.update(repo_kind, repo.self_repo_opts, io, allocator, repo, &id_bytes, .{ .fields = .{ │ │2650 + try Event.update(self.session.data.host_kind, repo_kind, repo.self_repo_opts, io, allocator, repo, &id_bytes, .{ .fields = .{│ │2651 .title = title, │ │2652 .tags = tags, │ │2653 .description = description, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2654 } }, author) │ │2655 else │ │2667 - try Event.update(repo_kind, repo.self_repo_opts, io, allocator, repo, &id_bytes, title, tags, description, author), │ │2656 + try Event.update(self.session.data.host_kind, repo_kind, repo.self_repo_opts, io, allocator, repo, &id_bytes, title, tags, description, author),│ │2657 } │ │2658 }, │ │2659 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2739 var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, src.localInitOpts()); │ │2740 defer any_repo.deinit(io, allocator); │ │2741 switch (any_repo) { │ │2753 - inline else => |*repo| try evt.remove(.repo, repo_kind, repo.self_repo_opts, io, allocator, repo, &id, event_kind, author), │ │2742 + inline else => |*repo| try evt.remove(self.session.data.host_kind, .repo, repo_kind, repo.self_repo_opts, io, allocator, repo, &id, event_kind, author),│ │2743 } │ │2744 }, │ │2745 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──╮ │src/web.zig│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────────────────────╮ │37 │ │38 // what a web request is served from: the multi-user server (admin repo +│ │39 // login sessions) or a single local repo. │ │40 -pub const Host = union(enum) { │ │41 - remote: struct { │ │40 +pub const Host = union(evt.HostKind) { │ │41 + local: ui.RepoSource, │ │42 + server: struct { │ │43 admin_repo_path: []const u8, │ │44 session_store: SessionStore, │ │45 git_http_port: ?u16, │ ╰─────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────╮ │46 git_ssh_port: ?u16, │ │47 git_ssh_prefix: []const u8, │ │48 }, │ │48 - local: ui.RepoSource, │ │49 }; │ │50 │ │51 -// an on-disk repo resolved from a request url. remote paths are owned.│ │51 +// an on-disk repo resolved from a request url. server paths are owned.│ │52 const RequestRepoSource = struct { │ │53 source: ui.RepoSource, │ │54 owned_path: ?[]const u8 = null, │ ╰───────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │60 │ │61 fn requestRepoSource(io: std.Io, allocator: std.mem.Allocator, host: Host, repo_base: []const u8) !?RequestRepoSource { │ │62 return switch (host) { │ │63 - .remote => |remote| blk: { │ │63 + .server => |server| blk: { │ │64 const repo_prefix = "/repo/"; │ │65 if (!std.mem.startsWith(u8, repo_base, repo_prefix)) break :blk null; │ │66 - const repos_dir = try std.fs.path.join(allocator, &.{ std.fs.path.dirname(remote.admin_repo_path) orelse ".", "repos" }); │ │66 + const repos_dir = try std.fs.path.join(allocator, &.{ std.fs.path.dirname(server.admin_repo_path) orelse ".", "repos" }); │ │67 defer allocator.free(repos_dir); │ │68 - const path = switch (try serve_common.resolveRepoPath(io, allocator, repos_dir, remote.admin_repo_path, repo_base[repo_prefix.len..], false)) {│ │68 + const path = switch (try serve_common.resolveRepoPath(io, allocator, repos_dir, server.admin_repo_path, repo_base[repo_prefix.len..], false)) {│ │69 .ok => |value| value, │ │70 .invalid, .not_found => break :blk null, │ │71 }; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │132 // you were on. local mode has no accounts, so only the repo routes. │ │133 if (method == .POST) { │ │134 switch (host) { │ │135 - .remote => |remote| { │ │135 + .server => |server| { │ │136 const PostRoute = enum { login, logout, ansi, new, edit, remove, open, close, resolve, publish, merge, squash, attach };│ │137 inline for (@typeInfo(PostRoute).@"enum".fields) |field| { │ │138 const suffix = "/" ++ field.name; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │139 if (std.mem.endsWith(u8, path, suffix)) { │ │140 const base = path[0 .. path.len - suffix.len]; │ │141 return switch (@field(PostRoute, field.name)) { │ │142 - .login => handleLogin(io, request, allocator, base, remote.admin_repo_path, remote.session_store),│ │143 - .logout => handleLogout(request, base, remote.session_store), │ │144 - .ansi => handleAnsi(io, request, allocator, base, remote.admin_repo_path, remote.session_store), │ │142 + .login => handleLogin(io, request, allocator, base, server.admin_repo_path, server.session_store),│ │143 + .logout => handleLogout(request, base, server.session_store), │ │144 + .ansi => handleAnsi(io, request, allocator, base, server.admin_repo_path, server.session_store), │ │145 .new => handleNew(io, request, allocator, base, host), │ │146 .edit => handleEdit(io, request, allocator, base, host), │ │147 .remove => handleRemove(io, request, allocator, base, host), │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │200 if (attachmentRequest(path)) |attachment| return serveAttachment(io, request, allocator, attachment, host);│ │201 │ │202 const current_page_maybe = switch (host) { │ │203 - .remote => ui.RoutablePage.fromUrl(path), │ │203 + .server => ui.RoutablePage.fromUrl(path), │ │204 .local => ui.RoutablePage.fromUrlLocal(path), │ │205 }; │ │206 if (current_page_maybe) |current_page| { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯