#!/usr/bin/env sh set -eux 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="https://u.n2.pm/i/$image_id.$extension" echo "$image_url" echo "$image_url" | xclip -selection clipboard