Add 'post-local.sh'

This commit is contained in:
NaiJi ✨ 2022-04-15 16:44:29 +00:00
parent 23656fbd9c
commit 8635305740
1 changed files with 34 additions and 0 deletions

34
post-local.sh Normal file
View File

@ -0,0 +1,34 @@
#!/bin/bash
if [ -z $(which jq) ]
then
echo "Missing jq package, please install"
exit 1
fi
token_dat="./token.dat"
if [ ! -f $token_dat ]
then
echo "Missing ./token.dat"
exit 1
fi
api_base_url="https://udongein.xyz/"
access_token="$(cat ${token_dat})"
sensitivity="$(ls | grep sfw | shuf -n 1)"
source_url="${sensitivity}/$(ls ${sensitivity} | shuf -n 1)"
is_sensitive=true
if [ "${sensitivity}" == "sfw" ]
then
is_sensitive=false
fi
media_json=$(curl -X POST "${api_base_url}/api/v1/media" -H "Authorization: Bearer ${access_token}" -F "file=@${source_url}")
media_id=$(jq -r ".id" <<< ${media_json})
curl -X POST -d '{"status":" :gyate_reisen_love:", "sensitive":'${is_sensitive}', "visibility":"'unlisted'", "media_ids":'[\"${media_id}\"]'}' \
-H "Authorization: Bearer ${access_token}" \
-H "Content-Type: application/json" \
"${api_base_url}/api/v1/statuses"