publishing TW index.html only
This commit is contained in:
parent
a8403fa8cd
commit
9e7d427774
28
G1VOEUX.sh
28
G1VOEUX.sh
|
@ -34,17 +34,17 @@ echo
|
||||||
|
|
||||||
########################################################
|
########################################################
|
||||||
# BACKING UP Astronaute TW IPNS
|
# BACKING UP Astronaute TW IPNS
|
||||||
rm -Rf ~/.zen/tmp/TW
|
mkdir -p ~/.zen/tmp/TW
|
||||||
ipfs --timeout 6s get -o ~/.zen/tmp/TW/ /ipns/$ASTRONAUTENS
|
rm -f ~/.zen/tmp/TW/index.html
|
||||||
|
ipfs --timeout 6s cat /ipns/$ASTRONAUTENS > ~/.zen/tmp/TW/index.html
|
||||||
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 "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/index.html | tail -n 1)
|
||||||
ipfs name publish --key=$PLAYER /ipfs/$TW
|
ipfs name publish --key=$PLAYER /ipfs/$TW
|
||||||
else
|
else
|
||||||
# Backup
|
# Backup
|
||||||
|
## TODO index.html are different => Add signaling tiddler
|
||||||
cp ~/.zen/tmp/TW/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
|
||||||
########################################################
|
########################################################
|
||||||
|
@ -159,6 +159,7 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"Ğ1 VO
|
||||||
IVOEUPLAY=$(ipfs add -Hq /tmp/player.png | tail -n 1)
|
IVOEUPLAY=$(ipfs add -Hq /tmp/player.png | tail -n 1)
|
||||||
|
|
||||||
IVOEU=$(ipfs add -Hq /tmp/voeu.png | tail -n 1)
|
IVOEU=$(ipfs add -Hq /tmp/voeu.png | tail -n 1)
|
||||||
|
## Replace Template G1Voeu image
|
||||||
sed -i "s~bafybeidhghlcx3zdzdah2pzddhoicywmydintj4mosgtygr6f2dlfwmg7a~${IVOEU}~g" ~/.zen/game/world/$WISHKEY/index.html
|
sed -i "s~bafybeidhghlcx3zdzdah2pzddhoicywmydintj4mosgtygr6f2dlfwmg7a~${IVOEU}~g" ~/.zen/game/world/$WISHKEY/index.html
|
||||||
|
|
||||||
# NEW IVEU TIDDLER
|
# NEW IVEU TIDDLER
|
||||||
|
@ -189,11 +190,13 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"Ğ1 VO
|
||||||
echo "Mise à jour ~/.zen/game/players/$PLAYER/ipfs/moa/index.html"
|
echo "Mise à jour ~/.zen/game/players/$PLAYER/ipfs/moa/index.html"
|
||||||
cp -f ~/.zen/tmp/newindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
cp -f ~/.zen/tmp/newindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||||
echo "Avancement blockchain $PLAYER : $MOATS"
|
echo "Avancement blockchain TW $PLAYER : $MOATS"
|
||||||
cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.old
|
cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.old
|
||||||
TW=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/moa/ | tail -n 1)
|
|
||||||
|
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
||||||
echo "ipfs name publish --key=$PLAYER /ipfs/$TW"
|
echo "ipfs name publish --key=$PLAYER /ipfs/$TW"
|
||||||
ipfs name publish --key=$PLAYER /ipfs/$TW
|
ipfs name publish --key=$PLAYER /ipfs/$TW
|
||||||
|
|
||||||
# MAJ CACHE TW $PLAYER
|
# MAJ CACHE TW $PLAYER
|
||||||
echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain
|
echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain
|
||||||
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
|
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
|
||||||
|
@ -202,7 +205,7 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"Ğ1 VO
|
||||||
|
|
||||||
# PRINTING
|
# PRINTING
|
||||||
LP=$(ls /dev/usb/lp* | head -n1)
|
LP=$(ls /dev/usb/lp* | head -n1)
|
||||||
[[ ! $LP ]] && echo "NO PRINTER FOUND - Brother QL700 validated" # && exit 1
|
[[ ! $LP ]] && echo "NO PRINTER FOUND - Brother QL700 validated"
|
||||||
echo "IMPRESSION VOEU"
|
echo "IMPRESSION VOEU"
|
||||||
brother_ql_create --model QL-700 --label-size 62 /tmp/player.png > /tmp/toprint.bin 2>/dev/null
|
brother_ql_create --model QL-700 --label-size 62 /tmp/player.png > /tmp/toprint.bin 2>/dev/null
|
||||||
sudo brother_ql_print /tmp/toprint.bin $LP
|
sudo brother_ql_print /tmp/toprint.bin $LP
|
||||||
|
@ -217,13 +220,14 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"Ğ1 VO
|
||||||
|
|
||||||
# PUBLISHING
|
# PUBLISHING
|
||||||
echo "## ${PLAYER} RECORDING YOU WISH INTO BLOCKCHAIN"
|
echo "## ${PLAYER} RECORDING YOU WISH INTO BLOCKCHAIN"
|
||||||
echo "ipfs add -rHq ~/.zen/game/world/$WISHKEY/
|
echo "ipfs add -Hq ~/.zen/game/world/$WISHKEY/index.html
|
||||||
ipfs name publish --key=${WISHKEY} /ipfs/\$IPUSH"
|
ipfs name publish --key=${WISHKEY} /ipfs/\$IPUSH"
|
||||||
IPUSH=$(ipfs add -rHq ~/.zen/game/world/$WISHKEY/ | tail -n 1)
|
IPUSH=$(ipfs add -Hq ~/.zen/game/world/$WISHKEY/index.html | tail -n 1)
|
||||||
echo $IPUSH > ~/.zen/game/world/$WISHKEY/.chain # Contains last IPFS backup PLAYER KEY
|
|
||||||
echo $MOATS > ~/.zen/game/world/$WISHKEY/.moats
|
|
||||||
ipfs name publish --key=${WISHKEY} /ipfs/$IPUSH 2>/dev/null
|
ipfs name publish --key=${WISHKEY} /ipfs/$IPUSH 2>/dev/null
|
||||||
|
|
||||||
|
echo $IPUSH > ~/.zen/game/world/$WISHKEY/.chain
|
||||||
|
echo $MOATS > ~/.zen/game/world/$WISHKEY/.moats
|
||||||
|
|
||||||
echo "Astronaute Ŋ1 : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
echo "Astronaute Ŋ1 : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
||||||
|
|
||||||
echo "CAPSULE A REVE $PEPPER : http://127.0.0.1:8080/ipns/$VOEUXNS"
|
echo "CAPSULE A REVE $PEPPER : http://127.0.0.1:8080/ipns/$VOEUXNS"
|
||||||
|
|
|
@ -104,9 +104,7 @@ 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/ /ipns/$IPNSK
|
ipfs --timeout 6s cat /ipns/$IPNSK > ~/.zen/game/world/$G1PUB/index.html
|
||||||
|
|
||||||
CHECK=$(ls ~/.zen/game/world/$G1PUB/) && mv ~/.zen/game/world/$G1PUB/$CHECK ~/.zen/game/world/$G1PUB/index.html
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## CREATE GCHANGE AD
|
## CREATE GCHANGE AD
|
||||||
|
|
|
@ -23,17 +23,16 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
|
||||||
${MY_PATH}/keygen -t ipfs -o ~/.zen/tmp/gchange.key "$SALT" "$PEPPER"
|
${MY_PATH}/keygen -t ipfs -o ~/.zen/tmp/gchange.key "$SALT" "$PEPPER"
|
||||||
GNS=$(ipfs key import gchange -f pem-pkcs8-cleartext ~/.zen/tmp/gchange.key )
|
GNS=$(ipfs key import gchange -f pem-pkcs8-cleartext ~/.zen/tmp/gchange.key )
|
||||||
|
|
||||||
rm -Rf ~/.zen/tmp/TW
|
mkdir -p ~/.zen/tmp/TW
|
||||||
ipfs --timeout 5s get -o ~/.zen/tmp/TW/ /ipns/$GNS
|
rm -f ~/.zen/tmp/TW/index.html
|
||||||
|
ipfs --timeout 6s cat /ipns/$GNS > ~/.zen/tmp/TW/index.html
|
||||||
|
|
||||||
# Combien de clefs?
|
# Combien de clefs?
|
||||||
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 "Aucun ancien TW détecté! Appuyez sur ENTRER pour créer un nouveau TW Astronaute"
|
||||||
read
|
read
|
||||||
else
|
else
|
||||||
ASTRO="yes"
|
ASTRO="yes"
|
||||||
|
@ -193,10 +192,10 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Copy Astro TW
|
## Copy Astro TW
|
||||||
[[ $ASTRO == "yes" ]] && cp ~/.zen/tmp/TW.html ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
|
[[ $ASTRO == "yes" ]] && cp ~/.zen/tmp/TW/index.html ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
|
||||||
|
|
||||||
echo "## PUBLISHING ${PLAYER} /ipns/$ASTRONAUTENS/"
|
echo "## PUBLISHING ${PLAYER} /ipns/$ASTRONAUTENS/"
|
||||||
IPUSH=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/ | tail -n 1)
|
IPUSH=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html | tail -n 1)
|
||||||
echo $IPUSH > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/.chain # Contains last IPFS backup PLAYER KEY
|
echo $IPUSH > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/.chain # Contains last IPFS backup PLAYER KEY
|
||||||
echo "/ipfs/$IPUSH"
|
echo "/ipfs/$IPUSH"
|
||||||
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/.moats
|
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/.moats
|
||||||
|
|
|
@ -27,26 +27,28 @@ do
|
||||||
echo $W
|
echo $W
|
||||||
|
|
||||||
mkdir -p ~/.zen/tmp/work
|
mkdir -p ~/.zen/tmp/work
|
||||||
|
rm -f ~/.zen/tmp/work/index.html
|
||||||
|
|
||||||
echo "Getting latest online TW..."
|
echo "Getting latest online TW..."
|
||||||
ipfs --timeout 12s get -o ~/.zen/tmp/work/ /ipns/$voeuns
|
ipfs --timeout 12s cat /ipns/$voeuns > ~/.zen/tmp/work/index.html
|
||||||
|
|
||||||
# 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"
|
||||||
echo "ipfs key rm $voeu && rm -Rf ~/.zen/game/world/$voeu"
|
echo "ipfs key rm $voeu && rm -Rf ~/.zen/game/world/$voeu"
|
||||||
continue
|
continue
|
||||||
|
else
|
||||||
|
# Update local copy
|
||||||
|
cp ~/.zen/tmp/work/index.html ~/.zen/game/world/$voeu/index.html
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# RECORDING BLOCKCHAIN TIC
|
# RECORDING BLOCKCHAIN TIC
|
||||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||||
cp ~/.zen/game/world/$voeu/.chain ~/.zen/game/world/$voeu/.chain.old
|
cp ~/.zen/game/world/$voeu/.chain ~/.zen/game/world/$voeu/.chain.old
|
||||||
IPUSH=$(ipfs add -rHq ~/.zen/game/world/$voeu/ | tail -n 1)
|
IPUSH=$(ipfs add -Hq ~/.zen/game/world/$voeu/index.html | tail -n 1)
|
||||||
|
ipfs name publish --key=${voeu} /ipfs/$IPUSH 2>/dev/null
|
||||||
|
|
||||||
echo $IPUSH > ~/.zen/game/world/$voeu/.chain
|
echo $IPUSH > ~/.zen/game/world/$voeu/.chain
|
||||||
echo $MOATS > ~/.zen/game/world/$voeu/.moats
|
echo $MOATS > ~/.zen/game/world/$voeu/.moats
|
||||||
ipfs name publish --key=${voeu} /ipfs/$IPUSH 2>/dev/null
|
|
||||||
|
|
||||||
rm -Rf ~/.zen/tmp/work
|
rm -Rf ~/.zen/tmp/work
|
||||||
|
|
||||||
|
@ -72,9 +74,9 @@ for PLAYER in $(ls ~/.zen/game/players/); do
|
||||||
## 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
|
mkdir -p ~/.zen/tmp/astro
|
||||||
|
ipfs --timeout 12s cat /ipns/$ASTRONAUTENS > ~/.zen/tmp/astro/index.html
|
||||||
|
|
||||||
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..."
|
||||||
continue
|
continue
|
||||||
|
@ -83,7 +85,7 @@ for PLAYER in $(ls ~/.zen/game/players/); do
|
||||||
cp ~/.zen/tmp/astro/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
cp ~/.zen/tmp/astro/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TW=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/moa/ | tail -n 1)
|
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
||||||
ipfs name publish --key=$PLAYER /ipfs/$TW
|
ipfs name publish --key=$PLAYER /ipfs/$TW
|
||||||
|
|
||||||
echo "$PLAYER : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
echo "$PLAYER : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
||||||
|
|
Loading…
Reference in New Issue