From c07d7af7266b9436c8aa86ca6394678d1a75fa55 Mon Sep 17 00:00:00 2001
From: Zach DeCook
Date: Thu, 11 Apr 2024 20:44:16 -0400
Subject: gcc.sh: Cache the hymn pages
Some crawlers hit them a lot... this should make it a lot faster
---
gcc.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
(limited to 'gcc.sh')
diff --git a/gcc.sh b/gcc.sh
index d831072..89ec94c 100755
--- a/gcc.sh
+++ b/gcc.sh
@@ -25,6 +25,12 @@ fi
printf "20 text/gemini\r\n"
printf "=>/cgi-bin/gcc.sh$PATH_INFO?.mp3 Listen to this!\n"
+
+if test -e "gcc.cache$PATH_INFO"; then
+ cat "gcc.cache$PATH_INFO"
+ exit 0
+fi
+
wget -q -O - https://gccsatx.com/hymns$PATH_INFO/ \
| grep -o '\(\|\|\)[^<>]*\(
\|
\|
\)' \
| sed 's@
@@g'| sed 's@^@\n## @g' | sed 's@@@g' | sed 's@@@g' | sed 's@@@g' \
@@ -33,5 +39,5 @@ wget -q -O - https://gccsatx.com/hymns$PATH_INFO/ \
| grep -v '!important' | grep -v '}\|{\|wp-smiley' \
| sed 's/‘/‘/g' |sed 's/’/’/g' | sed 's/”/”/g' | sed 's/“/“/g'\
| grep -v 'this website' \
-| sed -r '/^\s*$/d'
+| sed -r '/^\s*$/d' | tee "gcc.cache$PATH_INFO"
exit 0
--
cgit 1.4.1