From cd7072a5eff1a015ae681e4442ae7a81c05f60c6 Mon Sep 17 00:00:00 2001 From: deepend Date: Wed, 13 Dec 2023 17:54:34 +0000 Subject: [PATCH] changes contributed by ~seifferth --- gemlog.gmi | 46 ++++++++++++++++++++++++++++++++++++++++++++++ index.gmi | 39 +++++++++++++++++++++------------------ security.txt | 1 + users-lastmod.gmi | 18 ++++++++++++++++++ users.gmi | 19 +++++++++++++++++++ 5 files changed, 105 insertions(+), 18 deletions(-) create mode 100755 gemlog.gmi create mode 100644 security.txt create mode 100755 users-lastmod.gmi create mode 100755 users.gmi diff --git a/gemlog.gmi b/gemlog.gmi new file mode 100755 index 0000000..2b404ac --- /dev/null +++ b/gemlog.gmi @@ -0,0 +1,46 @@ +#!/bin/sh + +printf "20 text/gemini\r\n" + +cat < index.gmi back to main index + +# Aggregated gemlog for all users of tilde.club + +While this is an aggregated gemlog for all users, this does not imply that it is also a list of all posts. For one thing, this aggregated gemlog only includes links that follow the gemini companion specification for subscribing to text/gemini pages. For another, it only includes links found in one of only a few prominent entry points that are suspected of containing gemlogs (such as the main index.gmi file of a capsule or a file called gemlog.gmi, for example). If you are a tilde.club user and your gemlog is not included in the list, please feel free to request its inclusion by sending an email to seifferth@tilde.club. + +EOF +get() { +grep \ + '^=>[ ]\+[^ ]\+[ ]\+[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]' \ + -s "$@" | + sed 's,\t, ,g;s, *$,, + s,^/home/,, + + # Link processing in sed can be quite messy; Hence the comments + # on this part of the script. + # + # Process absolute links containing a scheme and all + s,\([^/]\+\)/public_gemini/[^:]*:=> *\([a-z]\+://\),\1\t\2, + # Process absolute links that do not contain any scheme. This + # includes scheme-relative and site-relative links and should + # work fine in both cases. + s,\([^/]\+\)/public_gemini/[^:]*:=> */,\1\t/, + # Treat all remaining links as relative to the file’s location. + s,\([^/]\+\)/public_gemini/\([^:]*/\)\?[^:]*:=> *,\1\t/~\1/\2, + + s,^\([^\t]\+\)\t\(.*\)$,\2\t\1, + s,^\([^ ]*\) \+\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\)[ :-]*,\2\t\1 \2 ,' +} +( get \ + /home/*/public_gemini/index.gmi \ + /home/*/public_gemini/gemlog.gmi \ + /home/*/public_gemini/blog.gmi \ + /home/*/public_gemini/gemlog/index.gmi \ + /home/*/public_gemini/gemlog/all.gmi \ + /home/*/public_gemini/blog/index.gmi \ + /home/*/public_gemini/blog/all.gmi \ + /home/*/public_gemini/text/gemlog.gmi \ + /home/*/public_gemini/journal/index.gmi \ + /home/*/public_gemini/log/index.gmi +) | sort -r | uniq | sed 's,^[^\t]\+\t,,;s,^\(.*\)\t\([^\t]*\)$,=> \1 (by ~\2),' diff --git a/index.gmi b/index.gmi index b7056a1..f9cacaf 100755 --- a/index.gmi +++ b/index.gmi @@ -2,23 +2,26 @@ printf "20 text/gemini\r\n" -printf "hello gemini!!\n" -printf '```\n' -cowsay WELCOME TO TILDE.CLUB A PLACE FOR WEBPAGES -printf '```\n' -printf "\n" -printf "we're a a digital community for socializing, \n" -printf "learning, and making cool stuff\n" -printf "\n" -printf "visit us in gopher and html lands for more info\n" -printf "\n" -printf "here are our esteemed users:\n" -printf "if you're not appearing here, mkdir ~/public_gemini\n" +cat < gemini://tilde.club/~%s/ ~%s\n" "$user" "$user" - fi -done +We're a a digital community for socializing, learning, and making cool stuff. Visit us in gopher and html lands for more info. + +Here are some recent gemlog posts by our esteemed users: + +$(./gemlog.gmi | grep \ + '^=>[ \t]\+[^ ]\+[ \t]\+[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]' | + head -n6) + +=> gemlog.gmi See the complete list of aggregated gemlog posts + + +To see a complete list of gemini users on this server, choose one of the following links: + +=> users.gmi All gemini users (sorted alphabetically) +=> users-lastmod.gmi All gemini users (sorted by last modification of their gemini capsule) +EOF diff --git a/security.txt b/security.txt new file mode 100644 index 0000000..f747b28 --- /dev/null +++ b/security.txt @@ -0,0 +1 @@ +root@tilde.club diff --git a/users-lastmod.gmi b/users-lastmod.gmi new file mode 100755 index 0000000..10e69f8 --- /dev/null +++ b/users-lastmod.gmi @@ -0,0 +1,18 @@ +#!/bin/sh + +printf "20 text/gemini\r\n" + +cat < index.gmi back to main index + +# Users sorted by last modification of their gemini capsule + +EOF + +for user in $(ls -d1 /home/*/public_gemini|sed 's,^/home/,,;s,/public_gemini$,,'); do + if ! cmp -s /etc/skel/public_gemini/index.gmi /home/$user/public_gemini/index.gmi; then + date="$(find "/home/$user/public_gemini" -type f -printf '%CF\n'|sort -r|head -n1)" + test "$date" || continue + printf "%s\t=> gemini://tilde.club/~%s/ ~%s\n" "$date" "$user" "$user" + fi +done | sort -k1,1r | sed 's,^\([^\t]*\)\t\([^\t]*\)$,\2 (modified \1),' diff --git a/users.gmi b/users.gmi new file mode 100755 index 0000000..40f1947 --- /dev/null +++ b/users.gmi @@ -0,0 +1,19 @@ +#!/bin/sh + +printf "20 text/gemini\r\n" + +cat < index.gmi back to main index + +# Users sorted alphabetically + +EOF + +for user in $(ls -d1 /home/*/public_gemini|sed 's,^/home/,,;s,/public_gemini$,,'); do + if ! cmp -s /etc/skel/public_gemini/index.gmi /home/$user/public_gemini/index.gmi; then + # Skip empty public_gemini directories + test $(find /home/$user/public_gemini -type f|head -n1|wc -l) -gt 0 || continue + # Print link + printf "=> gemini://tilde.club/~%s/ ~%s\n" "$user" "$user" + fi +done