dotfiles/.local/bin/scripts/void

16 lines
508 B
Text
Raw Normal View History

2024-01-12 19:32:16 +03:00
#!/bin/sh
2025-02-04 11:52:56 +01:00
#temp=$(mktemp)
2024-01-12 19:32:16 +03:00
target=$(pass app/voidcat)
for arg; do
2025-02-04 11:52:56 +01:00
extension=$(echo "$arg" | sed 's/.*\.//')
2024-01-12 19:32:16 +03:00
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 \
2025-02-04 11:52:56 +01:00
$(echo "$target" | tail -1); echo; } | sed "s/\$/.$extension/"
2024-01-12 19:32:16 +03:00
done
2025-02-04 11:52:56 +01:00
#test $# -gt 1 && echo && #sed 's|http:|https:|' "$temp"