17. A new app in a minute
Creating an app gives it an address, a staging twin and a repo to push to.
apps's New app form asks root (through apps's spool, with account's word for who you are) for a new app: its addresses with certificates, and a repo with a first working page already pushed.
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 (live). The zoo's own self-check fetches this page and compares it byte for byte with the file it runs.
e17_new_app.odin sha256 cb0fc9d245fb · raw
1package main 2 3// Exhibit 17. A creator makes an app on apps (apps.<domain>, "New app"): apps files the request with 4// account's assertion for the person, and root makes everything an app is (tools README, "rc new"): 5// the live, staging and preview addresses with certificates, the repo with the seed pushed through 6// the ordinary hooks, so the new address answers with the seed's placeholder page at once. The clone 7// line is on the new app's page. 8// 9// A person checks this: creating apps is invitation only, and an app the robot made could not be 10// taken back (apps offers no "remove"; that is root's `rc rm`), so a self-check would leave one behind 11// every time. On staging apps acts in a pretend world and creates nothing. 12 13import "ratcloud:rc" 14 15e17 :: proc() -> Exhibit { 16 return { 17 n = 17, wing = "Building", kind = "human", 18 title = "A new app in a minute", 19 promise = "Creating an app gives it an address, a staging twin and a repo to push to.", 20 block = "apps's New app form asks root (through apps's spool, with account's word for who you are) for a new app: its addresses with certificates, and a repo with a first working page already pushed.", 21 src = {"e17_new_app.odin", #load("e17_new_app.odin", string)}, 22 show = proc(me: ^rc.User) -> string { 23 staging := "" if env().env == "live" else `<p class="muted">This is staging: its apps acts in a pretend world and creates nothing. Try it on the live zoo.</p>` 24 return cat(`<p>On <a href="`, h(rc.app_url("apps")), `/#new" target="_blank" rel="noopener">apps</a>, <b>New app</b> takes a name (creators only; the owner invites them). Within a minute <code>https://<name>.`, h(env().domain), 25 `/</code> and its <code>-staging</code> twin answer with a placeholder page, and the app's page there shows the line to clone it.</p>`, staging, seen_button(17, me, "I made an app and its address answered")) 26 }, 27 } 28}