Print gopherddit.com URL for reddit subreddit/posts - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit 661a29d0d1360989d5d63d40ca881bb4dda3cc0d DIR parent b6271f14be75c4cfb7b156b1a789bd8ba9009674 HTML Author: Leonardo Taccari <iamleot@gmail.com> Date: Sun, 10 May 2020 23:12:03 +0200 Print gopherddit.com URL for reddit subreddit/posts Signed-off-by: Annna Robert-Houdin <annna@bitreich.org> Diffstat: M annna-start-services | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --- DIR diff --git a/annna-start-services b/annna-start-services @@ -146,7 +146,18 @@ then *www.reddit.com*) nurl="$(printf '%s\n' "${uri}" | sed "s;www.reddit.com;old.reddit.com;")" purl="$(9 htmlfmt < "${tmpf}" | /br/bin/bitreich-paste)" - annna-say -c '#bitreich-en' "old.reddit: ${nurl} ; content: ${purl}" + if [ -n "${uri#*www.reddit.com/r/*}" ]; then + subreddit="$(printf '%s\n' "${uri}" | cut -d / -f 5)" + post="$(printf '%s\n' "${uri}" | cut -d / -f 7)" + if [ -n "${post}" ]; then + gurl="gopher://gopherddit.com/1/cgi-bin/reddit.cgi?view&${post}&${subreddit}&10" + else + gurl="gopher://gopherddit.com/1/cgi-bin/reddit.cgi?menu&${subreddit}&10" + fi + annna-say -c '#bitreich-en' "old.reddit: ${nurl} ; gopherddit: ${gurl} ; content: ${purl}" + else + annna-say -c '#bitreich-en' "old.reddit: ${nurl} ; content: ${purl}" + fi # Hack, Hack, Hack. wikipedia=1 ;;