Fix PWA redirect loop and installation options after uninstalling PWA
This commit is contained in:
+31
-18
@@ -29,25 +29,38 @@ if ! curl -s -L "$SOURCE_URL" -o "$TEMP_FILE"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- Rotazione file su FTP ---
|
||||
echo "🔄 Rotazione file su FTP (canti.json -> canti_ex.json)..."
|
||||
# Rinominiamo canti.json in canti_ex.json.
|
||||
# Usiamo i percorsi assoluti per sicurezza.
|
||||
curl -s -u "$FTP_USER:$FTP_PASS" \
|
||||
--ftp-pasv \
|
||||
-Q "*DELE /htdocs/api/canti_ex.json" \
|
||||
-Q "*RNFR /htdocs/api/canti.json" \
|
||||
-Q "*RNTO /htdocs/api/canti_ex.json" \
|
||||
"ftp://$FTP_HOST/" > /dev/null
|
||||
|
||||
# --- Upload via FTP ---
|
||||
echo "🚀 Caricamento nuovo file su $FTP_HOST/$REMOTE_PATH..."
|
||||
if curl -s -u "$FTP_USER:$FTP_PASS" --ftp-pasv --ftp-create-dirs -T "$TEMP_FILE" "ftp://$FTP_HOST/$REMOTE_PATH"; then
|
||||
echo "✅ Allineamento completato con successo!"
|
||||
# --- Rotazione e Caricamento file (FTP o VPS) ---
|
||||
if [ -n "$VPS_HOST" ]; then
|
||||
echo "🔄 Rotazione file su VPS ($VPS_HOST)..."
|
||||
ssh "$VPS_USER@$VPS_HOST" "mkdir -p $VPS_PATH/api && mv $VPS_PATH/api/canti.json $VPS_PATH/api/canti_ex.json 2>/dev/null || true"
|
||||
|
||||
echo "🚀 Caricamento nuovo file su VPS via SCP..."
|
||||
if scp "$TEMP_FILE" "$VPS_USER@$VPS_HOST:$VPS_PATH/$REMOTE_PATH" && ssh "$VPS_USER@$VPS_HOST" "chmod 644 $VPS_PATH/$REMOTE_PATH"; then
|
||||
echo "✅ Allineamento su VPS completato con successo!"
|
||||
else
|
||||
echo "❌ Errore durante il caricamento via SCP su VPS."
|
||||
rm "$TEMP_FILE"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "❌ Errore durante il caricamento FTP."
|
||||
rm "$TEMP_FILE"
|
||||
exit 1
|
||||
echo "🔄 Rotazione file su FTP (canti.json -> canti_ex.json)..."
|
||||
# Rinominiamo canti.json in canti_ex.json.
|
||||
# Usiamo i percorsi assoluti per sicurezza.
|
||||
curl -s -u "$FTP_USER:$FTP_PASS" \
|
||||
--ftp-pasv \
|
||||
-Q "*DELE /htdocs/api/canti_ex.json" \
|
||||
-Q "*RNFR /htdocs/api/canti.json" \
|
||||
-Q "*RNTO /htdocs/api/canti_ex.json" \
|
||||
"ftp://$FTP_HOST/" > /dev/null
|
||||
|
||||
echo "🚀 Caricamento nuovo file su FTP ($FTP_HOST) via FTP..."
|
||||
if curl -s -u "$FTP_USER:$FTP_PASS" --ftp-pasv --ftp-create-dirs -T "$TEMP_FILE" "ftp://$FTP_HOST/$REMOTE_PATH"; then
|
||||
echo "✅ Allineamento su FTP completato con successo!"
|
||||
else
|
||||
echo "❌ Errore durante il caricamento FTP."
|
||||
rm "$TEMP_FILE"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
|
||||
Reference in New Issue
Block a user