correct index.html removed after TW record

This commit is contained in:
fred 2022-08-23 19:55:13 +02:00
parent ab9aa0a48e
commit 431c462e94
4 changed files with 23 additions and 20 deletions

View File

@ -34,15 +34,18 @@ echo
######################################################## ########################################################
# BACKING UP Astronaute TW IPNS # BACKING UP Astronaute TW IPNS
rm -f ~/.zen/tmp/index.html rm -Rf ~/.zen/tmp/TW
ipfs --timeout 5s get -o ~/.zen/tmp/index.html /ipns/$ASTRONAUTENS ipfs --timeout 6s get -o ~/.zen/tmp/TW /ipns/$ASTRONAUTENS
if [ ! -f ~/.zen/tmp/index.html ]; then
CHECK=(ls ~/.zen/tmp/TW/) && mv ~/.zen/tmp/TW/$CHECK ~/.zen/tmp/TW/index.html
if [ ! -f ~/.zen/tmp/TW/index.html ]; then
echo "ERROR IPNS TIMEOUT. Restoring local backup..." echo "ERROR IPNS TIMEOUT. Restoring local backup..."
TW=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/moa/ | tail -n 1) TW=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/moa/ | tail -n 1)
ipfs name publish --key=$PLAYER /ipfs/$TW ipfs name publish --key=$PLAYER /ipfs/$TW
else else
# Backup # Backup
cp ~/.zen/tmp/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html cp ~/.zen/tmp/TW/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
fi fi
######################################################## ########################################################

View File

@ -104,13 +104,9 @@ sudo cat /dev/ttyACM0 | while read line; do
else else
echo "Canal TW existant" echo "Canal TW existant"
# REFRESH IPNS # REFRESH IPNS
ipfs get -o ~/.zen/game/world/$G1PUB/index.html /ipns/$IPNSK ipfs get -o ~/.zen/game/world/$G1PUB /ipns/$IPNSK
cd ~/.zen/game/world/ CHECK=(ls ~/.zen/game/world/$G1PUB/) && mv ~/.zen/game/world/$G1PUB/$CHECK ~/.zen/game/world/$G1PUB/index.html
tiddlywiki $G1PUB --load ~/.zen/game/world/$G1PUB/index.html &
sleep 3 && killall node # TRASH PUNK PROGRAMMING
echo "BACKUP DONE !!"
cd $MY_PATH
fi fi
## CREATE GCHANGE AD ## CREATE GCHANGE AD

View File

@ -30,16 +30,17 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
ipfs key list -l | grep -w $GNS ipfs key list -l | grep -w $GNS
ipfs key list -l | grep -w $GNS | wc -l ipfs key list -l | grep -w $GNS | wc -l
CHECK=(ls ~/.zen/tmp/TW/) && mv ~/.zen/tmp/TW/$CHECK ~/.zen/tmp/TW/index.html
if [ ! -f ~/.zen/tmp/TW/index.html ]; then if [ ! -f ~/.zen/tmp/TW/index.html ]; then
echo "Première connexion? Appuyez sur ENTRER pour créer un nouveau TW Astronaute" echo "Première connexion? Appuyez sur ENTRER pour créer un nouveau TW Astronaute"
read read
else else
ASTRO="yes" ASTRO="yes"
echo "Bienvenue Astronaute. Nous avons capté votre TW" echo "Bienvenue Astronaute. Nous avons capté votre TW"
echo "http://127.0.0.1:8080/ipns/$GNS" echo "http://127.0.0.1:8080/ipns/$GNS"
echo "Initialisation de votre compte local" echo "Initialisation de votre compte local"
fi fi
fi fi

View File

@ -31,6 +31,8 @@ do
echo "Getting latest online TW..." echo "Getting latest online TW..."
ipfs --timeout 12s get -o ~/.zen/tmp/work /ipns/$voeuns ipfs --timeout 12s get -o ~/.zen/tmp/work /ipns/$voeuns
# CORRECT FileName
CHECK=(ls ~/.zen/tmp/work/) && mv ~/.zen/tmp/work/$CHECK ~/.zen/tmp/work/index.html
if [[ ! -f ~/.zen/tmp/work/index.html ]]; then if [[ ! -f ~/.zen/tmp/work/index.html ]]; then
echo "UNAVAILABLE WISH! If you want to remove $W $voeu" echo "UNAVAILABLE WISH! If you want to remove $W $voeu"
@ -61,12 +63,13 @@ done
## PLAYER TW ## PLAYER TW
for PLAYER in $(ls ~/.zen/game/players/); do for PLAYER in $(ls ~/.zen/game/players/); do
echo "PLAYER $PLAYER" echo "PLAYER : $PLAYER"
## REFRESH ASTRONAUTE TW ## REFRESH ASTRONAUTE TW
ASTRONAUTENS=$(cat ~/.zen/game/players/$PLAYER/.playerns) ASTRONAUTENS=$(cat ~/.zen/game/players/$PLAYER/.playerns)
rm -Rf ~/.zen/tmp/astro rm -Rf ~/.zen/tmp/astro
ipfs --timeout 12s get -o ~/.zen/tmp/astro /ipns/$ASTRONAUTENS ipfs --timeout 12s get -o ~/.zen/tmp/astro /ipns/$ASTRONAUTENS
CHECK=(ls ~/.zen/tmp/astro/) && mv ~/.zen/tmp/astro/$CHECK ~/.zen/tmp/astro/index.html
if [ ! -f ~/.zen/tmp/astro/index.html ]; then if [ ! -f ~/.zen/tmp/astro/index.html ]; then
echo "ERROR IPNS TIMEOUT. Using local backup..." echo "ERROR IPNS TIMEOUT. Using local backup..."
else else