commit ab3a109fc3296a1bee3d31773851f62cd58f9675 parent d2b3a52e670803067793864f506ac4a5b351a490 Author: parazyd <parazyd@dyne.org> Date: Wed, 7 Feb 2018 18:24:31 +0100 Gopherize autoup Diffstat:
M | autoup | | | 29 | +++++++++++++++++++---------- |
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/autoup b/autoup @@ -1,8 +1,5 @@ #!/bin/sh - -sshuser=parazyd -sshkey="$HOME/.ssh/id_ed25519" -server=pub.parazyd.cf +server=parazyd.cf webroot=/home/parazyd/public_html/pub.parazyd.cf webdir=dev/random @@ -22,7 +19,7 @@ test -z "$1" && exit 1 || filename=$(basename $1) case "$filename" in *_scrot.png|*_scrot.jpg) webdir=tmp/screenshots - num=$(echo $(lynx -dump https://pub.parazyd.cf/tmp/screenshots \ + num=$(echo $(lynx -dump https://parazyd.cf/pub/tmp/screenshots \ | tail -n1 | tr -d '[a-z]./:' | awk '{print $2}') + 1 | bc) if [ "$num" -lt 100 ]; then num="00$num" @@ -30,10 +27,22 @@ case "$filename" in num="0$num" fi filename="screenshot${num}.png" - ;; + goph=I + ;; + *.png|*.jpg) + goph=I + ;; + *.txt|*.html|*.css|*.sh) + goph=0 + ;; + *.gif) + goph=g + ;; + *) + goph=9 + ;; esac -scp -i "$sshkey" "$1" "${sshuser}@${server}:${webroot}/${webdir}/${filename}" || exit 1 -echo "https://$server/$webdir/$filename" | xclip -i -echo "https://$server/$webdir/$filename" -#rm $1 +scp "$1" "${server}:${webroot}/${webdir}/${filename}" || exit 1 +echo "https://$server/pub/$webdir/$filename" +echo "gopher://$server/$goph/pub/dev/random"