Added support for imgur using my own api key
This commit is contained in:
parent
8b9a8ac3d9
commit
fb3cd92b96
|
@ -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"
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
|
|
8
neofetch
8
neofetch
|
@ -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"
|
||||
|
|
Reference in New Issue