Skip to content

Instantly share code, notes, and snippets.

@nikclayton
Created February 3, 2025 19:10
Show Gist options
  • Save nikclayton/0148c872c1896e2e3794be119ffcd6f9 to your computer and use it in GitHub Desktop.
Save nikclayton/0148c872c1896e2e3794be119ffcd6f9 to your computer and use it in GitHub Desktop.

Script to trigger the (possible) Dragonfly bug on a Mastodon account.

If this doesn't find any problems within the first limit=90 posts on your home timeline you can step back further by adjusting the first curl command in the script.

#!/bin/sh
#
# Assumes
#  - curl and jq are installed
#  - $TOKEN is your account's bearer token

# Fetch the most recent IDs of posts in the home timeline and save to ids.txt
curl -s -H "Authorization: Bearer $TOKEN" https://mastodon.social/api/v1/timelines/home?limit=90 | jq '[.[].id]' > ids.txt

# Process each ID, and try to fetch the home timeline with the ID as the
# min_id value. If any of them return 0 results then it's suspect.
#
# Note that the first ID was just fetched as the first ID in the user's
# timeline, so it may legitimately have 0 results when used as min_id.
for id in $(jq -r -c '.[]' < ids.txt); do
        length=$(curl -s -H "Authorization: Bearer $TOKEN" https://mastodon.social/api/v1/timelines/home?min_id=$id | jq length)
        if [ "$length" -eq "0" ]; then
                echo "$id is suspect"
        fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment