neue Nomenklatur
This commit is contained in:
parent
d43f48f6d9
commit
5ad75bf9fa
3 changed files with 39 additions and 2 deletions
44
voeFunctions.fn
Executable file
44
voeFunctions.fn
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
#!/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"
|
||||
}
|
||||
|
||||
|
||||
function voe_check_if_file_is_alive () {
|
||||
api_key=$1
|
||||
file_url=$2
|
||||
|
||||
file_id=${file_url##*/}
|
||||
# echo "File ID: $file_id"
|
||||
|
||||
response=$( curl -s "https://voe.sx/api/file/info?key=$api_key&file_code=$file_id" -H "Content-Type: application/json")
|
||||
#echo "Response: $response"
|
||||
|
||||
is_alive=$(echo $response | jq ".result")
|
||||
is_alive=$(echo $is_alive | jq ".[0]")
|
||||
is_alive=$(echo $is_alive | jq ".status")
|
||||
|
||||
if [ $is_alive = '404' ]; then
|
||||
echo "false"
|
||||
else
|
||||
echo "true"
|
||||
fi
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue