Yu-Gi-Oh! Deck Building and Card Inventory Management web interface written in Common Lisp, utilizing HTMX.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

77 lines
2.6KB

  1. (in-package #:cl-user)
  2. (defpackage #:cl-deck-builder2.app
  3. (:use #:cl)
  4. (:import-from #:mito-attachment
  5. #:*storage*
  6. #:s3-storage
  7. #:disk-storage
  8. #:disk-storage-mount-path)
  9. (:import-from #:lack.builder
  10. #:builder)
  11. (:import-from #:ppcre
  12. #:scan)
  13. (:import-from #:cl-deck-builder2.web
  14. #:*web*
  15. #:make-chat-server)
  16. (:import-from #:cl-deck-builder2.config
  17. #:config
  18. #:productionp
  19. #:*public-directory*
  20. #:*static-directory*)
  21. (:import-from #:cl-deck-builder2.toolkit
  22. #:git-revision)
  23. (:documentation "The package the app file executes in. Passed to ~CLACK:CLACKUP~ function."))
  24. (in-package #:cl-deck-builder2.app)
  25. (defparameter *git-revision* (git-revision))
  26. (setf *storage*
  27. (if (productionp)
  28. ;; Store files in AWS S3 for production environment
  29. (make-instance 's3-storage
  30. :bucket "mito-attachment-example"
  31. :endpoint "s3-ap-northeast-1.amazonaws.com"
  32. :access-key (uiop:getenv "AWS_ACCESS_KEY")
  33. :secret-key (uiop:getenv "AWS_SECRET_KEY"))
  34. ;; Store files in local filesystem for development environment
  35. (make-instance 'disk-storage
  36. :bucket "mito-attachment-example"
  37. :directory (merge-pathnames "attachment" *public-directory*))))
  38. (builder
  39. (:static
  40. :path (lambda (path)
  41. (if (ppcre:scan "^(?:/img/|/css/|/js/|/webfonts/|/robot\\.txt$|/favicon\\.(ico|png)|/manifest\\.json$)" path)
  42. path
  43. nil))
  44. :root *static-directory*)
  45. (:static
  46. :path "/public/"
  47. :root *public-directory*)
  48. (if (productionp)
  49. nil
  50. :accesslog)
  51. (if (getf (config) :error-log)
  52. `(:backtrace
  53. :output ,(getf (config) :error-log))
  54. nil)
  55. :session
  56. :csrf
  57. (when (typep *storage* 'disk-storage)
  58. `(:mount ,(disk-storage-mount-path *storage*) ,*storage*))
  59. (:clack-errors :debug t)
  60. (if (productionp)
  61. nil
  62. (lambda (app)
  63. (lambda (env)
  64. (let ((datafly:*trace-sql* t))
  65. (setf (getf djula:*default-template-arguments* :git-revision) *git-revision*
  66. (getf djula:*default-template-arguments* :server-name) "phntsm.ddns.net")
  67. (funcall app env)))))
  68. (:mount "/label-maker" cl-deck-builder2.web.label-maker:*web*)
  69. (:mount "/tinymce" cl-deck-builder2.web.tinymce:*web*)
  70. (:mount "/chat-server" #'cl-deck-builder2.web.sse:make-chat-server)
  71. *web*)