Forest Wishes
This commit is contained in:
parent
8d0f244cb1
commit
a90079d164
97
G1VOEUX.sh
97
G1VOEUX.sh
|
@ -20,9 +20,9 @@ QRTW="$4" # Nombre de QR + TW5 à créer
|
||||||
|
|
||||||
[[ $MONTANT == "" ]] && MONTANT="_?_"
|
[[ $MONTANT == "" ]] && MONTANT="_?_"
|
||||||
[[ $PLAYER == "" ]] && PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
|
[[ $PLAYER == "" ]] && PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
|
||||||
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null)
|
|
||||||
[[ $PLAYER == "" ]] && echo "Second paramètre PLAYER manquant" && exit 1
|
[[ $PLAYER == "" ]] && echo "Second paramètre PLAYER manquant" && exit 1
|
||||||
[[ $G1PUB == "" ]] && G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null)
|
PSEUDO=$(cat ~/.zen/game/players/$PLAYER/.pseudo 2>/dev/null)
|
||||||
|
[[ $G1PUB == "" ]] && G1PUB=$(cat ~/.zen/game/players/$PLAYER/.g1pub 2>/dev/null)
|
||||||
[[ $G1PUB == "" ]] && echo "Troisième paramètre G1PUB manquant" && exit 1
|
[[ $G1PUB == "" ]] && echo "Troisième paramètre G1PUB manquant" && exit 1
|
||||||
[[ $QRTW == "" ]] && QRTW=1
|
[[ $QRTW == "" ]] && QRTW=1
|
||||||
|
|
||||||
|
@ -33,14 +33,15 @@ echo "Bienvenue $PSEUDO ($PLAYER) : $G1PUB"
|
||||||
echo "Astronaute Ŋ1 : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
echo "Astronaute Ŋ1 : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# BACKING UP IPNS
|
# BACKING UP Astronaute TW IPNS
|
||||||
rm -f ~/.zen/tmp/index.html
|
rm -f ~/.zen/tmp/index.html
|
||||||
ipfs --timeout 5s get -o ~/.zen/tmp/index.html /ipns/$ASTRONAUTENS
|
ipfs --timeout 5s get -o ~/.zen/tmp/index.html /ipns/$ASTRONAUTENS
|
||||||
if [ ! -f ~/.zen/tmp/index.html ]; then
|
if [ ! -f ~/.zen/tmp/index.html ]; then
|
||||||
echo "ERROR IPNS TIMEOUT"
|
echo "ERROR IPNS TIMEOUT. Restoring local backup..."
|
||||||
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
||||||
ipfs name publish --key=$G1PUB /ipfs/$TW
|
ipfs name publish --key=$PLAYER /ipfs/$TW
|
||||||
else
|
else
|
||||||
|
# Backup
|
||||||
cp ~/.zen/tmp/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
cp ~/.zen/tmp/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ do
|
||||||
|
|
||||||
echo "Entrez un Titre pour ce Voeu"
|
echo "Entrez un Titre pour ce Voeu"
|
||||||
read TITRE
|
read TITRE
|
||||||
PEPPER=$(echo "$TITRE" | sed -r 's/\<./\U&/g' | sed 's/ //g')
|
PEPPER=$(echo "$TITRE" | sed -r 's/\<./\U&/g' | sed 's/ //g') # CapitalGluedWords
|
||||||
|
|
||||||
echo "# CREATION CLEF DE VOEUX"
|
echo "# CREATION CLEF DE VOEUX"
|
||||||
${MY_PATH}/tools/keygen -t duniter -o ~/.zen/tmp/qrtw.dunikey "$SALT" "$PEPPER"
|
${MY_PATH}/tools/keygen -t duniter -o ~/.zen/tmp/qrtw.dunikey "$SALT" "$PEPPER"
|
||||||
|
@ -75,7 +76,7 @@ do
|
||||||
echo $PEPPER > ~/.zen/game/world/$WISHKEY/.pepper
|
echo $PEPPER > ~/.zen/game/world/$WISHKEY/.pepper
|
||||||
|
|
||||||
echo "# CREATION TW"
|
echo "# CREATION TW"
|
||||||
# ipfs cat /ipfs/bafybeihxqfukhb7jplda5kc32d7nq6oudgp3icy5zxxyxp6vcubg4g3myq > ~/.zen/Astroport.ONE/templates/twdefault.html
|
# ipfs cat /ipfs/bafybeierk6mgrlwpowdcfpvibujhg2b6upjfl3gryw2k72f7smxt6cqtiu > ~/.zen/Astroport.ONE/templates/twdefault.html
|
||||||
cp ~/.zen/Astroport.ONE/templates/twdefault.html ~/.zen/game/world/$WISHKEY/index.html
|
cp ~/.zen/Astroport.ONE/templates/twdefault.html ~/.zen/game/world/$WISHKEY/index.html
|
||||||
|
|
||||||
# PERSONNALISATION
|
# PERSONNALISATION
|
||||||
|
@ -90,57 +91,82 @@ do
|
||||||
# IPNS KEY is WISHKEY / VOEUXNS
|
# IPNS KEY is WISHKEY / VOEUXNS
|
||||||
sed -i "s~_MEDIAKEY_~${WISHKEY}~g" ~/.zen/game/world/$WISHKEY/index.html
|
sed -i "s~_MEDIAKEY_~${WISHKEY}~g" ~/.zen/game/world/$WISHKEY/index.html
|
||||||
sed -i "s~k2k4r8naeti1ny2hsk3a0ziwz22urwiu633hauluwopf4vwjk4x68qgk~${VOEUXNS}~g" ~/.zen/game/world/$WISHKEY/index.html
|
sed -i "s~k2k4r8naeti1ny2hsk3a0ziwz22urwiu633hauluwopf4vwjk4x68qgk~${VOEUXNS}~g" ~/.zen/game/world/$WISHKEY/index.html
|
||||||
# ASTROPORT RELAY
|
# ASTROPORT LOCAL IP RELAY == Smartphone doesn't resolve LAN DNS. So using Astroport Station IP
|
||||||
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/world/$WISHKEY/index.html
|
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/world/$WISHKEY/index.html
|
||||||
sed -i "s~127.0.0.1~$myIP~g" ~/.zen/game/world/$WISHKEY/index.html
|
sed -i "s~127.0.0.1~$myIP~g" ~/.zen/game/world/$WISHKEY/index.html
|
||||||
sed -i "s~https://ipfs.bluelightav.org~http://127.0.0.1:8080~g" ~/.zen/game/world/$WISHKEY/index.html
|
#sed -i "s~https://ipfs.bluelightav.org~http://127.0.0.1:5001~g" ~/.zen/game/world/$WISHKEY/index.html
|
||||||
|
|
||||||
|
|
||||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://'$myIP':8080", "http://127.0.0.1:8080", "http://astroport", "https://astroport.com", "https://qo-op.com", "https://tube.copylaradio.com" ]'
|
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://'$myIP':8080", "http://127.0.0.1:8080", "http://astroport", "https://astroport.com", "https://qo-op.com", "https://tube.copylaradio.com" ]'
|
||||||
|
## RESTART IPFS !?
|
||||||
|
|
||||||
echo "# CREATION QR CODE"
|
echo "# CREATION QR CODE"
|
||||||
HOST="$(hostname).local"
|
|
||||||
|
|
||||||
qrencode -s 6 -o "$HOME/.zen/game/world/$WISHKEY/QR.WISHLINK.png" "http://$myIP:8080/ipns/$VOEUXNS"
|
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.WISHLINK.png" "http://$myIP:8080/ipns/$VOEUXNS"
|
||||||
qrencode -s 6 -o "$HOME/.zen/game/world/$WISHKEY/QR.ASTROLINK.png" "http://$myIP:8080/ipns/$ASTRONAUTENS"
|
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.ASTROLINK.png" "http://$myIP:8080/ipns/$ASTRONAUTENS"
|
||||||
qrencode -s 6 -o "$HOME/.zen/game/world/$WISHKEY/QR.G1ASTRO.png" "$G1PUB"
|
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.G1ASTRO.png" "$G1PUB"
|
||||||
qrencode -s 6 -o "$HOME/.zen/game/world/$WISHKEY/QR.G1WISH.png" "$WISHKEY"
|
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.G1WISH.png" "$WISHKEY"
|
||||||
qrencode -s 6 -o "$HOME/.zen/game/world/$WISHKEY/QR.IPNS.png" "/ipns/$VOEUXNS"
|
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.IPNS.png" "/ipns/$VOEUXNS"
|
||||||
|
|
||||||
# Bricolage avec node tiddlywiki (TODO add tiddler with command line)
|
# Bricolage avec node tiddlywiki (TODO add tiddler with command line)
|
||||||
#
|
# A suivre .... https://talk.tiddlywiki.org/t/how-to-add-extract-modify-tiddlers-from-command-line-to-do-ipfs-media-transfer/4345/4
|
||||||
cd ~/.zen/game/world/$WISHKEY
|
# cd ~/.zen/game/world/$WISHKEY
|
||||||
tiddlywiki $WISHKEY --load ~/.zen/game/world/$WISHKEY/index.html --savewikifolder ./tw/
|
# tiddlywiki $WISHKEY --load ~/.zen/game/world/$WISHKEY/index.html --savewikifolder ./tw/
|
||||||
cd -
|
# cd -
|
||||||
|
|
||||||
# PREMIER TYPE
|
#################################
|
||||||
convert $HOME/.zen/game/world/$WISHKEY/QR.WISHLINK.png -resize 300 /tmp/QR.png
|
# PREMIER TYPE /tmp/player.png
|
||||||
|
convert $HOME/.zen/game/world/$WISHKEY/QR.WISHLINK.png -resize 300 /tmp/QRWISHLINK.png
|
||||||
convert ${MY_PATH}/images/logoastro.png -resize 220 /tmp/ASTROLOGO.png
|
convert ${MY_PATH}/images/logoastro.png -resize 220 /tmp/ASTROLOGO.png
|
||||||
convert ${MY_PATH}/images/logojeu.png -resize 260 /tmp/MIZLOGO.png
|
|
||||||
|
|
||||||
composite -compose Over -gravity NorthWest -geometry +350+10 /tmp/ASTROLOGO.png ${MY_PATH}/images/Brother_600x400.png /tmp/astroport.png
|
composite -compose Over -gravity NorthWest -geometry +350+10 /tmp/ASTROLOGO.png ${MY_PATH}/images/Brother_600x400.png /tmp/astroport.png
|
||||||
composite -compose Over -gravity NorthWest -geometry +0+0 /tmp/QR.png /tmp/astroport.png /tmp/one.png
|
composite -compose Over -gravity NorthWest -geometry +0+0 /tmp/QRWISHLINK.png /tmp/astroport.png /tmp/one.png
|
||||||
convert -gravity northwest -pointsize 35 -fill black -draw "text 320,250 \"$PSEUDO\"" /tmp/one.png /tmp/hop.png
|
convert -gravity northwest -pointsize 35 -fill black -draw "text 320,250 \"$PSEUDO\"" /tmp/one.png /tmp/hop.png
|
||||||
convert -gravity northwest -pointsize 30 -fill black -draw "text 20,320 \"$PEPPER\"" /tmp/hop.png /tmp/pseudo.png
|
convert -gravity northwest -pointsize 30 -fill black -draw "text 20,320 \"$PEPPER\"" /tmp/hop.png /tmp/pseudo.png
|
||||||
convert -gravity northwest -pointsize 30 -fill black -draw "text 320,300 \"$SALT\"" /tmp/pseudo.png /tmp/salt.png
|
convert -gravity northwest -pointsize 30 -fill black -draw "text 320,300 \"$SALT\"" /tmp/pseudo.png /tmp/salt.png
|
||||||
convert -gravity northwest -pointsize 40 -fill black -draw "text 320,350 \"$PEPPER\"" /tmp/salt.png /tmp/player.png
|
convert -gravity northwest -pointsize 40 -fill black -draw "text 320,350 \"$PEPPER\"" /tmp/salt.png /tmp/player.png
|
||||||
|
|
||||||
# SECOND TYPE
|
#################################
|
||||||
convert $HOME/.zen/game/world/$WISHKEY/QR.G1WISH.png -resize 300 /tmp/G1.png
|
# SECOND TYPE /tmp/voeu.png
|
||||||
convert $HOME/.zen/game/world/$WISHKEY/QR.IPNS.png -resize 300 /tmp/IPNS.png
|
convert $HOME/.zen/game/world/$WISHKEY/QR.G1WISH.png -resize 300 /tmp/G1WISH.png
|
||||||
|
convert ${MY_PATH}/images/logojeu.png -resize 260 /tmp/MIZLOGO.png
|
||||||
|
|
||||||
composite -compose Over -gravity NorthWest -geometry +300+0 /tmp/G1.png ${MY_PATH}/images/Brother_600x400.png /tmp/astroport.png
|
composite -compose Over -gravity NorthWest -geometry +0+0 /tmp/G1WISH.png ${MY_PATH}/images/Brother_600x400.png /tmp/astroport.png
|
||||||
composite -compose Over -gravity NorthWest -geometry +0+0 /tmp/IPNS.png /tmp/astroport.png /tmp/one.png
|
composite -compose Over -gravity NorthWest -geometry +300+0 /tmp/QRWISHLINK.png /tmp/astroport.png /tmp/one.png
|
||||||
composite -compose Over -gravity NorthWest -geometry +320+280 /tmp/MIZLOGO.png /tmp/one.png /tmp/two.png
|
composite -compose Over -gravity NorthWest -geometry +320+280 /tmp/MIZLOGO.png /tmp/one.png /tmp/two.png
|
||||||
|
|
||||||
convert -gravity northwest -pointsize 28 -fill black -draw "text 32,350 \"$PEPPER\"" /tmp/two.png /tmp/play.png
|
convert -gravity northwest -pointsize 28 -fill black -draw "text 32,350 \"$PEPPER\"" /tmp/two.png /tmp/pep.png
|
||||||
convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"Ğ1 RÊVE\"" /tmp/play.png /tmp/voeu.png
|
convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"Ğ1 VOEU\"" /tmp/pep.png /tmp/voeu.png
|
||||||
|
|
||||||
|
|
||||||
# IMAGE IPFS
|
# IMAGE DASN IPFS
|
||||||
IREVE=$(ipfs add -Hq /tmp/voeu.png | tail -n 1)
|
IVOEUPLAY=$(ipfs add -Hq /tmp/player.png | tail -n 1)
|
||||||
sed -i "s~bafybeidhghlcx3zdzdah2pzddhoicywmydintj4mosgtygr6f2dlfwmg7a~${IREVE}~g" ~/.zen/game/world/$WISHKEY/index.html
|
|
||||||
|
IVOEU=$(ipfs add -Hq /tmp/voeu.png | tail -n 1)
|
||||||
|
sed -i "s~bafybeidhghlcx3zdzdah2pzddhoicywmydintj4mosgtygr6f2dlfwmg7a~${IVOEU}~g" ~/.zen/game/world/$WISHKEY/index.html
|
||||||
|
|
||||||
|
# NEW IVEU TIDDLER
|
||||||
|
echo "## Creation json tiddler : Qr${PEPPER} /ipfs/${IVOEU}"
|
||||||
|
echo '[
|
||||||
|
{
|
||||||
|
"title": "'Qr${PEPPER}'",
|
||||||
|
"type": "'image/jpeg'",
|
||||||
|
"tags": "'Voeu ${PEPPER}'",
|
||||||
|
"_canonical_uri": "'/ipfs/${IVOEUPLAY}'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
' > ~/.zen/tmp/${PEPPER}.voeu.json
|
||||||
|
|
||||||
|
rm ~/.zen/tmp/newindex.html
|
||||||
|
echo "Ajout nouveau tiddler Qr$PEPPER dans MOA $PSEUDO : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
||||||
|
tiddlywiki --verbose --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --import ~/.zen/tmp/${PEPPER}.voeu.json json --output ~/.zen/tmp/ --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||||
|
if [[ -f ~/.zen/tmp/newindex.html ]]; then
|
||||||
|
TW=$(ipfs add -Hq ~/.zen/tmp/newindex.html | tail -n 1)
|
||||||
|
echo "Pulication IPNS clef $PLAYER /ipfs/$TW"
|
||||||
|
ipfs name publish --key=$PLAYER /ipfs/$TW
|
||||||
|
# MAJ CACHE TW $PLAYER
|
||||||
|
cp -f ~/.zen/tmp/newindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||||
|
fi
|
||||||
|
|
||||||
# PRINTING
|
# PRINTING
|
||||||
LP=$(ls /dev/usb/lp* | head -n1)
|
LP=$(ls /dev/usb/lp* | head -n1)
|
||||||
|
@ -153,6 +179,9 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"Ğ1 R
|
||||||
|
|
||||||
# COPY QR CODE TO PLAYER ZONE
|
# COPY QR CODE TO PLAYER ZONE
|
||||||
cp /tmp/player.png /tmp/voeu.png ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/
|
cp /tmp/player.png /tmp/voeu.png ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/
|
||||||
|
echo "$PEPPER" > ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/.title
|
||||||
|
echo "http://$myIP:8080/ipns/$VOEUXNS" > ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/.link
|
||||||
|
cp ~/.zen/game/world/$WISHKEY/QR.WISHLINK.png ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/
|
||||||
|
|
||||||
# PUBLISHING
|
# PUBLISHING
|
||||||
echo "## ${PLAYER} RECORDING YOU WISH INTO BLOCKCHAIN"
|
echo "## ${PLAYER} RECORDING YOU WISH INTO BLOCKCHAIN"
|
||||||
|
|
28
start.sh
28
start.sh
|
@ -78,7 +78,7 @@ ASTRONAUTENS=$(ipfs key list -l | grep -w "$PLAYER" | cut -d ' ' -f 1)
|
||||||
echo "Votre MOA : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
echo "Votre MOA : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
||||||
|
|
||||||
PS3="$PLAYER choisissez : __ "
|
PS3="$PLAYER choisissez : __ "
|
||||||
choices=("CREER UN VOEU" "IMPRIMER VISA" "EXPORTER VISA" "SUPPRIMER VISA" "QUITTER")
|
choices=("CREER UN VOEU" "IMPRIMER VOEU" "IMPRIMER VISA" "EXPORTER VISA" "SUPPRIMER VISA" "QUITTER")
|
||||||
select fav in "${choices[@]}"; do
|
select fav in "${choices[@]}"; do
|
||||||
case $fav in
|
case $fav in
|
||||||
"IMPRIMER VISA")
|
"IMPRIMER VISA")
|
||||||
|
@ -118,13 +118,27 @@ select fav in "${choices[@]}"; do
|
||||||
#~/.zen/astrXbian/ajouter_video.sh
|
#~/.zen/astrXbian/ajouter_video.sh
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"LISTE DES VOEUX")
|
"IMPRIMER VOEU")
|
||||||
PS3='Action à mener ___ '
|
PS3='Choisissez un de vos voeux ___ '
|
||||||
voeux=($(ls ~/.zen/game/players/$PLAYER/voeux 2>/dev/null))
|
voeux=($(ls ~/.zen/game/players/$PLAYER/voeux 2>/dev/null))
|
||||||
select fav in "${voeux[@]}"; do
|
select voeu in "${voeux[@]}"; do
|
||||||
case $fav in
|
case $voeu in
|
||||||
*) echo "Salut $fav"
|
*) echo "IMPRESSION $voeu"
|
||||||
break
|
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
|
||||||
|
VOEUXNS=$($MY_PATH/tools/g1_to_ipfs.py $voeu)
|
||||||
|
qrencode -s 12 -o "$HOME/.zen/game/world/$voeu/QR.WISHLINK.png" "http://$myIP:8080/ipns/$VOEUXNS"
|
||||||
|
convert $HOME/.zen/game/world/$voeu/QR.WISHLINK.png -resize 600 /tmp/QRWISHLINK.png
|
||||||
|
TITLE=$(cat ~/.zen/game/world/$voeu/.pepper)
|
||||||
|
convert -gravity northwest -pointsize 35 -fill black -draw "text 250,5 \"$TITLE\"" /tmp/QRWISHLINK.png /tmp/g1voeu.png
|
||||||
|
echo " QR code $TITLE : http://$myIP:8080/ipns/$VOEUXNS"
|
||||||
|
|
||||||
|
LP=$(ls /dev/usb/lp* | head -n1)
|
||||||
|
[[ ! $LP ]] && echo "NO PRINTER FOUND - Brother QL700 validated" && continue
|
||||||
|
|
||||||
|
echo "IMPRESSION LIEN TW VOEU"
|
||||||
|
brother_ql_create --model QL-700 --label-size 62 /tmp/g1voeu.png > /tmp/toprint.bin 2>/dev/null
|
||||||
|
sudo brother_ql_print /tmp/toprint.bin $LP
|
||||||
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,6 +9,33 @@
|
||||||
SALT="$1"
|
SALT="$1"
|
||||||
PEPPER="$2"
|
PEPPER="$2"
|
||||||
|
|
||||||
|
## Chargement TW !!!
|
||||||
|
if [[ $SALT != "" && PEPPER != "" ]]; then
|
||||||
|
ipfs key rm gchange
|
||||||
|
rm -f ~/.zen/tmp/gchange.key
|
||||||
|
${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 )
|
||||||
|
|
||||||
|
rm -f ~/.zen/tmp/TW.html
|
||||||
|
ipfs --timeout 5s get -o ~/.zen/tmp/TW.html /ipns/$GNS
|
||||||
|
|
||||||
|
# Combien de clefs?
|
||||||
|
ipfs key list -l | grep -w $GNS
|
||||||
|
ipfs key list -l | grep -w $GNS | wc -l
|
||||||
|
|
||||||
|
|
||||||
|
if [ ! -f ~/.zen/tmp/TW.html ]; then
|
||||||
|
echo "Première connexion? Appuyez sur ENTRER pour créer un nouveau TW Astronaute"
|
||||||
|
read
|
||||||
|
else
|
||||||
|
echo "Bienvenue Astronaute. Nous avons capté votre TW"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
fi
|
||||||
echo "=============================================
|
echo "=============================================
|
||||||
MadeInZion DIPLOMATIC PASSPORT
|
MadeInZion DIPLOMATIC PASSPORT
|
||||||
=============================================
|
=============================================
|
||||||
|
@ -18,6 +45,7 @@ Solar Punk garden forest terraforming game.
|
||||||
Bienvenue 'Astronaute'"; sleep 1
|
Bienvenue 'Astronaute'"; sleep 1
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "Création de votre PSEUDO, votre PLAYER, avec PASS (6 chiffres)"
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
|
@ -27,12 +55,10 @@ ME="${0##*/}"
|
||||||
! ipfs swarm peers >/dev/null 2>&1 && echo "Lancez 'ipfs daemon' SVP" && exit 1
|
! ipfs swarm peers >/dev/null 2>&1 && echo "Lancez 'ipfs daemon' SVP" && exit 1
|
||||||
|
|
||||||
[[ $SALT == "" ]] && SALT=$(${MY_PATH}/diceware.sh 4 | xargs)
|
[[ $SALT == "" ]] && SALT=$(${MY_PATH}/diceware.sh 4 | xargs)
|
||||||
# echo "-> SALT : $SALT"
|
echo "-> SALT : $SALT"
|
||||||
|
|
||||||
[[ PEPPER == "" ]] && PEPPER=$(${MY_PATH}/diceware.sh 2 | xargs)
|
[[ $PEPPER == "" ]] && PEPPER=$(${MY_PATH}/diceware.sh 2 | xargs)
|
||||||
# echo "-> PEPPER : $PEPPER"
|
echo "-> PEPPER : $PEPPER"
|
||||||
|
|
||||||
echo "Création de votre PSEUDO, votre PLAYER, avec PASS (6 chiffres)"
|
|
||||||
|
|
||||||
echo "CHOISISSEZ UN PSEUDO" && read PSEUDO; PSEUDO=${PSEUDO,,} && [[ $(ls ~/.zen/game/players/$PSEUDO* 2>/dev/null) ]] && echo "CE PSEUDO EST DEJA UN PLAYER. EXIT" && exit 1
|
echo "CHOISISSEZ UN PSEUDO" && read PSEUDO; PSEUDO=${PSEUDO,,} && [[ $(ls ~/.zen/game/players/$PSEUDO* 2>/dev/null) ]] && echo "CE PSEUDO EST DEJA UN PLAYER. EXIT" && exit 1
|
||||||
# PSEUDO=${PSEUDO,,} #lowercase
|
# PSEUDO=${PSEUDO,,} #lowercase
|
||||||
|
@ -87,7 +113,7 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB # Prepare astrXbian sub-datastructure
|
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB # Prepare astrXbian sub-datastructure
|
||||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs_swarm
|
mkdir -p ~/.zen/game/players/$PLAYER/ipfs_swarm
|
||||||
|
|
||||||
qrencode -s 6 -o ~/.zen/game/players/$PLAYER/QR.png "$G1PUB"
|
qrencode -s 12 -o ~/.zen/game/players/$PLAYER/QR.png "$G1PUB"
|
||||||
cp ~/.zen/game/players/$PLAYER/QR.png ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/QR.png
|
cp ~/.zen/game/players/$PLAYER/QR.png ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/QR.png
|
||||||
echo "$G1PUB" > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB/_g1.pubkey # G1SSB NOTATION (astrXbian compatible)
|
echo "$G1PUB" > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB/_g1.pubkey # G1SSB NOTATION (astrXbian compatible)
|
||||||
|
|
||||||
|
@ -95,13 +121,15 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||||
echo "$secFromDunikey" > /tmp/${PSEUDO}.sec
|
echo "$secFromDunikey" > /tmp/${PSEUDO}.sec
|
||||||
openssl enc -aes-256-cbc -salt -in /tmp/${PSEUDO}.sec -out "/tmp/enc.${PSEUDO}.sec" -k $PASS 2>/dev/null
|
openssl enc -aes-256-cbc -salt -in /tmp/${PSEUDO}.sec -out "/tmp/enc.${PSEUDO}.sec" -k $PASS 2>/dev/null
|
||||||
PASsec=$(cat /tmp/enc.${PSEUDO}.sec | base58) && rm -f /tmp/${PSEUDO}.sec
|
PASsec=$(cat /tmp/enc.${PSEUDO}.sec | base58) && rm -f /tmp/${PSEUDO}.sec
|
||||||
qrencode -s 6 -o $HOME/.zen/game/players/$PLAYER/QRsec.png $PASsec
|
qrencode -s 12 -o $HOME/.zen/game/players/$PLAYER/QRsec.png $PASsec
|
||||||
|
|
||||||
echo "Votre Clef publique G1 est : $G1PUB"; sleep 1
|
echo "Votre Clef publique G1 est : $G1PUB"; sleep 1
|
||||||
|
|
||||||
### INITALISATION WIKI dans leurs répertoires de publication IPFS
|
### INITALISATION WIKI dans leurs répertoires de publication IPFS
|
||||||
############ TODO améliorer templates, sed, ajouter index.html, etc...
|
############ TODO améliorer templates, sed, ajouter index.html, etc...
|
||||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||||
|
if [ ! -f ~/.zen/tmp/TW.html ]; then
|
||||||
|
|
||||||
echo "Nouveau Canal TW Astronaute"
|
echo "Nouveau Canal TW Astronaute"
|
||||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/
|
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/
|
||||||
|
|
||||||
|
@ -121,24 +149,30 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||||
sed -i "s~k2k4r8naeti1ny2hsk3a0ziwz22urwiu633hauluwopf4vwjk4x68qgk~${ASTRONAUTENS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
|
sed -i "s~k2k4r8naeti1ny2hsk3a0ziwz22urwiu633hauluwopf4vwjk4x68qgk~${ASTRONAUTENS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
|
||||||
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
|
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
|
||||||
|
|
||||||
## ID CARD
|
## ID CARD
|
||||||
convert ~/.zen/game/players/$PLAYER/QR.png -resize 300 /tmp/QR.png
|
convert ~/.zen/game/players/$PLAYER/QR.png -resize 300 /tmp/QR.png
|
||||||
convert ${MY_PATH}/../images/astroport.jpg -resize 300 /tmp/ASTROPORT.png
|
convert ${MY_PATH}/../images/astroport.jpg -resize 300 /tmp/ASTROPORT.png
|
||||||
|
|
||||||
composite -compose Over -gravity SouthWest -geometry +280+20 /tmp/ASTROPORT.png ${MY_PATH}/../images/Brother_600x400.png /tmp/astroport.png
|
composite -compose Over -gravity SouthWest -geometry +280+20 /tmp/ASTROPORT.png ${MY_PATH}/../images/Brother_600x400.png /tmp/astroport.png
|
||||||
composite -compose Over -gravity NorthWest -geometry +0+0 /tmp/QR.png /tmp/astroport.png /tmp/one.png
|
composite -compose Over -gravity NorthWest -geometry +0+0 /tmp/QR.png /tmp/astroport.png /tmp/one.png
|
||||||
# composite -compose Over -gravity NorthWest -geometry +280+280 ~/.zen/game/players/.current/QRsec.png /tmp/one.png /tmp/image.png
|
# composite -compose Over -gravity NorthWest -geometry +280+280 ~/.zen/game/players/.current/QRsec.png /tmp/one.png /tmp/image.png
|
||||||
|
|
||||||
convert -gravity northwest -pointsize 35 -fill black -draw "text 50,300 \"$PSEUDO\"" /tmp/one.png /tmp/image.png
|
convert -gravity northwest -pointsize 35 -fill black -draw "text 50,300 \"$PSEUDO\"" /tmp/one.png /tmp/image.png
|
||||||
convert -gravity northwest -pointsize 30 -fill black -draw "text 300,40 \"$PLAYER\"" /tmp/image.png /tmp/pseudo.png
|
convert -gravity northwest -pointsize 30 -fill black -draw "text 300,40 \"$PLAYER\"" /tmp/image.png /tmp/pseudo.png
|
||||||
convert -gravity northeast -pointsize 25 -fill black -draw "text 20,180 \"$PASS\"" /tmp/pseudo.png /tmp/pass.png
|
convert -gravity northeast -pointsize 25 -fill black -draw "text 20,180 \"$PASS\"" /tmp/pseudo.png /tmp/pass.png
|
||||||
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,100 \"$SALT\"" /tmp/pass.png /tmp/salt.png
|
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,100 \"$SALT\"" /tmp/pass.png /tmp/salt.png
|
||||||
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,140 \"$PEPPER\"" /tmp/salt.png ~/.zen/game/players/$PLAYER/ID.png
|
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,140 \"$PEPPER\"" /tmp/salt.png ~/.zen/game/players/$PLAYER/ID.png
|
||||||
|
|
||||||
# INSERTED IMAGE IPFS
|
# INSERTED IMAGE IPFS
|
||||||
IASTRO=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ID.png | tail -n 1)
|
IASTRO=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ID.png | tail -n 1)
|
||||||
sed -i "s~bafybeidhghlcx3zdzdah2pzddhoicywmydintj4mosgtygr6f2dlfwmg7a~${IASTRO}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
|
sed -i "s~bafybeidhghlcx3zdzdah2pzddhoicywmydintj4mosgtygr6f2dlfwmg7a~${IASTRO}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
cp ~/.zen/tmp/TW.html ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
echo "## PUBLISHING ${PLAYER} /ipns/$ASTRONAUTENS/"
|
echo "## PUBLISHING ${PLAYER} /ipns/$ASTRONAUTENS/"
|
||||||
IPUSH=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html | 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/.moachain # Contains last IPFS backup PLAYER KEY
|
echo $IPUSH > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/.moachain # Contains last IPFS backup PLAYER KEY
|
||||||
|
@ -170,7 +204,7 @@ sed -i "s~bafybeidhghlcx3zdzdah2pzddhoicywmydintj4mosgtygr6f2dlfwmg7a~${IASTRO}~
|
||||||
rm -f ~/.zen/game/players/.current
|
rm -f ~/.zen/game/players/.current
|
||||||
ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
|
ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
|
||||||
|
|
||||||
qrencode -s 6 -o "$HOME/.zen/game/players/$PLAYER/QR.ASTRONAUTENS.png" "http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
qrencode -s 12 -o "$HOME/.zen/game/players/$PLAYER/QR.ASTRONAUTENS.png" "http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
||||||
|
|
||||||
echo; echo "Création de votre clef et QR codes de votre réseau Astroport Ŋ1"; sleep 1
|
echo; echo "Création de votre clef et QR codes de votre réseau Astroport Ŋ1"; sleep 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue