2. Visitors get a real page
Someone who is not signed in sees the page, not a bounce to a sign-in screen.
rc.me() is a visitor for someone not signed in. The app decides what a visitor sees; the platform never forces a sign-in.
This is the code serving the zoo right now: the bytes this very program was built from (each file is embedded when the zoo is compiled), at commit
55c71513c5 (staging). The zoo's own self-check fetches this page and compares it byte for byte with the file it runs.
e02_visitors.odin sha256 513a6616eab7 · raw
1package main 2 3// Exhibit 2. rc.me() says "visitor" (signed_in = false) and never redirects, so the app can simply 4// render its page for nobody. 5 6import "core:strings" 7import "ratcloud:rc" 8 9e02 :: proc() -> Exhibit { 10 return { 11 n = 2, wing = "Identity", 12 title = "Visitors get a real page", 13 promise = "Someone who is not signed in sees the page, not a bounce to a sign-in screen.", 14 block = "rc.me() is a visitor for someone not signed in. The app decides what a visitor sees; the platform never forces a sign-in.", 15 src = {"e02_visitors.odin", #load("e02_visitors.odin", string)}, 16 show = proc(me: ^rc.User) -> string { 17 if me != nil do return `<p>You are signed in. Open this page in a private window: it loads and says "you are a visitor".</p>` 18 return `<p><b>You are a visitor.</b> This whole page loaded without a sign-in.</p>` 19 }, 20 // Load the front page with no cookies at all, as a private window does. 21 check = proc() -> Check { 22 r := get(new_browser(), self_url()) 23 if r.status != 200 || r.location != "" do return fail(cat("a visitor got ", itoa(i64(r.status)), " to " if r.location != "" else "", r.location, " instead of the page")) 24 if !strings.contains(r.body, "You are a visitor") do return fail(`the page loaded but does not say "you are a visitor"`) 25 return pass(`a visitor gets the page (200, no redirect) and it says "you are a visitor"`) 26 }, 27 } 28}