ftp -o - https://jcs.org/move_in | sh -

bin/imgur: add

+38
+38
bin/imgur
··· 1 + #!/bin/sh 2 + # 3 + # visit 4 + # https://api.imgur.com/oauth2/addclient 5 + # and register an application with auth type "oauth 2 without a callback" 6 + # 7 + # then visit 8 + # https://api.imgur.com/oauth2/authorize?client_id=#YOUR_CLIENT_ID#&response_type=token 9 + # 10 + # after auth, you'll be redirected to an imgur.com url, save the access_token 11 + # and `export IMGUR_ACCESS_TOKEN=(access token here)` 12 + # 13 + 14 + if [ X"${IMGUR_ACCESS_TOKEN}" = X"" ]; then 15 + echo "\$IMGUR_ACCESS_TOKEN not set" 16 + exit 1 17 + fi 18 + 19 + TMP=`mktemp /tmp/imgur.XXXXXX` 20 + 21 + curl \ 22 + -s \ 23 + -o $TMP \ 24 + -X POST \ 25 + -H "Authorization: Bearer ${IMGUR_ACCESS_TOKEN}" \ 26 + -F "image=@${1}" \ 27 + https://api.imgur.com/3/upload 28 + 29 + URL=`sed -e 's/.*"link":"//' -e 's/".*//' < $TMP` 30 + 31 + if [ X"$URL" = "" ]; then 32 + echo "failed parsing JSON output:" 33 + cat $TMP 34 + else 35 + echo $URL 36 + fi 37 + 38 + rm $TMP