Skip to content

Instantly share code, notes, and snippets.

@rgchris rgchris/addsite.reb
Last active Dec 31, 2015

What would you like to do?
Rebol [
Title: "Add a Site"
Type: 'controller
File: %app/controllers/addsite.r
route () to submit [ ; where submit is %app/views/addsite/submit.html.rsp
get [] ; shows the form
put [
if verify [
submission: get-params/body 'site [
reject 400 "No New Site data"
submission: validate submission [
name: string! length is less-than 50
info: opt string! length is less-than 240
site: url!
][] ; doing nothing will show the form again
attempt [load/header submission/site][
reject 400 "Could not reach your site"
sites-list: read index: wrt://site/rebsite.r ; uses the internal wrt:// filesystem scheme
write index append sites-list join newline remold [
'folder submission/name submission/site 'icon 'site 'info submission/info
redirect-to %/show?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.