mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-11-25 11:51:28 +00:00
Add import followings; pleroma api point variable
This commit is contained in:
parent
e4be40cf71
commit
93d672b5f0
|
@ -2,6 +2,7 @@
|
|||
|
||||
instance=$(jj -i config.json instance)
|
||||
instance_point="https://$instance/api/v1"
|
||||
instance_point_pleroma="https://$instance/api/pleroma"
|
||||
instance_hist='instance.hist'
|
||||
max_statuses=$(jj -i config.json max_statuses)
|
||||
default_visibility=$(jj -i config.json default_visibility)
|
||||
|
@ -79,25 +80,55 @@ backup_api_list()
|
|||
curl -s --compressed -H "Authorization: Bearer $auth" "$instance_point/pleroma/backups"
|
||||
}
|
||||
|
||||
follow_api_export()
|
||||
{
|
||||
count=40
|
||||
mkdir -m 711 -p backups_$instance
|
||||
account_info=$(account_api_me)
|
||||
acc_id=$(echo $account_info | jj id)
|
||||
acc_following_count=$(echo $account_info | jj following_count)
|
||||
while [ $count -gt 0 ]; do
|
||||
followings=$(followings_api_get $acc_id)
|
||||
count=$(echo $followings | jj \#)
|
||||
if [ $count -gt 0 ]; then
|
||||
countindex=$(expr $count - 1)
|
||||
echo $followings | jj -l \#.fqn | sed 's/"//g' >> backups_$instance/friends.csv
|
||||
offset=$(echo $followings | jj $countindex.id)
|
||||
echo "+$count follows"
|
||||
else
|
||||
echo "$acc_following_count followings exported"
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
mutes_api_import()
|
||||
{
|
||||
curl -s --compressed -X POST -H "Authorization: Bearer $auth" "$instance_point/pleroma/mutes_import"
|
||||
curl -s --compressed -H "Authorization: Bearer $auth" "$instance_point_pleroma/mutes_import" \
|
||||
--data 'list=@restore/mutes.csv'
|
||||
}
|
||||
|
||||
blocks_api_import()
|
||||
{
|
||||
curl -s --compressed -X POST -H "Authorization: Bearer $auth" "$instance_point/pleroma/blocks_import"
|
||||
curl -s --compressed -H "Authorization: Bearer $auth" "$instance_point_pleroma/blocks_import" \
|
||||
--data 'list=@restore/blocks.csv'
|
||||
}
|
||||
|
||||
follow_api_import()
|
||||
{
|
||||
curl -s --compressed -X POST -H "Authorization: Bearer $auth" "$instance_point/pleroma/follow_import"
|
||||
curl -v --compressed -H "Authorization: Bearer $auth" "$instance_point_pleroma/follow_import" \
|
||||
--data 'list=@restore/friends.csv'
|
||||
}
|
||||
#[MIGRATION SECTION END]
|
||||
|
||||
account_api_me()
|
||||
{
|
||||
default_curl_opt $instance_point/accounts/verify_credentials
|
||||
}
|
||||
|
||||
followings_api_get()
|
||||
{
|
||||
default_curl_opt -H "Authorization: Bearer $auth" "$instance_point/accounts/$1/following?limit=40"
|
||||
default_curl_opt "$instance_point/accounts/$1/following?limit=40&max_id=$offset"
|
||||
}
|
||||
|
||||
thread_api_statuses()
|
||||
|
|
Loading…
Reference in a new issue