ftp -o - https://jcs.org/move_in | sh -
at master 38 lines 793 B view raw
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 14if [ X"${IMGUR_ACCESS_TOKEN}" = X"" ]; then 15 echo "\$IMGUR_ACCESS_TOKEN not set" 16 exit 1 17fi 18 19TMP=`mktemp /tmp/imgur.XXXXXX` 20 21curl \ 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 29URL=`sed -e 's/.*"link":"//' -e 's/".*//' < $TMP` 30 31if [ X"$URL" = "" ]; then 32 echo "failed parsing JSON output:" 33 cat $TMP 34else 35 echo $URL 36fi 37 38rm $TMP