╭ changed ──╮ │src/web.zig│ ╰───────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────╮ │ 5 const hash = xit.hash; │ │ 6 const evt = @import("./event.zig"); │ │ 7 const serve_common = @import("./serve_common.zig");│ │ 8 +const serve_http = @import("./serve_http.zig"); │ │ 9 const ui = @import("./ui.zig"); │ │10 const fork = @import("./fork.zig"); │ │11 const pch = @import("./patch.zig"); │ ╰───────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────╮ │46 admin_repo_path: []const u8, │ │47 users_dir: []const u8, │ │48 session_store: SessionStore, │ │48 - git_http_port: ?u16, │ │49 - git_ssh_port: ?u16, │ │49 + // the public url of this listener, which git's http clones share│ │50 + web_url: []const u8, │ │51 + ssh_url: ?[]const u8, │ │52 git_ssh_prefix: []const u8, │ │53 + serve_git: serve_http.GitHandler, │ │54 }, │ │55 │ │56 // where this host's event writes go │ ╰─────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │128 error.ReadFailed => break, │ │129 else => |e| return e, │ │130 }; │ │131 + │ │132 + switch (host) { │ │133 + .server => |server| if (serve_http.isGitRequest(&request.head)) { │ │134 + try server.serve_git(io, allocator, server.users_dir, server.admin_repo_path, &http_server, &request, err);│ │135 + // git's responses end with "Connection: close" │ │136 + break; │ │137 + }, │ │138 + .local => {}, │ │139 + } │ │140 │ │141 handleRequest(io, &request, allocator, host) catch |request_err| { │ │142 serve_common.logError(io, err, "web ui request failed: {s}\n", .{@errorName(request_err)}); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │339 }, │ │340 } │ │341 │ │330 - const git_http_port: ?u16, const git_ssh_port: ?u16, const git_ssh_prefix: []const u8 = switch (host) { │ │331 - .server => |server| .{ server.git_http_port, server.git_ssh_port, server.git_ssh_prefix }, │ │342 + const git_http_url: ?[]const u8, const git_ssh_url: ?[]const u8, const git_ssh_prefix: []const u8 = switch (host) {│ │343 + .server => |server| .{ server.web_url, server.ssh_url, server.git_ssh_prefix }, │ │344 .local => .{ null, null, "" }, │ │345 }; │ │346 var session_data: ui.Session.Data = .{ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────╮ │349 .sync_failure = sync_failure, │ │350 .current_page = current_page, │ │351 .host_kind = std.meta.activeTag(host), │ │340 - .git_http_port = git_http_port, │ │341 - .git_ssh_port = git_ssh_port, │ │352 + .git_http_url = git_http_url, │ │353 + .git_ssh_url = git_ssh_url, │ │354 .git_ssh_prefix = git_ssh_prefix, │ │355 }; │ │356 // a page that can't be built shows the not-found page instead│ ╰───────────────────────────────────────────────────────────────────────────╯