Repo containing scripts to be used with dovel, and git hooks that powers our web interface.
Author: brian (git@myr.sh)
Date: Sun Sep 24 22:51:54 2023 -0300
Parent: ac98072
Added escape html function
diff --git a/aux.sh b/aux.sh new file mode 100755 index 0000000..91ef1cc --- /dev/null +++ b/aux.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +escapehtml() { + printf "$1" | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/&/g' +} diff --git a/post-receive-scripts b/post-receive-scripts index 06bb085..a0d0359 100755 --- a/post-receive-scripts +++ b/post-receive-scripts @@ -26,6 +26,7 @@ do cp "$TMP/update-git-index" "$dir/hooks/" cp "$TMP/update-repo-index" "$dir/hooks/" cp "$TMP/update-repo-tree" "$dir/hooks/" + cp "$TMP/aux.sh" "$dir/hooks/" done # for this repo copy scripts diff --git a/update-repo-tree b/update-repo-tree index 2203be1..2c3dc8b 100755 --- a/update-repo-tree +++ b/update-repo-tree @@ -4,8 +4,9 @@ # set -ex echo "updating git tree" -OUT="$HOME/www/dovel.email/$REPO" +. aux.sh +OUT="$HOME/www/dovel.email/$REPO" createfilepage() { cat <<- EOF <!DOCTYPE html> @@ -56,14 +57,17 @@ createfilepage() { </nav> <p><i>$(cat description)</i></p> </center> + <kbd>curl https://dovel.email/$REPO/$REPO.zip</kbd> <hr> <h2>$1</h2> <pre> <ol> EOF + + # print file while IFS= read -r l do - printf "<li>%s</li>\n" "$l" + printf "<li>%s</li>\n" "$(escapehtml "$l")" done < "$OUT/tree/$1" echo "</ol>\n</pre>\n</body>\n</html>"