diff --git a/src/web.lisp b/src/web.lisp index 4c09ccb..5e3cc92 100644 --- a/src/web.lisp +++ b/src/web.lisp @@ -780,6 +780,7 @@ (utils:set-alert "No files provided.") (redirect "/dashboard")) (t (loop :for item :in files :do + ;; TODO: ADD FILES TO DATABASE (IMAGE-TYPE FILE NAME ETC.) (storage:store-file "" "media" (utils:slugify (caddr item)) (cdr item))) @@ -790,6 +791,22 @@ (utils:set-alert "You are not authorised to view this page.") (redirect "/login"))))))) + +(defroute ("/storage/manage" :method :GET) () + (hermetic:auth (:logged-in) + ;; Authorised + (let ((alert (utils:get-and-reset-alert))) + (render #P"/user/storage.html" + (append (auth:auth-user-data) + `(:alert ,alert + :files ,(storage:get-file-names + (storage:get-files-in-directory + "" "media")) + :system-data ,(nera:system-data))))) + ;; Not Authorised + (progn (utils:set-alert "You are not logged in.") + (redirect "/login")))) + ;; ;; Error pages diff --git a/templates/user/dashboard.html b/templates/user/dashboard.html index 900c1c9..25fb9cb 100644 --- a/templates/user/dashboard.html +++ b/templates/user/dashboard.html @@ -5,7 +5,7 @@