USING: kernel furnace.actions sequences validators accessors html.forms http.server.responses http.server.dispatchers formatting assocs ; USING: bonerbonerboner.dns ; IN: bonerbonerboner.actions TUPLE: bbb-dispatcher < dispatcher ; : v-valid-subdomain ( str -- subdomain ) dup get-subdomains member? [ "not a valid subdomain" throw ] unless ; : validate-subdomain ( -- ) { { "name" [ v-required v-valid-subdomain ] } } validate-params ; : ( -- action ) [ validate-subdomain "name" value "subdomain" set-value ] >>init { bbb-dispatcher "subdomains" } >>template ; : <404-subdomain-action> ( -- action ) [ "_404" "subdomain" set-value ] >>init { bbb-dispatcher "subdomains" } >>template ; : ( -- action ) [ "bonerbonerboner" ] >>display ; TUPLE: subdomain-link subdomain url ; : get-subdomain-links ( -- subdomain-links ) get-subdomains [ "bbb" = ] reject [ first dup "https://%s.bonerbonerboner.com" sprintf subdomain-link boa ] map ; : ( -- action ) [ get-subdomain-links "subdomains" set-value ] >>init { bbb-dispatcher "meta" } >>template ;