From 0ce1aef3e46576f713c26b76e0a702e88f9ddf24 Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Mon, 19 Sep 2022 23:34:44 +0100 Subject: [PATCH] change how site-wide-snippet file is stored and accessed. The site-wide-snippet file is now a .js file and stored in /static/js after the website's first run. --- src/storage.lisp | 4 ++-- src/web.lisp | 4 ++-- templates/layouts/default.html | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/storage.lisp b/src/storage.lisp index 3d2f120..a4a8bd2 100644 --- a/src/storage.lisp +++ b/src/storage.lisp @@ -40,8 +40,8 @@ This is used as part of the /run-set defroute in web.lisp file." (uiop:copy-file (make-path "" "default-assets" "favicon.png") (merge-pathnames "static/images/favicon.png" ritherdon-archive.config:*application-root*)) - (uiop:copy-file (make-path "" "default-assets" "site-wide-snippet") - (merge-pathnames "static/site-wide-snippet" + (uiop:copy-file (make-path "" "default-assets" "site-wide-snippet.js") + (merge-pathnames "static/js/site-wide-snippet.js" ritherdon-archive.config:*application-root*))) (defun directory-exists-p (username directory) diff --git a/src/web.lisp b/src/web.lisp index 5e3cc92..e05ee70 100644 --- a/src/web.lisp +++ b/src/web.lisp @@ -189,7 +189,7 @@ :pages ,(nera:get-all-pages) :system-data ,(nera:system-data) :site-wide-snippet ,(storage:open-text-file-with-raw-path - "static/site-wide-snippet") + "static/js/site-wide-snippet.js") ;; Should this be replaced by `SYSTEM-DATA'? :settings ,(nera:get-site-settings)))) ;; Not Authorised @@ -288,7 +288,7 @@ ;; Authorised (progn (storage:store-text-with-raw-path - "static/site-wide-snippet" code-snippet) + "static/js/site-wide-snippet.js" code-snippet) (utils:set-alert "Site-Wide snippet updated.") (redirect "/site-settings")) ;; Not Authorised diff --git a/templates/layouts/default.html b/templates/layouts/default.html index 5601dfe..780ea49 100644 --- a/templates/layouts/default.html +++ b/templates/layouts/default.html @@ -13,6 +13,7 @@ fabricators, steel, welding, powder paint, archive"> +