bbs-telnet/mastodon_api.sh

20 lines
701 B
Bash
Raw Normal View History

2023-07-24 02:26:39 +03:00
#/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
}
2023-07-24 02:42:54 +03:00
timeline_render(){
cat - | jq -r '.[] |
if .reblog then
"[up^ \(.reblog.id) \(.reblog.account.acct)]", .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'
}
2023-07-24 02:26:39 +03:00
timeline_home(){
2023-07-24 02:42:54 +03:00
curl -s -H "Authorization: Bearer $instance_token" "https://$instance/api/v1/timelines/home?limit=40&max_id=$1" | timeline_render
2023-07-24 02:26:39 +03:00
}