@ -1067,29 +1067,77 @@
( utils:set-alert "File uploaded is not an image. Thumbnail not updated." )
( redirect ( format nil "/edit/archive/~a" archive-slug ) ) )
( t ( utils:set-alert "Thumbnail updated." )
( storage:store-file
""
"archive"
( archive::thumbnail-slug-of
( nera:get-archive-entry :slug archive-slug ) )
thumbnail-file )
( t ( storage:remove-file "" "archive"
( archive::thumbnail-slug-of
( nera:get-archive-entry :slug archive-slug ) ) )
( storage:store-file "" "archive"
( cadr thumbnail-file )
thumbnail-file )
( nera:update-archive-entry-property
:slug archive-slug
:property 'archive::thumbnail-file-type-of
:value ( caddr thumbnail-file ) )
( nera:update-archive-entry-property
:slug archive-slug
:property 'archive::thumbnail-slug-of
:value ( cadr thumbnail-file ) )
( utils:create-thumbnail
"archive"
( archive::thumbnail-slug-of
( nera:get-archive-entry :slug archive-slug ) )
t )
;; Integrate updating Meilisearch here.
( utils:set-alert "Thumbnail updated." )
( redirect ( format nil "/edit/archive/~a" archive-slug ) ) ) )
;; Not Authorised
( progn ( utils:set-alert "You are not authorised to delete this archive entry." )
( redirect "/login" ) ) ) ) ) ) )
( defroute ( "/rename/archive-entry" :method :POST ) ( )
( destructuring-bind
( &key id archive-slug new-title authenticity-token &allow-other-keys )
( utils:request-params ( lack.request:request-body-parameters ningle:*request* ) )
( cond ( ( not ( string= authenticity-token ( auth:csrf-token ) ) )
` ( , +forbidden+ ( :content-type "text/plain" ) ( "Denied" ) ) )
( t ( hermetic:auth
( :administrator )
;; Authorised
( cond ( ( find t ( mapcar #' utils:string-is-nil-or-empty?
` ( , id , archive-slug , new-title ) ) )
( utils:set-alert "Missing data. Archive entry not renamed." )
( redirect "/user/archive" ) )
( ( null ( nera:get-archive-entry :slug archive-slug ) )
( utils:set-alert "Cannot file archive entry. Archive entry not updated." )
( redirect "/user/archive" ) )
( t ( storage:rename-content-file
"" "archive"
( archive::slug-of ( nera:get-archive-entry :id ( parse-integer id ) ) )
( utils:format-filename ( format nil "~a.html" new-title ) ) )
( nera:update-archive-entry-property
:slug archive-slug
:property 'archive::title-of
:value new-title )
( nera:update-archive-entry-property
:slug archive-slug
:property 'archive::slug-of
:value ( utils:format-filename ( format nil "~a.html" new-title ) ) )
;; Integrate updating Meilisearch here.
( utils:set-alert "Archive entry updated." )
( redirect
( format nil
"/edit/archive/~a"
( utils:format-filename ( format nil "~a.html" new-title ) ) ) ) ) )
;; Not Authorised
( progn ( utils:set-alert "You are not authorised to delete this archive entry." )
( redirect "/login" ) ) ) ) ) ) )
( defroute ( "/edit/archive-keywords" :method :POST ) ( )
( utils:set-alert "ROUTE NOT IMPLEMENTED" )
( redirect "/user/archive" ) )