init
This commit is contained in:
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/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"
|
||||
Reference in New Issue
Block a user