|
|
|
@ -971,7 +971,6 @@
|
|
|
|
|
authenticity-token &allow-other-keys) |
|
|
|
|
(utils:request-params |
|
|
|
|
(lack.request:request-body-parameters ningle:*request*)) |
|
|
|
|
(step |
|
|
|
|
(cond ((not (string= authenticity-token (auth:csrf-token))) |
|
|
|
|
`(,+forbidden+ (:content-type "text/plain") ("Denied"))) |
|
|
|
|
(t (hermetic:auth |
|
|
|
@ -995,29 +994,40 @@
|
|
|
|
|
:keywords ,keywords |
|
|
|
|
:data ,page-content)))) |
|
|
|
|
|
|
|
|
|
;; Add condition to check thumbnail-file is an image file. |
|
|
|
|
((not (str:contains? |
|
|
|
|
"image" (caddr thumbnail-file) :ignore-case t)) |
|
|
|
|
(render |
|
|
|
|
"/user/create-archive.html" |
|
|
|
|
(append (auth:auth-user-data) |
|
|
|
|
`(:alert "File uploaded is not an image. Entry not created.." |
|
|
|
|
:title ,title |
|
|
|
|
:keywords ,keywords |
|
|
|
|
:data ,page-content)))) |
|
|
|
|
|
|
|
|
|
(t (nera:create-archive-entry |
|
|
|
|
title |
|
|
|
|
(utils:create-timestamp-id) |
|
|
|
|
(utils:slugify title) |
|
|
|
|
;; Add the 'thumbnail' pre-fix here? |
|
|
|
|
(utils:slugify (cadr thumbnail-file)) ; File Name |
|
|
|
|
(format nil "~a.html" (utils:slugify title)) |
|
|
|
|
(utils:format-filename (cadr thumbnail-file)) ; File Name |
|
|
|
|
(caddr thumbnail-file) ; File Type |
|
|
|
|
(utils:asciify keywords)) |
|
|
|
|
(utils:format-keywords keywords)) |
|
|
|
|
;; parse info and enter into meilisearch database. |
|
|
|
|
;; Use placeholder thumbnail if one not detected. |
|
|
|
|
(storage:store-text "" "archive" (utils:slugify title) page-content) |
|
|
|
|
;; Use placeholder thumbnail if one not detected? |
|
|
|
|
(storage:store-text |
|
|
|
|
"" "archive" |
|
|
|
|
(format nil "~a.html" (utils:slugify title)) |
|
|
|
|
page-content) |
|
|
|
|
(storage:store-file |
|
|
|
|
"" "archive" (utils:slugify (cadr thumbnail-file)) thumbnail-file) |
|
|
|
|
;; Add pre-fix option and just overwrite the original file? |
|
|
|
|
(utils:create-thumbnail "archive" (utils:slugify (cadr thumbnail-file))) |
|
|
|
|
"" "archive" |
|
|
|
|
(utils:format-filename (cadr thumbnail-file)) |
|
|
|
|
thumbnail-file) |
|
|
|
|
(utils:create-thumbnail ; Overwrites the original here. |
|
|
|
|
"archive" (utils:slugify (cadr thumbnail-file)) t) |
|
|
|
|
(utils:set-alert "Archive entry created. Great Success!") |
|
|
|
|
(storage:remove-file "" "archive" (utils:slugify (cadr thumbnail-file))) |
|
|
|
|
(redirect "/dashboard"))) |
|
|
|
|
;; Not Authorised |
|
|
|
|
(progn (utils:set-alert "You are not logged in.") |
|
|
|
|
(redirect "/login")))))))) |
|
|
|
|
(redirect "/login"))))))) |
|
|
|
|
|
|
|
|
|
;; |
|
|
|
|
;; Error pages |
|
|
|
|