This differs from the other file/directory checks because it doesn't create a
directory when it can't find one (usual Common Lisp predicate behaviour with
files/directories).
This is the second part of porting string-is-nil-or-empty? from the utils
package to the validation package. The code between the validation and utils
package was already sorted in a previous commit. This commit to updates where
the web.lisp package calls it.
This is a port I've been meaning to do for a while now; I just haven't got
around to it until now. This commit doesn't refactor the code in web.lisp to
call the ported code from validation -- it's just the first step in the port.
This commit looks like it has more going on that is acutally does. The biggest
mis-directed blobs are the docstring comments I added to get-files-in-directory
and get-file-names. I just never got around to adding them until now.
I remove the format call in make-raw-path because I forgot to do so in another
commit. The code works with or without it which is why I missed it
previously. I'm removing here to clean the code up and before I get distracted
and forget.
The actual code which this commit is mostly for are the get-raw-directories and
get-directory-names. You shouldn't need to use these functions in the normal
operations of the site. They are mostly intended to be used for dealing with the
site's snapshots -- or any other directories outside of the /storage
directory. The snapshot management section of the site is part of the 'danger
zon' features -- hence the need to break-out of the usual '/storage directory'
features.
The most notable ones are the 'copy' functions. The main intention here is to
provide the functionality needed by the snapshot package to help it take
programmatic snapshots of the website's data and database. At the time of
writing the 'restore from snapshot' functionality has not been implemented but
that is something these 'copy' functions will look to help with.
This is a variation on the create-timestamp-id used for generating a
timestamp-id for the Meilisearch database. This text-based timestamp takes the
form of YYYY-MM-DD_HH-MM-SS. The main intention of this function is to use is as
part of a directory name when generating a snapshot (of the website's data/DB).
I will add to this as I add more snapshot features into the main website
code (I.E. HTML templates and routes in web.lisp). At the moment, this package
is a little island right now and doesn't integrate into the rest of the website
at all.
The file-type contains 'image' so the filter assumed it was a .png or .jpg and
the image wouldn't render when it was a .svg file. This additional check to the
filter makes sure the svg.png (stock image file) is used when a thumbnail is
used in a HTML template.
I was going to start on making this function more robust and remove the
hard-coded nature of it but cleary I got distracted and never actually started
it. I know it will need to include the 'build-url' functions in the utils
package but until I get around to actually refactoring this function, I'm going
to leave the code commented out.
This includes the HTTP GET and HTTP POST requests (defroutes in web.lisp). This
is part of the 'danger zone' features because it can leave the website in an
un-recoverable state.
This feature deletes all the user created content stored in the /storage
directory, the website's database (so User Accounts) and wipes the
Meilisearch database clear of the Archive Entries stored in it.
This is part of the 'danger zone' features and intension is to allow the site's
Admin. to clear out the website and start with a fresh clean install.
This function is part of the 'reset website' feature implemention. You should
only need to call this when you want to delete something outsite of the /storage
directory (I.E. the website's database).
This feature is part of the 'danger zone' section in the site's settings. This
feature clears the Meilisearch database (with this site's Archive Entries) and
re-populates it with the data from this website's (nera) database.
The main feature is the repopulate-database function which clears out the
Meilisearch DB index containing this site's searchable information and
repopulates it with the site's nera.db information.
I, also, added a delete-index function (also in search package) but that is
mostly a convenience feature. It allows me to quickly delete any index in the
Meilisearch DB which I made by mistake (E.G. wrong name, change of plan) and
remove old indexes from other projects which are no longer in use (on local
dev. machine mostly).
These functions are mostly aimed at the site's XML-generated site map. The piece
together the site's URL from lack's request struct. I don't know if there is a
pre-built string containing this information (I.E. http://localhost:5000 and
http://localhost:5000/testing) which is why I have written these functions.
When uploading a file to /storage the database stored the un-formatted name and
the file was stored with the formated name. This meant when anyone tried to
download or rename the file, the website would produce an error. This commit
fixes this and has the database and file storage system store the files name in
the formatted way (all lowercase with no whitespace).
This allows you to change the order the search results are returned in. The main
purpose why you would want to use this function in this context is to make sure
the list of results is ordered by the year the artworks where published/created.
The publish date refers to when the artwork was publish which differs from the
'Created At' date. That refers to when the entry was added to the database.
This update is in the nera package. It is part of a refactoring of functionality
to have a seperate 'Publish' date and a 'Created At' date within this site's
database. The 'Created at' date refers to when the entry was added to the
database. The 'Publish' date is the date of the artwork.
This defroute doesn't change anything relevant in the Meilisearch DB so it
doesn't need updating. I've left a comment (mostly for future me) to remind me
not to think I've missed a defroute and try to integrate the Meilisearch stuff
into it.
The defroute to update the thumbnail doesn't need to change but I added a
comment to make it clear in the future -- I can see me forgetting it doesn't
need updating and try to add code which doesn't need to exist.
I, also, did a bit of updating to the layout of the code is parts -- mostly when
setting the alert message.
The re-direct to /search when the user has set /search as the site's home page
is part of a list of other hard-coded re-directs in this site's '/' defroute.
The site now deletes the Archive Entry from the Meilisearch database alongside
the files in the /storage directory and the nera database.
These functions are helper functions to manage the Meiliseach database from
a Common Lisp perspective. The intention is to work them into the website's
back-end so the user can reset or re-populate the database from the website
without me (or someone else) having to SSH into the VM and do fix/restore things
manually. For now, they allow you to manage the database from SLIME.
This change is so the refinements on the seach page shows the month names
instead of thier numbers. This is because most people tend to work with month
names and not numbers in this context.
This is a helper function to convert '1' to 'January', for example. The intended
use for this is to work alongside the local-time package when generating the
month number from a timestamp.
I didn't realise the local-time system set 'Sunday' to '0' in its
timestamp-day-of-week function. I thought it was '7'. This commit changes the
check for '7' to '0' and adds a few comments to help identify which days the cond
form is checking against.
The site now populates the Meilisearch database when the user creates an archive
entry. The Meilisearch needs to be set-up manually at this moment in time so
expect this to break easily if you haven't got Meilisearch working.
I copied most of this over from my personal website's repository. So, there are
bits of code which look a bit out of place in this context. With that said, the
code does run and just needs to be integrated in the defroutes in web.lisp.
The conditions are added to the 'Site Logo' and 'Favicon'
sections/defroutes. The checks are to make sure a user doesn't try to set an MP4
file as the site's favicon or site's logo.
When the user wants to delete their account they must now enter their
username as part of the form they submit. This is so they don't
accidently delete thier account.