22 lines
728 B
Bash
Executable file
22 lines
728 B
Bash
Executable file
#!/bin/bash
|
|
|
|
function upload_to_voe () {
|
|
api_key=$1
|
|
filepath=$2
|
|
|
|
filepath=$( readlink -f "$filepath" )
|
|
# echo "filepath: $filepath" >&2
|
|
|
|
upload_server=$(curl -s "https://voe.sx/api/upload/server?key=$api_key")
|
|
upload_server=$(echo $upload_server | jq ".result")
|
|
upload_server=${upload_server//\"}
|
|
# echo "Upload Target: $upload_server" >&2
|
|
|
|
voe_url=$(curl -X POST $upload_server -H "Content-Type: multipart/form-data" -H 'Cache-Control: no-cache' -F action=push -F api_key=$api_key -F "file=@\"$filepath\"")
|
|
voe_url=${voe_url#*<textarea name=\"fn\">}
|
|
voe_url=${voe_url%%</textarea>*}
|
|
voe_url="https://voe.sx/"${voe_url}
|
|
# echo "voe_url: $voe_url" >&2
|
|
|
|
echo "$voe_url"
|
|
}
|