diff --git a/executor.sh b/executor.sh index 0276b8b..ba55b23 100755 --- a/executor.sh +++ b/executor.sh @@ -2,19 +2,6 @@ . ./config -toot(){ - curl -s -X POST -F in_reply_to_id=$reply -F status="$1" -F visibility='unlisted' -H "Authorization: Bearer $instance_token" https://$instance/api/v1/statuses -} - -timeline_home(){ - curl -s -H "Authorization: Bearer $instance_token" "https://$instance/api/v1/timelines/home?limit=40&max_id=$1" | - jq -r '.[] | - if .reblog then - (["bump", .reblog.id, .reblog.account.acct] | join(" ")), .reblog.pleroma.content."text/plain", (.reblog.media_attachments[] | "attach", .url, .description // empty) - else [.id, .account.acct], .pleroma.content."text/plain", (.media_attachments[] | "attach", .url, .description // empty) - end | @text' -} - remote_ip=$SOCAT_PEERADDR die(){ rm access_granted/"$remote_ip" @@ -26,6 +13,7 @@ mkdir -p -m 700 access_granted mkdir -p -m 700 access_denied if [ -f access_denied/"$remote_ip" ]; then exit 0; fi +. ./mastodon_api.sh generator_session=$(zcat -f $system_dict | shuf -n 2 | tr -d "\n'") randpadding=$(head -c 8 /dev/urandom | base64) diff --git a/mastodon_api.sh b/mastodon_api.sh new file mode 100755 index 0000000..41c6590 --- /dev/null +++ b/mastodon_api.sh @@ -0,0 +1,16 @@ +#/bin/sh + +toot(){ + curl -s -X POST -F in_reply_to_id=$reply -F status="$1" -F visibility='unlisted' -H "Authorization: Bearer $instance_token" https://$instance/api/v1/statuses +} + +timeline_home(){ + curl -s -H "Authorization: Bearer $instance_token" "https://$instance/api/v1/timelines/home?limit=40&max_id=$1" | + jq -r '.[] | + if .reblog then + (["bump", .reblog.id, .reblog.account.acct] | join(" ")), .reblog.pleroma.content."text/plain", (.reblog.media_attachments[] | "attach", .url, .description // empty) + else [.id, .account.acct], .pleroma.content."text/plain", (.media_attachments[] | "attach", .url, .description // empty) + end | @text' +} + +