╭ changed ───╮ │src/main.zig│ ╰────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │105 inline else => |*r| r.core.work_path, │ │106 }; │ │107 break :blk .{ .path = try session_arena.allocator().dupe(u8, work_path), .repo_kind = .xit }; │ │108 - }; │ │109 - │ │110 - // every local route internally carries this synthetic │ │111 - // "owner/name"; urls elide it. │ │112 - const identity = try std.fmt.allocPrint(session_arena.allocator(), "local/{s}", .{std.fs.path.basename(local.path)});│ │113 - const route = ui.RoutablePage.repoFilesRoute(identity, null, "", "", 0) orelse { │ │114 - try run_opts.err.print("repo directory name is too long\n", .{}); │ │115 - return error.HandledError; │ │108 }; │ │109 │ │110 var session = ui.Session{ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │113 .io = io, │ │114 .local = local, │ │115 .is_terminal = true, │ │124 - .data = .{ .current_page = route }, │ │116 + .data = .{ │ │117 + // the files root; local routes carry no identity │ │118 + .current_page = .{ .repo_files = .{ .name = .{} } }, │ │119 + .is_local = true, │ │120 + }, │ │121 + }; │ │122 + │ │123 + // serve the web UI in the background while the TUI runs in the │ │124 + // foreground; the footer points at whatever port it bound. │ │125 + const Runnable = struct { │ │126 + io: std.Io, │ │127 + allocator: std.mem.Allocator, │ │128 + session: *ui.Session, │ │129 + │ │130 + pub fn run(self: @This(), web_port: u16) !void { │ │131 + self.session.web_port = web_port; │ │132 + try ui.run(self.io, self.allocator, self.session, null); │ │133 + } │ │134 }; │ │135 │ │127 - try ui.run(io, allocator, &session, null); │ │136 + try srv.runLocal(io, allocator, local, run_opts.err, Runnable{ .io = io, .allocator = allocator, .session = &session });│ │137 }, │ │138 .cli => |cli_cmd| switch (cli_cmd) { │ │139 .serve => |options| try srv.run(repo_kind, any_repo_opts, io, allocator, cwd_path, options, run_opts.err, {}), │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯