dotfiles-mirror/local/bin/upim

22 lines
592 B
Text
Raw Normal View History

2026-02-26 06:08:09 +03:30
#!/usr/bin/env sh
if [ -z "$1" ]; then
echo "usage: $0 <file>"
exit 1
fi
FILE="$1"
RESPONSE=$(curl -s -X POST \
-F "file=@${FILE}" \
https://coast.is-terrible.com/api/files/create)
URL=$(echo "$RESPONSE" | jq -r '.url')
THUMBNAIL_URL=$(echo "$RESPONSE" | jq -r '.thumb')
DELETION_URL=$(echo "$RESPONSE" | jq -r '.del_url')
ERROR=$(echo "$RESPONSE" | jq -r '.error')
if [ "$ERROR" != "null" ]; then
echo "Error uploading file: $ERROR"
exit 1
fi
echo "file uploaded successfully!"
echo "url: $URL"
echo "thumbnail url: $THUMBNAIL_URL"
echo "deletion url: $DELETION_URL"