Enhance Photos Page (#9)

* Remove test output.

* Add back buttons.

* Add explicit photos directory.

* Allow subdirectories in files, but not photos.
This commit is contained in:
Hyperling 2024-01-24 13:57:05 +00:00 committed by GitHub
parent 2fa8b555e7
commit adc8f29f0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 4 deletions

2
.gitignore vendored
View File

@ -105,4 +105,4 @@ dist
## Above is Github's recommendations for Node.js. Below are my additions. ##
package-lock.json
files/*
files/photos/*

3
files/photos/README.md Normal file
View File

@ -0,0 +1,3 @@
# Hyperling.com - files/photos/
Used by `http://localhost:8080/photos` to build albums for sharing.

View File

@ -210,7 +210,6 @@ async function main() {
mime = "text/*";
break;
}
console.log("- Extension", extension, "led to MIME", mime);
// Return the file
res.contentType(mime);

View File

@ -31,11 +31,17 @@ ls files/photos/ | sort -r | while read album; do
echo -e "target='_blank' rel='noopener noreferrer'>$album_name</a></h2>"
echo -e "\t\t<div class='col-12 text'>"
# Create index for each photo album based on its contents.
# Create index page for each photo ALBUM based on its contents.
page=""
subpage="files/photos/$album/index.html"
$HELPER_DIR/body_open.php > $subpage
echo -e "\n\t\t<h1 class='col-12 title'>$album_name</h1>" >> $subpage
# Add a back button
echo -en "\n\t\t<a href='/photos'>" >> $subpage
echo -e "<h3 class='col-12 title'>Back</h3></a>" >> $subpage
# Build the ALBUM page.
echo -e "\t\t<h1 class='col-12 title'>$album_name</h1>" >> $subpage
ls files/photos/$album/* | sort | while read photo; do
# Do not include the index page.
if [[ $photo == *"index.html" ]]; then
@ -91,6 +97,10 @@ ls files/photos/ | sort -r | while read album; do
# End album on PHOTOS page.
echo -e "\t\t</div>"
# Add a final back button
echo -en "\t\t<a href='/photos'>" >> $subpage
echo -e "<h3 class='col-12 title'>Back</h3></a>" >> $subpage
# Close out the ALBUM's page.
$HELPER_DIR/body_close.php >> $subpage
done