|  | @@ -55,6 +55,14 @@ peertube_variables=(PEERTUBE_DOMAIN_NAME
 | 
	
		
			
			| 55 | 55 |                      MY_EMAIL_ADDRESS)
 | 
	
		
			
			| 56 | 56 |  
 | 
	
		
			
			| 57 | 57 |  function peertube_import_from_syncthing {
 | 
	
		
			
			|  | 58 | +    peertubedomain="https://$PEERTUBE_DOMAIN_NAME"
 | 
	
		
			
			|  | 59 | +    nodecmd='node'
 | 
	
		
			
			|  | 60 | +
 | 
	
		
			
			|  | 61 | +    if [[ "$ONION_ONLY" != 'no' ]]; then
 | 
	
		
			
			|  | 62 | +        peertubedomain="http://$(cat /var/lib/tor/hidden_service_peertube/hostname)"
 | 
	
		
			
			|  | 63 | +        nodecmd='torsocks node'
 | 
	
		
			
			|  | 64 | +    fi
 | 
	
		
			
			|  | 65 | +
 | 
	
		
			
			| 58 | 66 |      { echo '#!/bin/bash';
 | 
	
		
			
			| 59 | 67 |        echo '';
 | 
	
		
			
			| 60 | 68 |        echo "MY_USERNAME=\$(cat /root/${PROJECT_NAME}.cfg | grep MY_USERNAME | awk -F '=' '{print \$2}')";
 | 
	
	
		
			
			|  | @@ -71,7 +79,7 @@ function peertube_import_from_syncthing {
 | 
	
		
			
			| 71 | 79 |        echo '    exit 0';
 | 
	
		
			
			| 72 | 80 |        echo 'fi';
 | 
	
		
			
			| 73 | 81 |        echo '';
 | 
	
		
			
			| 74 |  | -      echo "peertubedomain=\"http://localhost:${PEERTUBE_PORT}\"";
 | 
	
		
			
			|  | 82 | +      echo "peertubedomain=\"$peertubedomain\"";
 | 
	
		
			
			| 75 | 83 |        echo "peertubeuser=\$(sed -n 1p < \"\$search_dir/login.txt\")";
 | 
	
		
			
			| 76 | 84 |        echo "peertubepassword=\$(sed -n 2p < \"\$search_dir/login.txt\")";
 | 
	
		
			
			| 77 | 85 |        echo 'peertubensfw=';
 | 
	
	
		
			
			|  | @@ -100,7 +108,8 @@ function peertube_import_from_syncthing {
 | 
	
		
			
			| 100 | 108 |        echo "        if ! grep \"\$video_file\" /root/.peertube_uploaded; then";
 | 
	
		
			
			| 101 | 109 |        echo "            if ! grep \"\$video_file\" /root/.peertube_uploading; then";
 | 
	
		
			
			| 102 | 110 |        echo "                echo \"\$video_file\" >> /root/.peertube_uploading";
 | 
	
		
			
			| 103 |  | -      echo "                if node \$import_script \$peertubensfw \$peertubeprivate -u \"\$peertubedomain\" -U \"\$peertubeuser\" --password \"\$peertubepassword\" -f \"\$video_file\"; then";
 | 
	
		
			
			|  | 111 | +      echo "                peertubetitle=\$(basename \"\$video_file\" | awk -F '.' '{print \$1}' | sed 's|_| |g' | sed 's|-| |g')";
 | 
	
		
			
			|  | 112 | +      echo "                if $nodecmd \$import_script -n \$peertubetitle \$peertubensfw \$peertubeprivate -u \"\$peertubedomain\" -U \"\$peertubeuser\" --password \"\$peertubepassword\" -f \"\$video_file\"; then";
 | 
	
		
			
			| 104 | 113 |        echo "                    echo \"\$video_file\" >> /root/.peertube_uploaded";
 | 
	
		
			
			| 105 | 114 |        echo "                    sed -i \"/\$video_file/d\" /root/.peertube_uploading";
 | 
	
		
			
			| 106 | 115 |        echo "                    exit 0";
 | 
	
	
		
			
			|  | @@ -242,7 +251,13 @@ function peertube_import_from_file {
 | 
	
		
			
			| 242 | 251 |      peertubensfw=$(sed -n 4p < "$data2")
 | 
	
		
			
			| 243 | 252 |      rm -f "$data2"
 | 
	
		
			
			| 244 | 253 |  
 | 
	
		
			
			| 245 |  | -    peertubedomain="http://localhost:${PEERTUBE_PORT}"
 | 
	
		
			
			|  | 254 | +    peertubedomain="https://$PEERTUBE_DOMAIN_NAME"
 | 
	
		
			
			|  | 255 | +    nodecmd='node'
 | 
	
		
			
			|  | 256 | +
 | 
	
		
			
			|  | 257 | +    if [[ "$ONION_ONLY" != 'no' ]]; then
 | 
	
		
			
			|  | 258 | +        peertubedomain="http://$(cat /var/lib/tor/hidden_service_peertube/hostname)"
 | 
	
		
			
			|  | 259 | +        nodecmd='torsocks node'
 | 
	
		
			
			|  | 260 | +    fi
 | 
	
		
			
			| 246 | 261 |  
 | 
	
		
			
			| 247 | 262 |      data2=$(mktemp 2>/dev/null)
 | 
	
		
			
			| 248 | 263 |      dialog --title "Choose the video file (select with spacebar)" --fselect "/home/$MY_USERNAME/" 30 60 2> "$data2"
 | 
	
	
		
			
			|  | @@ -270,13 +285,13 @@ function peertube_import_from_file {
 | 
	
		
			
			| 270 | 285 |          nsfwstr='--nsfw'
 | 
	
		
			
			| 271 | 286 |      fi
 | 
	
		
			
			| 272 | 287 |  
 | 
	
		
			
			| 273 |  | -    titlestr=
 | 
	
		
			
			|  | 288 | +    titlestr=$(basename "$selected_file" | awk -F '.' '{print $1}' | sed 's|_| |g' | sed 's|-| |g')
 | 
	
		
			
			| 274 | 289 |      if [ "$peertubetitle" ]; then
 | 
	
		
			
			| 275 | 290 |          titlestr="-n \"$peertubetitle\""
 | 
	
		
			
			| 276 | 291 |      fi
 | 
	
		
			
			| 277 | 292 |  
 | 
	
		
			
			| 278 | 293 |      clear
 | 
	
		
			
			| 279 |  | -    node $import_script $nsfwstr "$titlestr" -u "$peertubedomain" -U "$peertubeuser" --password "$peertubepassword" -f "$selected_file"
 | 
	
		
			
			|  | 294 | +    $nodecmd $import_script $nsfwstr "$titlestr" -u "$peertubedomain" -U "$peertubeuser" --password "$peertubepassword" -f "$selected_file"
 | 
	
		
			
			| 280 | 295 |  
 | 
	
		
			
			| 281 | 296 |      dialog --title $"Import video from file" \
 | 
	
		
			
			| 282 | 297 |             --msgbox $"Video imported from $selected_file" 6 75
 | 
	
	
		
			
			|  | @@ -307,7 +322,13 @@ function peertube_import_videos {
 | 
	
		
			
			| 307 | 322 |      video_url=$(sed -n 3p < "$data2")
 | 
	
		
			
			| 308 | 323 |      rm -f "$data2"
 | 
	
		
			
			| 309 | 324 |  
 | 
	
		
			
			| 310 |  | -    peertubedomain="http://localhost:${PEERTUBE_PORT}"
 | 
	
		
			
			|  | 325 | +    peertubedomain="https://$PEERTUBE_DOMAIN_NAME"
 | 
	
		
			
			|  | 326 | +    nodecmd='node'
 | 
	
		
			
			|  | 327 | +
 | 
	
		
			
			|  | 328 | +    if [[ "$ONION_ONLY" != 'no' ]]; then
 | 
	
		
			
			|  | 329 | +        peertubedomain="http://$(cat /var/lib/tor/hidden_service_peertube/hostname)"
 | 
	
		
			
			|  | 330 | +        nodecmd='torsocks node'
 | 
	
		
			
			|  | 331 | +    fi
 | 
	
		
			
			| 311 | 332 |  
 | 
	
		
			
			| 312 | 333 |      if [ ${#peertubeuser} -lt 3 ]; then
 | 
	
		
			
			| 313 | 334 |          dialog --title $"Import videos from legacy sites" \
 | 
	
	
		
			
			|  | @@ -342,7 +363,7 @@ function peertube_import_videos {
 | 
	
		
			
			| 342 | 363 |      fi
 | 
	
		
			
			| 343 | 364 |  
 | 
	
		
			
			| 344 | 365 |      clear
 | 
	
		
			
			| 345 |  | -    node $import_script -u "$peertubedomain" -U "$peertubeuser" --password "$peertubepassword" -t "$video_url"
 | 
	
		
			
			|  | 366 | +    $nodecmd $import_script -u "$peertubedomain" -U "$peertubeuser" --password "$peertubepassword" -t "$video_url"
 | 
	
		
			
			| 346 | 367 |  
 | 
	
		
			
			| 347 | 368 |      dialog --title $"Import videos from legacy sites" \
 | 
	
		
			
			| 348 | 369 |             --msgbox $"Video/s imported from $video_url" 6 75
 |