diff options
-rw-r--r-- | dnd.asd | 3 | ||||
-rw-r--r-- | endpoints.lisp | 11 | ||||
-rw-r--r-- | pages.lisp | 4 |
3 files changed, 12 insertions, 6 deletions
@@ -17,7 +17,8 @@ #:parenscript #:derrida #:ironclad - #:jonathan) + #:jonathan + #:quri) :components ((:file "package") (:file "utilities") (:file "init") diff --git a/endpoints.lisp b/endpoints.lisp index 5c2a656..19be125 100644 --- a/endpoints.lisp +++ b/endpoints.lisp @@ -14,8 +14,9 @@ (defendpoint* :get "/" () () (redirect-to "/tavern-door")) -(defendpoint* :get "/tavern-door" () () - (doorkeeper)) +(defendpoint* :get "/tavern-door" ((name str)) () + (if name (doorkeeper :message (format nil "M'fraid I've n'er 'eard o' ~a." name)) + (doorkeeper))) (defendpoint* :post "/tavern-door" () () (with-plist ((name :name)) (lzb:request-body) @@ -24,7 +25,7 @@ (lzb:set-response-cookie +session-cookie-name+ (session-id sesh) :path "/" :domain "localhost") (redirect-to "/tavern")) - (redirect-to "/tavern-door")))) + (redirect-to (format nil "/tavern-door?name=~a" (quri:url-encode name)))))) (defendpoint* :get "/godess-shrine" () () (godess-shrine)) @@ -40,6 +41,10 @@ (with-hero-session (hero) (tavern hero))) +(defun str (string) + "A String" + string) + (defun redirect-to (location) "Set the lazybones response header and response code for redirecting to LOCATION. This procedure will error if lazybones:*request* is not currently bound." @@ -19,9 +19,9 @@ (:input :name "NAME") (:button :type "submit" "Pray To The Goddess")))) -(defun doorkeeper () +(defun doorkeeper (&key (message "Wot's yer name 'ero?")) (with-page (:title "Tavern Door") - (:h1 "Wot's yer name 'ero?") + (:h1 message) (:form :method "POST" :action "/tavern-door" (:label :for "NAME" "Thy Hero's Appelation:") (:input :name "NAME") |