repo: shell-mastodon-api action: blob revision: path_from: sma-timelines-home.sh revision_from: refs/heads/trunk: path_to: revision_to:
blob of:
/ sma-timelines-home.sh
refs/heads/trunk:/sma-timelines-home.sh
#!/usr/bin/env bash
### this outputs your home-feed. one post per line.
BEARER="$(cat ~/.config/sma/bearer 2>/dev/null)"
HOME_INSTANCE="$(cat ~/.config/sma/home 2>/dev/null)"
if [ "$1" = "--clear" ];then
rm ~/.cache/sma/since_id
fi
if [ ! "$BEARER" ];then
printf "create a bearer token and place it in ~/.config/sma/bearer"
fi
since_id="$(cat ~/.cache/sma/since_id 2>/dev/null)"
if [ "$since_id" ];then
since_id="?since_id=${since_id}"
fi
curl -sH "Authorization: Bearer ${BEARER}" -g "${HOME_INSTANCE}/api/v1/timelines/home${since_id}" \
| jq -c '.[]'