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:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -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
									
								
							
							
						
						
									
										3
									
								
								files/photos/README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
# Hyperling.com - files/photos/
 | 
			
		||||
 | 
			
		||||
Used by `http://localhost:8080/photos` to build albums for sharing.
 | 
			
		||||
							
								
								
									
										1
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								main.js
									
									
									
									
									
								
							@@ -210,7 +210,6 @@ async function main() {
 | 
			
		||||
				mime = "text/*";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		console.log("- Extension", extension, "led to MIME", mime);
 | 
			
		||||
 | 
			
		||||
		// Return the file
 | 
			
		||||
		res.contentType(mime);
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user