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 @@
Create Page Manage Pages - Manage Files + Manage Files {% if roles.administrator %} Manage Users {% endif %} diff --git a/templates/user/storage.html b/templates/user/storage.html new file mode 100644 index 0000000..d397271 --- /dev/null +++ b/templates/user/storage.html @@ -0,0 +1,27 @@ +{% extends "layouts/default.html" %} +{% block title %}Manage you archive.{% endblock %} +{% block content %} +

Storage

+ +{% for item in files %} +{{item}} +{% endfor %} + +
+

File Upload

+
+ + + + +
+ +
+ + + + +
+
+ +{% endblock %}