╭ changed ──╮ │src/web.zig│ ╰───────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────╮ │149 if (method == .POST and std.mem.eql(u8, path, "/logout")) {│ │150 return handleLogout(request, session_store); │ │151 } │ │152 + if (method == .POST and std.mem.eql(u8, path, "/ansi")) { │ │153 + return handleAnsi(request); │ │154 + } │ │155 │ │156 const get_or_head = method == .GET or method == .HEAD; │ │157 if (!get_or_head) { │ ╰────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │194 .user_id = user_id, │ │195 .login_failure = login_failure, │ │196 .current_page = current_page, │ │197 + // enable_ansi is intentionally left at its default │ │198 }); │ │199 defer allocator.free(html); │ │200 // expire the flash cookie on the way out so a refresh doesn't keep│ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │304 }); │ │305 } │ │306 │ │307 +fn handleAnsi(request: *std.http.Server.Request) !void { │ │308 + // TODO: persist the flip in the logged-in user's server-side session so it │ │309 + // survives this redirect and subsequent GETs. │ │310 + // │ │311 + // like logout, this is a bodyless POST, so close the connection rather than│ │312 + // letting the keep-alive path try to discard a body that isn't framed. │ │313 + try request.respond("", .{ │ │314 + .status = .see_other, │ │315 + .keep_alive = false, │ │316 + .extra_headers = &.{ │ │317 + .{ .name = "location", .value = ui.RoutablePage.url(.home_ansi) }, │ │318 + }, │ │319 + }); │ │320 +} │ │321 + │ │322 fn renderIndexHtml( │ │323 io: std.Io, │ │324 allocator: std.mem.Allocator, │ ╰─────────────────────────────────────────────────────────────────────────────────────╯