Added legacy support address preprocessing for more compatibility

This commit is contained in:
localhost_frssoft 2022-04-14 01:29:48 +03:00
parent 1770ab93de
commit 0e6947dde9

View file

@ -129,6 +129,11 @@ backup_api_list()
default_curl_opt "$instance_point/pleroma/backups"
}
legacy_addr_preprocess()
{
sed -E "/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+$/! s/$/@$instance/"
}
follow_api_export()
{
count=40
@ -141,14 +146,14 @@ follow_api_export()
count=$(echo $followings | jj \#)
if [ $count -lt 40 ]; then
countindex=$(expr $count - 1)
echo $followings | jj -l \#.fqn | sed 's/"//g' >> backups_$instance/friends.csv
echo $followings | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/friends.csv
offset=$(echo $followings | jj $countindex.id)
echo "+$count follows"
count=0
echo "$acc_following_count followings exported"
elif [ $count -gt 0 ]; then
countindex=$(expr $count - 1)
echo $followings | jj -l \#.fqn | sed 's/"//g' >> backups_$instance/friends.csv
echo $followings | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/friends.csv
offset=$(echo $followings | jj $countindex.id)
echo "+$count follows"
else
@ -167,13 +172,13 @@ blocks_api_export()
count=$(echo $blocks | jj \#)
if [ $count -lt 40 ]; then
countindex=$(expr $count - 1)
echo $blocks | jj -l \#.fqn | sed 's/"//g' >> backups_$instance/blocks.csv
echo $blocks | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/blocks.csv
offset=$(echo $blocks | jj $countindex.id)
echo "+$count blocks"
count=0
echo "Blocks exported"
elif [ $count -gt 0 ]; then
echo $blocks | jj -l \#.fqn | sed 's/"//g' >> backups_$instance/blocks.csv
echo $blocks | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/blocks.csv
offset=$(echo $blocks | jj $countindex.id)
echo "+$count blocks"
else
@ -192,13 +197,13 @@ mutes_api_export()
count=$(echo $mutes | jj \#)
if [ $count -lt 40 ]; then
countindex=$(expr $count - 1)
echo $mutes | jj -l \#.fqn | sed 's/"//g' >> backups_$instance/mutes.csv
echo $mutes | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/mutes.csv
offset=$(echo $mutes | jj $countindex.id)
echo "+$count mutes"
count=0
echo "Mutes exported"
elif [ $count -gt 0 ]; then
echo $mutes | jj -l \#.fqn | sed 's/"//g' >> backups_$instance/mutes.csv
echo $mutes | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/mutes.csv
offset=$(echo $mutes | jj $countindex.id)
echo "+$count mutes"
else