Added: backup\restore menu

This commit is contained in:
localhost_frssoft 2022-04-13 20:50:48 +03:00
parent e321f3584d
commit 093e8b5ea4

View file

@ -70,6 +70,53 @@ auth_api_get_token()
#[AUTH SECTION END]
#[MIGRATION SECTION]
backup_restore_menu()
{
clear
echo "Backup/Restore menu
Backups will be placed to folder backups_$instance
Hint:
For restore create folder 'restore' and copy 'friends.csv, blocks.csv, mutes.csv' in to folder
Note: check selected instance before backup/restore"
sub_menu_lvl=1
entry1='Backup followings'
entry2='Backup blocks'
entry3='Backup mutes'
entry4='Backup all'
entry5='Restore followings'
entry6='Restore blocks'
entry7='Restore mutes'
entry8='Restore all'
while [ $sub_menu_lvl -eq 1 ]; do
choice=$(echo "Main menu\n$entry1\n$entry2\n$entry3\n$entry4\n$entry5\n$entry6\n$entry7\n$entry8" | fzy)
case $choice in
"Main menu") sub_menu_lvl=0 ;;
"$entry1") follow_api_export ;;
"$entry2") blocks_api_export ;;
"$entry3") mutes_api_export ;;
"$entry4")
echo 'Initialized... Please wait...'
follow_api_export
sleep 3
blocks_api_export
sleep 3
mutes_api_export
;;
"$entry5") follow_api_import ;;
"$entry6") blocks_api_import ;;
"$entry7") mutes_api_import ;;
"$entry8")
echo 'Initialized... Please wait...'
follow_api_import
sleep 5
blocks_api_import
sleep 5
mutes_api_import
;;
esac
done
}
backup_api_create()
{
curl -s --compressed -X POST -H "Authorization: Bearer $auth" "$instance_point/pleroma/backups"
@ -420,12 +467,13 @@ menu_write_status='Write status'
menu_timeline='Timelines'
notif='Notifications'
authmake='Auth'
backup_restore='Backup/Restore'
switchinstance='Switch instance'
Exit='Exit'
while true; do
if [ -n "$auth" ]; then
main_menu=$(echo "$menu_write_status\n$menu_timeline\n$notif\n$switchinstance\n$Exit" | fzy)
main_menu=$(echo "$menu_write_status\n$menu_timeline\n$notif\n$backup_restore\n$switchinstance\n$Exit" | fzy)
else
main_menu=$(echo "$menu_write_status\n$menu_timeline\n$notif\n$authmake\n$switchinstance\n$Exit" | fzy)
fi
@ -437,6 +485,7 @@ case $main_menu in
;;
"$notif") notif_menu ;;
"$clrnotif") notif_api_remove_all ;;
"$backup_restore") backup_restore_menu ;;
"$switchinstance")
empty=0
case $(echo 'Recently used\nChoice from list\nManual input' | fzy) in