You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

(in-package :lolisp)
(defvar *serb* nil
"The hunchentoot acceptor (server) that will serve our handlers and
files.")
(defun configure ()
(configure-loligram)
(setf *serb* (make-instance 'toot:acceptor
:port (config-item :port)
:name 'lolisp)))
(defun start ()
(handler-case (configure)
(error (e) "Configuration failed: ~a" e))
(when (null *serb*)
(error "Serb is nill? ehh?"))
(hunchentoot:start *serb*))
(defun stop ()
(hunchentoot:stop *serb* :soft t))
(toot:handle (get-loli :get "/loli/"
:acceptor 'lolisp)
(rating)
(let ((loli (rori:loli-get (or rating "s"))))
(cl-who:with-html-output-to-string (page)
(:html
(:head
(:meta :charset "utf-8")
(:meta :name "viewport" :content "width=device-width, initial-scale=1")
(:title "lolisp")
(:link :rel "stylesheet" :href "https://plum.moe/static/css/style.css")
(:link :rel "stylesheet" :href "https://plum.moe/static/css/loli.css"))
(:body
(:img :src (rori:based-loli (cdr (assoc :file-url loli))))
(:p :id "tags" (format page "~a" (cdr (assoc :tags loli))))
(:a :id "about" :href "/loli/about.html" "about"))))))