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
1 changed files with 11 additions and 6 deletions

View File

@ -129,6 +129,11 @@ backup_api_list()
default_curl_opt "$instance_point/pleroma/backups" 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() follow_api_export()
{ {
count=40 count=40
@ -141,14 +146,14 @@ follow_api_export()
count=$(echo $followings | jj \#) count=$(echo $followings | jj \#)
if [ $count -lt 40 ]; then if [ $count -lt 40 ]; then
countindex=$(expr $count - 1) 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) offset=$(echo $followings | jj $countindex.id)
echo "+$count follows" echo "+$count follows"
count=0 count=0
echo "$acc_following_count followings exported" echo "$acc_following_count followings exported"
elif [ $count -gt 0 ]; then elif [ $count -gt 0 ]; then
countindex=$(expr $count - 1) 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) offset=$(echo $followings | jj $countindex.id)
echo "+$count follows" echo "+$count follows"
else else
@ -167,13 +172,13 @@ blocks_api_export()
count=$(echo $blocks | jj \#) count=$(echo $blocks | jj \#)
if [ $count -lt 40 ]; then if [ $count -lt 40 ]; then
countindex=$(expr $count - 1) 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) offset=$(echo $blocks | jj $countindex.id)
echo "+$count blocks" echo "+$count blocks"
count=0 count=0
echo "Blocks exported" echo "Blocks exported"
elif [ $count -gt 0 ]; then 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) offset=$(echo $blocks | jj $countindex.id)
echo "+$count blocks" echo "+$count blocks"
else else
@ -192,13 +197,13 @@ mutes_api_export()
count=$(echo $mutes | jj \#) count=$(echo $mutes | jj \#)
if [ $count -lt 40 ]; then if [ $count -lt 40 ]; then
countindex=$(expr $count - 1) 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) offset=$(echo $mutes | jj $countindex.id)
echo "+$count mutes" echo "+$count mutes"
count=0 count=0
echo "Mutes exported" echo "Mutes exported"
elif [ $count -gt 0 ]; then 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) offset=$(echo $mutes | jj $countindex.id)
echo "+$count mutes" echo "+$count mutes"
else else