| 
				
			 | 
			
			
				@@ -39,13 +39,11 @@ SHOW_ON_ABOUT=1 
			 | 
		
	
		
			
			| 
				39
			 | 
			
				39
			 | 
			
			
				 PEERTUBE_DOMAIN_NAME= 
			 | 
		
	
		
			
			| 
				40
			 | 
			
				40
			 | 
			
			
				 PEERTUBE_CODE= 
			 | 
		
	
		
			
			| 
				41
			 | 
			
				41
			 | 
			
			
				 PEERTUBE_REPO="https://github.com/Chocobozzz/PeerTube" 
			 | 
		
	
		
			
			| 
				42
			 | 
			
				
			 | 
			
			
				-PEERTUBE_COMMIT='a7fea183f0f69104b209e7bfdd6435be28165f22' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+PEERTUBE_COMMIT='fef2c7164e025b12a64185dbab058ef4129733c6' 
			 | 
		
	
		
			
			| 
				43
			 | 
			
				43
			 | 
			
			
				 PEERTUBE_ONION_PORT=8136 
			 | 
		
	
		
			
			| 
				44
			 | 
			
				44
			 | 
			
			
				 PEERTUBE_PORT=9004 
			 | 
		
	
		
			
			| 
				45
			 | 
			
				45
			 | 
			
			
				 MESH_PEERTUBE_PORT=8500 
			 | 
		
	
		
			
			| 
				46
			 | 
			
				46
			 | 
			
			
				 PEERTUBE_DIR=/etc/peertube 
			 | 
		
	
		
			
			| 
				47
			 | 
			
				
			 | 
			
			
				-peertube_npm_version='5.3.0' 
			 | 
		
	
		
			
			| 
				48
			 | 
			
				
			 | 
			
			
				-peertube_node_version='8.6.0' 
			 | 
		
	
		
			
			| 
				49
			 | 
			
				47
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				50
			 | 
			
				48
			 | 
			
			
				 peertube_variables=(PEERTUBE_DOMAIN_NAME 
			 | 
		
	
		
			
			| 
				51
			 | 
			
				49
			 | 
			
			
				                     PEERTUBE_CODE 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -53,7 +51,6 @@ peertube_variables=(PEERTUBE_DOMAIN_NAME 
			 | 
		
	
		
			
			| 
				53
			 | 
			
				51
			 | 
			
			
				                     ONION_ONLY 
			 | 
		
	
		
			
			| 
				54
			 | 
			
				52
			 | 
			
			
				                     DDNS_PROVIDER 
			 | 
		
	
		
			
			| 
				55
			 | 
			
				53
			 | 
			
			
				                     MY_USERNAME 
			 | 
		
	
		
			
			| 
				56
			 | 
			
				
			 | 
			
			
				-                    ARCHITECTURE 
			 | 
		
	
		
			
			| 
				57
			 | 
			
				54
			 | 
			
			
				                     MY_EMAIL_ADDRESS) 
			 | 
		
	
		
			
			| 
				58
			 | 
			
				55
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				59
			 | 
			
				56
			 | 
			
			
				 function peertube_create_database { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -202,11 +199,7 @@ function upgrade_peertube { 
			 | 
		
	
		
			
			| 
				202
			 | 
			
				199
			 | 
			
			
				     function_check set_repo_commit 
			 | 
		
	
		
			
			| 
				203
			 | 
			
				200
			 | 
			
			
				     set_repo_commit $PEERTUBE_DIR "peertube commit" "$PEERTUBE_COMMIT" $PEERTUBE_REPO 
			 | 
		
	
		
			
			| 
				204
			 | 
			
				201
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				205
			 | 
			
				
			 | 
			
			
				-    PREV_PATH=$PATH 
			 | 
		
	
		
			
			| 
				206
			 | 
			
				
			 | 
			
			
				-    PATH=$(npm bin):$PATH 
			 | 
		
	
		
			
			| 
				207
			 | 
			
				202
			 | 
			
			
				     npm run upgrade-peertube 
			 | 
		
	
		
			
			| 
				208
			 | 
			
				
			 | 
			
			
				-    PATH=$PREV_PATH 
			 | 
		
	
		
			
			| 
				209
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				210
			 | 
			
				203
			 | 
			
			
				     chown -R peertube:peertube $PEERTUBE_DIR 
			 | 
		
	
		
			
			| 
				211
			 | 
			
				204
			 | 
			
			
				     systemctl start peertube 
			 | 
		
	
		
			
			| 
				212
			 | 
			
				205
			 | 
			
			
				 } 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -776,69 +769,30 @@ function install_peertube { 
			 | 
		
	
		
			
			| 
				776
			 | 
			
				769
			 | 
			
			
				     git checkout $PEERTUBE_COMMIT -b $PEERTUBE_COMMIT 
			 | 
		
	
		
			
			| 
				777
			 | 
			
				770
			 | 
			
			
				     set_completion_param "peertube commit" "$PEERTUBE_COMMIT" 
			 | 
		
	
		
			
			| 
				778
			 | 
			
				771
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				779
			 | 
			
				
			 | 
			
			
				-    npm install npm@$peertube_npm_version 
			 | 
		
	
		
			
			| 
				780
			 | 
			
				
			 | 
			
			
				-    if [ ! "$?" = "0" ]; then 
			 | 
		
	
		
			
			| 
				781
			 | 
			
				
			 | 
			
			
				-        echo $"Failed to install local npm version $peertube_npm_version" 
			 | 
		
	
		
			
			| 
				782
			 | 
			
				
			 | 
			
			
				-        exit 45465774 
			 | 
		
	
		
			
			| 
				783
			 | 
			
				
			 | 
			
			
				-    fi 
			 | 
		
	
		
			
			| 
				784
			 | 
			
				
			 | 
			
			
				-    PREV_PATH=$PATH 
			 | 
		
	
		
			
			| 
				785
			 | 
			
				
			 | 
			
			
				-    PATH=$(npm bin):$PATH 
			 | 
		
	
		
			
			| 
				786
			 | 
			
				
			 | 
			
			
				-    npm install node@$peertube_node_version 
			 | 
		
	
		
			
			| 
				787
			 | 
			
				
			 | 
			
			
				-    if [ ! "$?" = "0" ]; then 
			 | 
		
	
		
			
			| 
				788
			 | 
			
				
			 | 
			
			
				-        PATH=$PREV_PATH 
			 | 
		
	
		
			
			| 
				789
			 | 
			
				
			 | 
			
			
				-        echo $"Failed to install local nodejs version $peertube_node_version" 
			 | 
		
	
		
			
			| 
				790
			 | 
			
				
			 | 
			
			
				-        exit 54875459 
			 | 
		
	
		
			
			| 
				791
			 | 
			
				
			 | 
			
			
				-    fi 
			 | 
		
	
		
			
			| 
				792
			 | 
			
				
			 | 
			
			
				-    PATH=$PREV_PATH 
			 | 
		
	
		
			
			| 
				793
			 | 
			
				
			 | 
			
			
				-    npm install npm@$peertube_npm_version 
			 | 
		
	
		
			
			| 
				794
			 | 
			
				
			 | 
			
			
				-    if [ ! "$?" = "0" ]; then 
			 | 
		
	
		
			
			| 
				795
			 | 
			
				
			 | 
			
			
				-        echo $"Failed to install local npm version $peertube_npm_version" 
			 | 
		
	
		
			
			| 
				796
			 | 
			
				
			 | 
			
			
				-        exit 678356845684 
			 | 
		
	
		
			
			| 
				797
			 | 
			
				
			 | 
			
			
				-    fi 
			 | 
		
	
		
			
			| 
				798
			 | 
			
				
			 | 
			
			
				-    npm install yarn@1.3.2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				772
			 | 
			
			
				+    npm install -g yarn 
			 | 
		
	
		
			
			| 
				799
			 | 
			
				773
			 | 
			
			
				     if [ ! "$?" = "0" ]; then 
			 | 
		
	
		
			
			| 
				800
			 | 
			
				774
			 | 
			
			
				         echo $'Failed to install yarn' 
			 | 
		
	
		
			
			| 
				801
			 | 
			
				
			 | 
			
			
				-        exit 578947946 
			 | 
		
	
		
			
			| 
				
			 | 
			
				775
			 | 
			
			
				+        exit 79353234 
			 | 
		
	
		
			
			| 
				802
			 | 
			
				776
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				803
			 | 
			
				
			 | 
			
			
				-    PATH=$(npm bin):$PATH 
			 | 
		
	
		
			
			| 
				804
			 | 
			
				777
			 | 
			
			
				     yarn add -D webpack --network-concurrency 1 
			 | 
		
	
		
			
			| 
				805
			 | 
			
				
			 | 
			
			
				-    #yarn install --non-interactive 
			 | 
		
	
		
			
			| 
				806
			 | 
			
				
			 | 
			
			
				-    #if [ ! "$?" = "0" ]; then 
			 | 
		
	
		
			
			| 
				807
			 | 
			
				
			 | 
			
			
				-    #    echo $'Failed to run yarn install' 
			 | 
		
	
		
			
			| 
				808
			 | 
			
				
			 | 
			
			
				-    #    exit 63754235 
			 | 
		
	
		
			
			| 
				809
			 | 
			
				
			 | 
			
			
				-    #fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				778
			 | 
			
			
				+    yarn install 
			 | 
		
	
		
			
			| 
				
			 | 
			
				779
			 | 
			
			
				+    if [ ! "$?" = "0" ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				780
			 | 
			
			
				+        echo $'Failed to run yarn install' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				781
			 | 
			
			
				+        exit 63754235 
			 | 
		
	
		
			
			| 
				
			 | 
			
				782
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				810
			 | 
			
				783
			 | 
			
			
				     npm install 
			 | 
		
	
		
			
			| 
				811
			 | 
			
				784
			 | 
			
			
				     if [ ! "$?" = "0" ]; then 
			 | 
		
	
		
			
			| 
				812
			 | 
			
				
			 | 
			
			
				-        PATH=$PREV_PATH 
			 | 
		
	
		
			
			| 
				813
			 | 
			
				785
			 | 
			
			
				         echo $'Failed to install peertube' 
			 | 
		
	
		
			
			| 
				814
			 | 
			
				786
			 | 
			
			
				         exit 7835243 
			 | 
		
	
		
			
			| 
				815
			 | 
			
				787
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				816
			 | 
			
				788
			 | 
			
			
				     npm run build 
			 | 
		
	
		
			
			| 
				817
			 | 
			
				789
			 | 
			
			
				     if [ ! "$?" = "0" ]; then 
			 | 
		
	
		
			
			| 
				818
			 | 
			
				
			 | 
			
			
				-        PATH=$PREV_PATH 
			 | 
		
	
		
			
			| 
				819
			 | 
			
				790
			 | 
			
			
				         echo $'Failed to build peertube' 
			 | 
		
	
		
			
			| 
				820
			 | 
			
				791
			 | 
			
			
				         exit 5293593 
			 | 
		
	
		
			
			| 
				821
			 | 
			
				792
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				822
			 | 
			
				
			 | 
			
			
				-    PATH=$PREV_PATH 
			 | 
		
	
		
			
			| 
				823
			 | 
			
				
			 | 
			
			
				-    npm install npm@$peertube_npm_version 
			 | 
		
	
		
			
			| 
				824
			 | 
			
				
			 | 
			
			
				-    if [ ! "$?" = "0" ]; then 
			 | 
		
	
		
			
			| 
				825
			 | 
			
				
			 | 
			
			
				-        echo $"Failed to install local npm version $peertube_npm_version" 
			 | 
		
	
		
			
			| 
				826
			 | 
			
				
			 | 
			
			
				-        exit 678356845684 
			 | 
		
	
		
			
			| 
				827
			 | 
			
				
			 | 
			
			
				-    fi 
			 | 
		
	
		
			
			| 
				828
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				829
			 | 
			
				
			 | 
			
			
				-    # Hacky stuff to fix runtime errors 
			 | 
		
	
		
			
			| 
				830
			 | 
			
				
			 | 
			
			
				-    sed -i 's|const url_1 = require("url");|const url_1 = require("url").Url;|g' dist/server/helpers/core-utils.js 
			 | 
		
	
		
			
			| 
				831
			 | 
			
				
			 | 
			
			
				-    sed -i 's|const urlObject = new url_1.URL(url);|const urlObject = new url_1(url);|g' dist/server/helpers/core-utils.js 
			 | 
		
	
		
			
			| 
				832
			 | 
			
				
			 | 
			
			
				-    sed -i 's|return urlObject.href.replace.*|return urlObject.href;|g' dist/server/helpers/core-utils.js 
			 | 
		
	
		
			
			| 
				833
			 | 
			
				793
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				834
			 | 
			
				794
			 | 
			
			
				     PEERTUBE_ONION_HOSTNAME=$(add_onion_service peertube 80 ${PEERTUBE_ONION_PORT}) 
			 | 
		
	
		
			
			| 
				835
			 | 
			
				795
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				836
			 | 
			
				
			 | 
			
			
				-    echo '#!/bin/bash' > $PEERTUBE_DIR/start 
			 | 
		
	
		
			
			| 
				837
			 | 
			
				
			 | 
			
			
				-    echo "cd $PEERTUBE_DIR" >> $PEERTUBE_DIR/start 
			 | 
		
	
		
			
			| 
				838
			 | 
			
				
			 | 
			
			
				-    echo 'PATH=$(npm bin):$PATH' >> $PEERTUBE_DIR/start 
			 | 
		
	
		
			
			| 
				839
			 | 
			
				
			 | 
			
			
				-    echo 'npm start' >> $PEERTUBE_DIR/start 
			 | 
		
	
		
			
			| 
				840
			 | 
			
				
			 | 
			
			
				-    chmod +x $PEERTUBE_DIR/start 
			 | 
		
	
		
			
			| 
				841
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				842
			 | 
			
				796
			 | 
			
			
				     echo '[Unit]' > /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				843
			 | 
			
				797
			 | 
			
			
				     echo 'Description=PeerTube Decentralized video streaming platform' >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				844
			 | 
			
				798
			 | 
			
			
				     echo 'After=syslog.target' >> /etc/systemd/system/peertube.service 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -848,13 +802,13 @@ function install_peertube { 
			 | 
		
	
		
			
			| 
				848
			 | 
			
				802
			 | 
			
			
				     echo 'User=peertube' >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				849
			 | 
			
				803
			 | 
			
			
				     echo 'Group=peertube' >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				850
			 | 
			
				804
			 | 
			
			
				     echo "WorkingDirectory=$PEERTUBE_DIR" >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				851
			 | 
			
				
			 | 
			
			
				-    echo "ExecStart=$PEERTUBE_DIR/start" >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				
			 | 
			
				805
			 | 
			
			
				+    echo "ExecStart=/usr/local/bin/npm start" >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				
			 | 
			
				806
			 | 
			
			
				+    echo "ExecStop=/usr/local/bin/npm stop" >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				852
			 | 
			
				807
			 | 
			
			
				     echo 'StandardOutput=syslog' >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				853
			 | 
			
				808
			 | 
			
			
				     echo 'StandardError=syslog' >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				854
			 | 
			
				809
			 | 
			
			
				     echo 'SyslogIdentifier=peertube' >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				855
			 | 
			
				810
			 | 
			
			
				     echo 'Restart=always' >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				856
			 | 
			
				
			 | 
			
			
				-    echo 'Environment=NODE_ENV=production' >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				857
			 | 
			
				
			 | 
			
			
				-    echo "Environment=NODE_CONFIG_DIR=$PEERTUBE_DIR/config" >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				
			 | 
			
				811
			 | 
			
			
				+    echo "Environment=NODE_ENV=production" >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				858
			 | 
			
				812
			 | 
			
			
				     echo '' >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				859
			 | 
			
				813
			 | 
			
			
				     echo '[Install]' >> /etc/systemd/system/peertube.service 
			 | 
		
	
		
			
			| 
				860
			 | 
			
				814
			 | 
			
			
				     echo 'WantedBy=multi-user.target' >> /etc/systemd/system/peertube.service 
			 |