Yu-Gi-Oh! Deck Building and Card Inventory Management web interface written in Common Lisp, utilizing HTMX.
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.

36 lines
1.3KB

  1. (in-package #:cl-deck-builder2.web)
  2. ;;
  3. ;; Application
  4. (defclass <web> (<app>) ())
  5. (defvar *web* (make-instance '<web>))
  6. (clear-routing-rules *web*)
  7. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  8. ;; Aha,, figured it out. Hermetic Setup!
  9. (setup
  10. ;; str->bool, t if a username exists, nil otherwise
  11. :user-p (lambda (str)
  12. (ignore-errors
  13. (find-dao 'user :email str)))
  14. ;; str->str, maps a username to a password (hash, hopefully)
  15. :user-pass (lambda (arg)
  16. (ignore-errors
  17. (mito-auth:password-hash
  18. (find-dao 'user :email arg))))
  19. ;; str->(list sym), maps a username to a list of roles,
  20. ;; for example: (:user) (:user :tester :staff) (:user :admin)
  21. :user-roles (lambda (arg)
  22. (ignore-errors
  23. (mapcar #'name-of
  24. (user-roles-of
  25. (find-dao 'user :email arg)))))
  26. ;; the /expression/ for the session object. ningle:*session* on
  27. ;; Ningle <https://github.com/fukamachi/ningle>.
  28. :session caveman2:*session*
  29. ;; A function that displays an "access denied" message
  30. :denied (lambda (&optional params)
  31. (declare (ignore params))
  32. (cl-markup:html5 (:h1 "Generic auth denied page"))))