diff options
Diffstat (limited to 'fussy.lisp')
-rw-r--r-- | fussy.lisp | 25 |
1 files changed, 21 insertions, 4 deletions
@@ -238,6 +238,7 @@ returns a list of those names." fussy-el :std "" :documentation "These paths are by default equal to the config directory.") + (robots.txt :std "robots.txt") (logfile :std "fussy.log") (port :std 8888) (domain :std "localhost") @@ -252,8 +253,18 @@ directory is used as a default directory for all relative paths mentioned in the config file. Any Absolute paths in the config file are treated as such.") +(defun config-directory () + (or *config-directory* + (uiop:merge-pathnames* (user-homedir-pathname) ".fussy/"))) + +(defun robots-path-name (&optional (config *config*)) + (uiop:merge-pathnames* (config-directory) (robots.txt config))) + +(defun logfile-path-name (&optional (config *config*)) + (uiop:merge-pathnames* (config-directory) (logfile config))) + (defun fussy-log (msg &rest args) - (with-open-file (out (logfile *config*) + (with-open-file (out (logfile-path-name) :direction :output :if-exists :append :if-does-not-exist :create) @@ -270,10 +281,10 @@ are treated as such.") (read-from-string (a:read-file-into-string file)))) (defun full-store-directory (&optional (config *config*)) - (uiop:merge-pathnames* (store-directory config) *config-directory*)) + (uiop:merge-pathnames* (store-directory config) (config-directory))) (defun full-theme-image-directory (&optional (config *config*)) - (uiop:merge-pathnames* (theme-image-directory config) *config-directory*)) + (uiop:merge-pathnames* (theme-image-directory config) (config-directory))) (defun emacs-dot-d-directory (&optional (config *config*)) (uiop:merge-pathnames* ".emacs.d/" (full-theme-image-directory config))) @@ -304,7 +315,7 @@ that they are not loaded during image gen.") (mapcar downcaser +standard-themes+)))) (defun fussy-elisp-script-location (&optional (config *config*)) - (uiop:merge-pathnames* *config-directory* (fussy-el config))) + (uiop:merge-pathnames* (config-directory) (fussy-el config))) (defun format-emacs-evocation-script (package-names) (format @@ -534,6 +545,12 @@ h1 { (setf (lzb:response-header :content-type) "text/css") +style-css+) +(lzb:defendpoint* :get "/robots.txt" () () + "Endpoint for serving robots.txt" + (setf (lzb:response-header :content-type) "text/plain") + (or (uiop:file-exists-p (robots-path-name)) + "")) + (lzb:defendpoint* :get "/images/:pkg:/:theme:/:image:" () () "Endpoint for serving theme preview images" (let ((file-path |