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
rm -f ~/.zen/tmp/index.html
ipfs --timeout 5s get -o ~/.zen/tmp/index.html /ipns/$ASTRONAUTENS
if [ ! -f ~/.zen/tmp/index.html ]; then
rm -Rf ~/.zen/tmp/TW
ipfs --timeout 6s get -o ~/.zen/tmp/TW /ipns/$ASTRONAUTENS
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..."
TW=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/moa/ | tail -n 1)
ipfs name publish --key=$PLAYER /ipfs/$TW
else
# 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
########################################################

View File

@ -104,13 +104,9 @@ sudo cat /dev/ttyACM0 | while read line; do
else
echo "Canal TW existant"
# 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/
tiddlywiki $G1PUB --load ~/.zen/game/world/$G1PUB/index.html &
sleep 3 && killall node # TRASH PUNK PROGRAMMING
echo "BACKUP DONE !!"
cd $MY_PATH
CHECK=(ls ~/.zen/game/world/$G1PUB/) && mv ~/.zen/game/world/$G1PUB/$CHECK ~/.zen/game/world/$G1PUB/index.html
fi
## 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 | 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
echo "Première connexion? Appuyez sur ENTRER pour créer un nouveau TW Astronaute"
read
else
ASTRO="yes"
echo "Bienvenue Astronaute. Nous avons capté votre TW"
echo "http://127.0.0.1:8080/ipns/$GNS"
echo "Initialisation de votre compte local"
fi
if [ ! -f ~/.zen/tmp/TW/index.html ]; then
echo "Première connexion? Appuyez sur ENTRER pour créer un nouveau TW Astronaute"
read
else
ASTRO="yes"
echo "Bienvenue Astronaute. Nous avons capté votre TW"
echo "http://127.0.0.1:8080/ipns/$GNS"
echo "Initialisation de votre compte local"
fi
fi

View File

@ -31,6 +31,8 @@ do
echo "Getting latest online TW..."
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
echo "UNAVAILABLE WISH! If you want to remove $W $voeu"
@ -61,12 +63,13 @@ done
## PLAYER TW
for PLAYER in $(ls ~/.zen/game/players/); do
echo "PLAYER $PLAYER"
echo "PLAYER : $PLAYER"
## REFRESH ASTRONAUTE TW
ASTRONAUTENS=$(cat ~/.zen/game/players/$PLAYER/.playerns)
rm -Rf ~/.zen/tmp/astro
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
echo "ERROR IPNS TIMEOUT. Using local backup..."
else