Add optionally-auth’d archival to fedi-archive
Now even private posts can be fetched, if you so choose.
This commit is contained in:
parent
3096ce5347
commit
f4721274e7
|
@ -36,11 +36,16 @@ output_post_of_index() {
|
|||
# `max_id` can be passed to return only messages older than said message.
|
||||
fetch_page() {
|
||||
local server="$1"; local user="$2"; local max_id="$3"
|
||||
local url="https://$server/api/v1/accounts/$user/statuses?exclude_replies=true&exclude_reblogs=true&limit=40"
|
||||
local url="https://$server/api/v1/accounts/$user/statuses?exclude_replies=false&exclude_reblogs=true&limit=40"
|
||||
if test -n "$max_id"; then
|
||||
url="${url}&max_id=${max_id}"
|
||||
fi
|
||||
if test -n "$FEDI_AUTH"; then
|
||||
curl --header "Authorization: Bearer $FEDI_AUTH" \
|
||||
"$url"
|
||||
else
|
||||
curl "$url"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
@ -102,10 +107,15 @@ archive_all_posts() {
|
|||
|
||||
usage() {
|
||||
echo "usage: $(basename $0) username server" 1>&2
|
||||
echo "" 1>&2
|
||||
echo "$(basename $0) is a script that fetches all of a user's Mastodon/Pleroma" 1>&2
|
||||
echo "posts for archival purposes." 1>&2
|
||||
echo "Mainly for use with fedi-post.sh or pleroma-migrate.sh." 1>&2
|
||||
echo 1>&2
|
||||
echo "$(basename $0) is a script that fetches all of a user’s Mastodon/Pleroma" 1>&2
|
||||
echo 'posts for archival purposes.' 1>&2
|
||||
echo 'Mainly for use with fedi-post.sh or pleroma-migrate.sh.' 1>&2
|
||||
echo 1>&2
|
||||
echo 'Optionally, you can fetch also any private statuses by the account visible' 1>&2
|
||||
echo 'to you by providing your auth key in the $FEDI_AUTH environment variable.' 1>&2
|
||||
echo 'You can find your auth key by examining the “Authentication: Bearer” header' 1>&2
|
||||
echo 'used in requests by your server’s web-client. In Firefox, F12→Network.' 1>&2
|
||||
exit 2;
|
||||
}
|
||||
|
||||
|
|
Ŝarĝante…
Reference in New Issue