#!/usr/bin/env sh set -eu path=$1 extension=$(echo "$path" | cut -d'.' -f2) data=$(curl -F file=@"$path" -H "Authorization: $U_API_KEY" "$U_HOST/api/upload") image_id=$(echo "$data" | jq -r .id) image_revocation_key=$(echo "$data" | jq -r .revocation_key) echo "$image_id $image_revocation_key" >> "$U_REVOCATION_KEY_PATH" image_url="$U_HOST/i/$image_id.$extension" echo "$image_url" echo "$image_url" | xclip -selection clipboard