package main // Exhibit 2. rc.me() says "visitor" (signed_in = false) and never redirects, so the app can simply // render its page for nobody. import "core:strings" import "ratcloud:rc" e02 :: proc() -> Exhibit { return { n = 2, wing = "Identity", title = "Visitors get a real page", promise = "Someone who is not signed in sees the page, not a bounce to a sign-in screen.", 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.", src = {"e02_visitors.odin", #load("e02_visitors.odin", string)}, show = proc(me: ^rc.User) -> string { if me != nil do return `
You are signed in. Open this page in a private window: it loads and says "you are a visitor".
` return `You are a visitor. This whole page loaded without a sign-in.
` }, // Load the front page with no cookies at all, as a private window does. check = proc() -> Check { r := get(new_browser(), self_url()) 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")) if !strings.contains(r.body, "You are a visitor") do return fail(`the page loaded but does not say "you are a visitor"`) return pass(`a visitor gets the page (200, no redirect) and it says "you are a visitor"`) }, } }