dotfiles/.local/bin/scripts/void

15 lines
456 B
Bash
Executable File

#!/bin/sh
temp=$(mktemp)
target=$(pass app/voidcat)
for arg; do
echo "Uploading $arg"
{ curl --progress-bar -X POST \
-H "V-Content-Type: $(file --mime-type -b $1)" \
-H "V-Full-Digest: $(sha256sum -bz $1 | cut -d' ' -f1)" \
-H "V-Filename: $arg" \
-H "Authorization: Bearer $(echo "$target" | head -1)" \
--data-binary @$arg \
$(echo "$target" | tail -1); echo; } | tee -a $temp
done
test $# -gt 1 && echo && cat $temp | sed 's|http:|https:|'