Added support for imgur using my own api key

This commit is contained in:
Dylan Araps 2016-10-02 21:57:52 +11:00
parent 8b9a8ac3d9
commit fb3cd92b96
3 changed files with 12 additions and 1 deletions

View file

@ -409,6 +409,11 @@ scrot_name="neofetch-$(date +%F-%I-%M-%S-${RANDOM}).png"
# Possible values: teknik,
image_host="teknik"
# Imgur api key
# This is an api key for neofetch, you can sign up for your own
# here: http://api.imgur.com/oauth2/addclient
imgur_client_id="0e8b44d15e9fc95"
# }}}

View file

@ -2303,9 +2303,15 @@ scrot_upload() {
case "$image_host" in
"teknik")
image_url="$(curl -sf -F file="@${image_file}" 'https://api.teknik.io/v1/Upload')"
image_url="$(curl -sf -F file="@${image_file}" "https://api.teknik.io/v1/Upload")"
image_url="$(awk -F 'url:|,' '{printf $2}' <<< "${image_url//\"}")"
;;
"imgur")
image_url="$(curl -sH "Authorization: Client-ID $imgur_client_id" -F "image=@${image_file}" "https://api.imgur.com/3/upload")"
image_url="$(awk -F 'id:|,' '{printf $2}' <<< "${image_url//\"}")"
image_url="https://i.imgur.com/${image_url}.png"
;;
esac
[ "$image_url" ] && printf "%s\n" "$image_url"

BIN
poop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 KiB