From 58b3c80e8ac76f3682f2757f24a8e1edb9c29f38 Mon Sep 17 00:00:00 2001 From: not manx Date: Sun, 5 Jul 2020 19:11:47 +0000 Subject: [PATCH] Use updated hunchenhelpers --- about.html | 14 -------------- loli.lisp | 19 ++++++------------- lolisp.asd | 2 +- package.lisp | 2 +- 4 files changed, 8 insertions(+), 29 deletions(-) delete mode 100644 about.html diff --git a/about.html b/about.html deleted file mode 100644 index 6d9a52a..0000000 --- a/about.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - -

plum.moe/loli

-

Gets a random loli from lolibooru.

-

By default it only searches for images tagged as safe. You can pass rating=q or rating=e if you're feeling lewd.
Passing rating=-e will randomly choose a non-explicit image and so fourth.

-

Tring to query lolibooru via the URL otherwise will not work.

-

Made by Manx, source available on github.

- - diff --git a/loli.lisp b/loli.lisp index baade1c..e58aeaa 100644 --- a/loli.lisp +++ b/loli.lisp @@ -1,6 +1,5 @@ -(in-package :lolisp) +(in-package #:lolisp) -(defvar @html "text/html") (defparameter *serb* nil "The hunchentoot acceptor (server) that will serve our handlers and files.") @@ -32,7 +31,7 @@ Use cl-rng to pick a random page from the lolibooru API" (defun based-loli (url) (str "data:image/jpeg;base64," (qbase64:encode-bytes (dex:get url)))) -(henh:handle :get (loli :uri "/loli/") @html +(henh:handle (get-loli :get "/loli/") (rating) (cl-who:with-html-output-to-string (x) (:html @@ -43,19 +42,13 @@ Use cl-rng to pick a random page from the lolibooru API" (:style "body{position:relative;}img{object-fit:contain;width:100%;height:100%;}#about{position:absolute;top:8px;right:16px}")) (:body (:img :src (based-loli (loli-link rating))) - (:a :id "about" :href "/loli/about" "about"))) + (:a :id "about" :href "/loli/about.html" "about"))) x)) (defun configure () - (setf *serb* (make-instance 'hunchentoot:easy-acceptor + (setf *serb* (make-instance 'henh:acceptor :port (config-item :port) - :address (config-item :host) - :document-root (config-item :document-root) - :error-template-directory (config-item :error-root) - ;; We (eval) these because quoting streams is werid. - ;; '*standard-ouput* is not of type stream why? - :access-log-destination (eval (config-item :access-log)) - :message-log-destination (eval (config-item :error-log))))) + :document-root (config-item :document-root)))) (defun start () (handler-case (configure) @@ -65,7 +58,7 @@ Use cl-rng to pick a random page from the lolibooru API" (hunchentoot:start *serb*)) (defun stop () - (hunchentoot:stop *serb*)) + (hunchentoot:stop *serb* :soft t)) (export '(configure start diff --git a/lolisp.asd b/lolisp.asd index e0ff7b3..6f370bb 100644 --- a/lolisp.asd +++ b/lolisp.asd @@ -1,4 +1,4 @@ -(asdf:defsystem :lolisp +(asdf:defsystem #:lolisp :description "The worst lolibooru scraper you've ever seen" :author "Manx (boku@plum.moe)" :license "X11/MIT" diff --git a/package.lisp b/package.lisp index 57d0c31..17057ac 100644 --- a/package.lisp +++ b/package.lisp @@ -1,2 +1,2 @@ -(defpackage :lolisp +(defpackage #:lolisp (:use :cl))