| 
				
			 | 
			
			
				@@ -386,6 +386,80 @@ function pleroma_disable_registrations { 
			 | 
		
	
		
			
			| 
				386
			 | 
			
				386
			 | 
			
			
				     pleroma_recompile 
			 | 
		
	
		
			
			| 
				387
			 | 
			
				387
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				388
			 | 
			
				388
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
			 | 
			
				389
			 | 
			
			
				+function pleroma_add_emoji { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				390
			 | 
			
			
				+    data=$(tempfile 2>/dev/null) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				391
			 | 
			
			
				+    trap "rm -f $data" 0 1 2 5 15 
			 | 
		
	
		
			
			| 
				
			 | 
			
				392
			 | 
			
			
				+    dialog --backtitle $"Freedombone Control Panel" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				393
			 | 
			
			
				+           --title $"Add Custom Emoji" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				394
			 | 
			
			
				+           --form "\n" 8 75 2 \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				395
			 | 
			
			
				+           $"Shortcode:" 1 1 "" 1 18 16 15 \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				396
			 | 
			
			
				+           $"ImageURL:" 2 1 "" 2 18 512 10000 \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				397
			 | 
			
			
				+           2> $data 
			 | 
		
	
		
			
			| 
				
			 | 
			
				398
			 | 
			
			
				+    sel=$? 
			 | 
		
	
		
			
			| 
				
			 | 
			
				399
			 | 
			
			
				+    case $sel in 
			 | 
		
	
		
			
			| 
				
			 | 
			
				400
			 | 
			
			
				+        1) return;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				401
			 | 
			
			
				+        255) return;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				402
			 | 
			
			
				+    esac 
			 | 
		
	
		
			
			| 
				
			 | 
			
				403
			 | 
			
			
				+    shortcode=$(cat $data | sed -n 1p) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				404
			 | 
			
			
				+    image_url=$(cat $data | sed -n 2p) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				405
			 | 
			
			
				+    rm $data 
			 | 
		
	
		
			
			| 
				
			 | 
			
				406
			 | 
			
			
				+    if [ ${#shortcode} -lt 2 ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				407
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				408
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				409
			 | 
			
			
				+    if [ ${#image_url} -lt 2 ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				410
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				411
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				412
			 | 
			
			
				+    if [[ "$image_url" != *'.'* ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				413
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				414
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				415
			 | 
			
			
				+    if [[ "$image_url" != *'.png' && "$image_url" != *'.jpg' && "$image_url" != *'.jpeg' && "$image_url" != *'.gif' ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				416
			 | 
			
			
				+        dialog --title $"Add Custom Emoji" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				417
			 | 
			
			
				+               --msgbox $"The image must be png/jpg/gif format" 6 60 
			 | 
		
	
		
			
			| 
				
			 | 
			
				418
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				419
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				420
			 | 
			
			
				+    if [[ "$shortcode" == *':'* || "$shortcode" == *' '* || "$shortcode" == *'.'* || "$shortcode" == *'!'* ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				421
			 | 
			
			
				+        dialog --title $"Add Custom Emoji" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				422
			 | 
			
			
				+               --msgbox $"The shortcode contains invalid characters" 6 60 
			 | 
		
	
		
			
			| 
				
			 | 
			
				423
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				424
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				425
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				426
			 | 
			
			
				+    image_extension='png' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				427
			 | 
			
			
				+    if [[ "$image_url" == *'.jpg' || "$image_url" == *'.jpeg' ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				428
			 | 
			
			
				+        image_extension='jpg' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				429
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				430
			 | 
			
			
				+    if [[ "$image_url" == *'.gif' ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				431
			 | 
			
			
				+        image_extension='gif' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				432
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				433
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				434
			 | 
			
			
				+    if [ ! -d $PLEROMA_DIR/custom_emoji ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				435
			 | 
			
			
				+        mkdir -p $PLEROMA_DIR/custom_emoji 
			 | 
		
	
		
			
			| 
				
			 | 
			
				436
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				437
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				438
			 | 
			
			
				+    image_filename=$PLEROMA_DIR/custom_emoji/${shortcode}.${image_extension} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				439
			 | 
			
			
				+    wget "$image_url" -O $image_filename 
			 | 
		
	
		
			
			| 
				
			 | 
			
				440
			 | 
			
			
				+    if [ ! -f $image_filename ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				441
			 | 
			
			
				+        dialog --title $"Add Custom Emoji" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				442
			 | 
			
			
				+               --msgbox $"Unable to download the image" 6 60 
			 | 
		
	
		
			
			| 
				
			 | 
			
				443
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				444
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				445
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				446
			 | 
			
			
				+    if ! grep -q "${shortcode}," $image_filename; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				447
			 | 
			
			
				+        echo "${shortcode}, ${image_filename}" >> $PLEROMA_DIR/config/emoji.txt 
			 | 
		
	
		
			
			| 
				
			 | 
			
				448
			 | 
			
			
				+    else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				449
			 | 
			
			
				+        sed -i "s|${shortcode},.*|${shortcode}, ${image_filename}|g" $PLEROMA_DIR/config/emoji.txt 
			 | 
		
	
		
			
			| 
				
			 | 
			
				450
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				451
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				452
			 | 
			
			
				+    chown -R pleroma:pleroma $PLEROMA_DIR 
			 | 
		
	
		
			
			| 
				
			 | 
			
				453
			 | 
			
			
				+    clear 
			 | 
		
	
		
			
			| 
				
			 | 
			
				454
			 | 
			
			
				+    echo '' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				455
			 | 
			
			
				+    echo $'Recompiling Pleroma with the new emoji' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				456
			 | 
			
			
				+    systemctl stop pleroma 
			 | 
		
	
		
			
			| 
				
			 | 
			
				457
			 | 
			
			
				+    pleroma_recompile 
			 | 
		
	
		
			
			| 
				
			 | 
			
				458
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				459
			 | 
			
			
				+    dialog --title $"Add Custom Emoji" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				460
			 | 
			
			
				+           --msgbox $"Custom emoji :${shortcode}: has been added" 6 70 
			 | 
		
	
		
			
			| 
				
			 | 
			
				461
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				462
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				389
			 | 
			
				463
			 | 
			
			
				 function configure_interactive_pleroma { 
			 | 
		
	
		
			
			| 
				390
			 | 
			
				464
			 | 
			
			
				     read_config_param PLEROMA_EXPIRE_MONTHS 
			 | 
		
	
		
			
			| 
				391
			 | 
			
				465
			 | 
			
			
				     while true 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -394,12 +468,13 @@ function configure_interactive_pleroma { 
			 | 
		
	
		
			
			| 
				394
			 | 
			
				468
			 | 
			
			
				         trap "rm -f $data" 0 1 2 5 15 
			 | 
		
	
		
			
			| 
				395
			 | 
			
				469
			 | 
			
			
				         dialog --backtitle $"Freedombone Control Panel" \ 
			 | 
		
	
		
			
			| 
				396
			 | 
			
				470
			 | 
			
			
				                --title $"Pleroma" \ 
			 | 
		
	
		
			
			| 
				397
			 | 
			
				
			 | 
			
			
				-               --radiolist $"Choose an operation:" 14 70 5 \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				471
			 | 
			
			
				+               --radiolist $"Choose an operation:" 15 70 6 \ 
			 | 
		
	
		
			
			| 
				398
			 | 
			
				472
			 | 
			
			
				                1 $"Set a background image" off \ 
			 | 
		
	
		
			
			| 
				399
			 | 
			
				473
			 | 
			
			
				                2 $"Set the title" off \ 
			 | 
		
	
		
			
			| 
				400
			 | 
			
				474
			 | 
			
			
				                3 $"Disable new account registrations" off \ 
			 | 
		
	
		
			
			| 
				401
			 | 
			
				
			 | 
			
			
				-               4 $"Set post expiry period (currently $PLEROMA_EXPIRE_MONTHS months)" off \ 
			 | 
		
	
		
			
			| 
				402
			 | 
			
				
			 | 
			
			
				-               5 $"Exit" on 2> $data 
			 | 
		
	
		
			
			| 
				
			 | 
			
				475
			 | 
			
			
				+               4 $"Add a custom emoji" off \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				476
			 | 
			
			
				+               5 $"Set post expiry period (currently $PLEROMA_EXPIRE_MONTHS months)" off \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				477
			 | 
			
			
				+               6 $"Exit" on 2> $data 
			 | 
		
	
		
			
			| 
				403
			 | 
			
				478
			 | 
			
			
				         sel=$? 
			 | 
		
	
		
			
			| 
				404
			 | 
			
				479
			 | 
			
			
				         case $sel in 
			 | 
		
	
		
			
			| 
				405
			 | 
			
				480
			 | 
			
			
				             1) return;; 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -409,8 +484,9 @@ function configure_interactive_pleroma { 
			 | 
		
	
		
			
			| 
				409
			 | 
			
				484
			 | 
			
			
				             1) pleroma_set_background_image;; 
			 | 
		
	
		
			
			| 
				410
			 | 
			
				485
			 | 
			
			
				             2) pleroma_set_title;; 
			 | 
		
	
		
			
			| 
				411
			 | 
			
				486
			 | 
			
			
				             3) pleroma_disable_registrations;; 
			 | 
		
	
		
			
			| 
				412
			 | 
			
				
			 | 
			
			
				-            4) pleroma_set_expire_months;; 
			 | 
		
	
		
			
			| 
				413
			 | 
			
				
			 | 
			
			
				-            5) break;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				487
			 | 
			
			
				+            4) pleroma_add_emoji;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				488
			 | 
			
			
				+            5) pleroma_set_expire_months;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				489
			 | 
			
			
				+            6) break;; 
			 | 
		
	
		
			
			| 
				414
			 | 
			
				490
			 | 
			
			
				         esac 
			 | 
		
	
		
			
			| 
				415
			 | 
			
				491
			 | 
			
			
				         rm $data 
			 | 
		
	
		
			
			| 
				416
			 | 
			
				492
			 | 
			
			
				     done 
			 |