forked from STI/Astroport.ONE
come with it
This commit is contained in:
parent
46ae7b1968
commit
8677c60722
196
12345.sh
196
12345.sh
|
@ -66,200 +66,7 @@ while [[ ! -f ~/.zen/tmp/index.redirect && ! $(ps auxf --sort=+utime | grep -w '
|
|||
echo "$SALT"
|
||||
echo "$PEPPER"
|
||||
|
||||
# CHECK IPNS KEY EXISTENCE
|
||||
ipfs key rm gchange 2>/dev/null
|
||||
rm -f ~/.zen/tmp/gchange.key
|
||||
${MY_PATH}/tools/keygen -t ipfs -o ~/.zen/tmp/gchange.key '$SALT' '$PEPPER'
|
||||
GNS=$(ipfs key import gchange -f pem-pkcs8-cleartext ~/.zen/tmp/gchange.key )
|
||||
echo "/ipns/$GNS"
|
||||
|
||||
echo "Getting latest online TW..."
|
||||
mkdir -p ~/.zen/tmp/TW
|
||||
rm -f ~/.zen/tmp/TW/index.html
|
||||
YOU=$(ps auxf --sort=+utime | grep -w "ipfs" | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
||||
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
||||
echo "$LIBRA/ipns/$GNS"
|
||||
|
||||
[[ $YOU ]] && ipfs --timeout 12s cat /ipns/$GNS > ~/.zen/tmp/TW/index.html \
|
||||
|| curl -m 12 -so ~/.zen/tmp/TW/index.html "$LIBRA/ipns/$GNS"
|
||||
|
||||
if [ ! -s ~/.zen/tmp/TW/index.html ]; then
|
||||
|
||||
echo "Aucun TW détecté! Creation TW Astronaute"
|
||||
###################################################################################################
|
||||
|
||||
echo "PASS=$PASS"
|
||||
${MY_PATH}/tools/keygen -t duniter -o /tmp/secret.dunikey '$SALT' '$PEPPER'
|
||||
echo "key genesis"
|
||||
G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||
|
||||
[[ ! $G1PUB ]] && echo "ERREUR. clef Cesium absente." && exit 1
|
||||
|
||||
## CREATE Player personnal files storage and IPFS publish directory
|
||||
mkdir -p ~/.zen/game/players/$PLAYER # Prepare PLAYER datastructure
|
||||
mkdir -p ~/.zen/tmp/
|
||||
|
||||
mv /tmp/secret.dunikey ~/.zen/game/players/$PLAYER/
|
||||
|
||||
|
||||
# Create Player "IPNS Key" (key import)
|
||||
${MY_PATH}/tools/keygen -t ipfs -o ~/.zen/game/players/$PLAYER/secret.player '$SALT' '$PEPPER'
|
||||
ipfs key import $PLAYER -f pem-pkcs8-cleartext ~/.zen/game/players/$PLAYER/secret.player
|
||||
ipfs key import $G1PUB -f pem-pkcs8-cleartext ~/.zen/game/players/$PLAYER/secret.player
|
||||
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/G1SSB # Prepare astrXbian sub-datastructure
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs_swarm
|
||||
|
||||
qrencode -s 12 -o ~/.zen/game/players/$PLAYER/QR.png "$G1PUB"
|
||||
cp ~/.zen/game/players/$PLAYER/QR.png ~/.zen/game/players/$PLAYER/ipfs/QR.png
|
||||
echo "$G1PUB" > ~/.zen/game/players/$PLAYER/ipfs/G1SSB/_g1.pubkey # G1SSB NOTATION (astrXbian compatible)
|
||||
|
||||
secFromDunikey=$(cat ~/.zen/game/players/$PLAYER/secret.dunikey | grep "sec" | cut -d ' ' -f2)
|
||||
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
|
||||
PASsec=$(cat /tmp/enc.${PSEUDO}.sec | base58) && rm -f /tmp/${PSEUDO}.sec
|
||||
qrencode -s 12 -o $HOME/.zen/game/players/$PLAYER/QRsec.png $PASsec
|
||||
|
||||
echo "Votre Clef publique G1 est : $G1PUB"; sleep 1
|
||||
|
||||
### INITALISATION WIKI dans leurs répertoires de publication IPFS
|
||||
############ TODO améliorer templates, sed, ajouter index.html, etc...
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
echo "Nouveau Canal TW Astronaute"
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/moa/
|
||||
|
||||
cp ~/.zen/Astroport.ONE/templates/twdefault.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~_PLAYER_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~_PSEUDO_~${PSEUDO}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~_WISHKEY_~${G1PUB}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
sed -i "s~_G1PUB_~${G1PUB}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~_QRSEC_~${PASsec}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
sed -i "s~G1Voeu~G1Visa~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~Moa~${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
|
||||
GNS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
|
||||
# La Clef IPNS porte comme nom G1PUB et PLAYER
|
||||
sed -i "s~_MEDIAKEY_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~k2k4r8kxfnknsdf7tpyc46ks2jb3s9uvd3lqtcv9xlq9rsoem7jajd75~${GNS}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
|
||||
sed -i "s~127.0.0.1~$myIP~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~_SECRET_~$myIP~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html # Use ''{{MadeInZion!!secret}}'' field to change KeyKeeper Gateway IP
|
||||
|
||||
## ADD SYSTEM TW
|
||||
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html \
|
||||
--import ~/.zen/Astroport.ONE/templates/data/local.api.json "application/json" \
|
||||
--import ~/.zen/Astroport.ONE/templates/data/local.gw.json "application/json" \
|
||||
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
|
||||
[[ -s ~/.zen/tmp/newindex.html ]] && cp ~/.zen/tmp/newindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
## ID CARD
|
||||
convert ~/.zen/game/players/$PLAYER/QR.png -resize 300 /tmp/QR.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 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
|
||||
|
||||
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 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,140 \"$PEPPER\"" /tmp/salt.png ~/.zen/game/players/$PLAYER/ID.png
|
||||
|
||||
# INSERTED IMAGE IPFS
|
||||
IASTRO=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ID.png | tail -n 1)
|
||||
sed -i "s~bafybeidhghlcx3zdzdah2pzddhoicywmydintj4mosgtygr6f2dlfwmg7a~${IASTRO}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
## MEMORISE PLAYER Ŋ1 ZONE
|
||||
echo "$PLAYER" > ~/.zen/game/players/$PLAYER/.player
|
||||
echo "$PSEUDO" > ~/.zen/game/players/$PLAYER/.pseudo
|
||||
echo "$G1PUB" > ~/.zen/game/players/$PLAYER/.g1pub
|
||||
echo "$GNS" > ~/.zen/game/players/$PLAYER/.playerns
|
||||
echo "$SALT" > ~/.zen/game/players/$PLAYER/secret.june
|
||||
echo "$PEPPER" >> ~/.zen/game/players/$PLAYER/secret.june
|
||||
|
||||
rm -f ~/.zen/game/players/.current
|
||||
ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
|
||||
|
||||
qrencode -s 12 -o "$HOME/.zen/game/players/$PLAYER/QR.GNS.png" "http://127.0.0.1:8080/ipns/$GNS"
|
||||
echo; echo "Création de votre clef et QR codes de votre réseau Astroport Ŋ1"
|
||||
|
||||
echo; echo "*** Espace Astronaute Activé : ~/.zen/game/players/$PLAYER/"
|
||||
echo; echo "*** Votre TW Ŋ7 : $PLAYER"; echo "http://$myIP:8080/ipns/$GNS"
|
||||
|
||||
|
||||
echo; echo "Sécurisation de vos clefs par chiffrage SSL... "; sleep 1
|
||||
openssl enc -aes-256-cbc -salt -in "$HOME/.zen/game/players/$PLAYER/secret.june" -out "$HOME/.zen/game/players/$PLAYER/enc.secret.june" -k $PASS 2>/dev/null
|
||||
openssl enc -aes-256-cbc -salt -in "$HOME/.zen/game/players/$PLAYER/secret.dunikey" -out "$HOME/.zen/game/players/$PLAYER/enc.secret.dunikey" -k $PASS 2>/dev/null
|
||||
openssl enc -aes-256-cbc -salt -in "$HOME/.zen/game/players/$PLAYER/$KEYFILE -out" "$HOME/.zen/game/players/$PLAYER/enc.$KEYFILE" -k $PASS 2>/dev/null
|
||||
## TODO MORE SECURE ?! USE opengpg, natools, etc ...
|
||||
# ${MY_PATH}/natools.py encrypt -p $G1PUB -i ~/.zen/game/players/$PLAYER/secret.dunikey -o "$HOME/.zen/game/players/$PLAYER/secret.dunikey.oasis"
|
||||
|
||||
#################################################
|
||||
# !! TODO !! # DEMO MODE. REMOVE FOR PRODUCTION
|
||||
echo "$PASS" > ~/.zen/game/players/$PLAYER/.pass
|
||||
# ~/.zen/game/players/$PLAYER/secret.june SECURITY TODO
|
||||
# Astronaut QRCode + PASS = LOGIN (=> DECRYPTING CRYPTO IPFS INDEX)
|
||||
# TODO : Allow Astronaut PASS change ;)
|
||||
#####################################################
|
||||
|
||||
## DISCONNECT AND CONNECT CURRENT PLAYER
|
||||
rm -f ~/.zen/game/players/.current
|
||||
ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
|
||||
|
||||
## CREATE GCHANGE+ PROFILE
|
||||
${MY_PATH}/tools/Connect_PLAYER_To_Gchange.sh
|
||||
|
||||
## INIT FRIENDSHIP CAPTAIN/ASTRONAUTS (LATER THROUGH GCHANGE)
|
||||
## ${MY_PATH}/FRIENDS.init.sh
|
||||
## NO. GCHANGE+ IS THE MAIN INTERFACE, astrXbian manage
|
||||
echo "Bienvenue 'Astronaute' $PSEUDO ($PLAYER)"
|
||||
echo "Retenez votre PASS : $PASS"
|
||||
|
||||
cp ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/tmp/TW/index.html
|
||||
|
||||
###################################################################################################
|
||||
echo "## PUBLISHING ${PLAYER} /ipns/$GNS "
|
||||
IPUSH=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
||||
echo $IPUSH > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain # Contains last IPFS backup PLAYER KEY
|
||||
echo "/ipfs/$IPUSH"
|
||||
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
|
||||
ipfs name publish --key=${PLAYER} /ipfs/$IPUSH 2>/dev/null
|
||||
|
||||
|
||||
## EXISTING TW
|
||||
###################################################################################################
|
||||
else
|
||||
|
||||
# Get MadeInZion secret : TW OFFICIAL GW (TODO USE RANDOM 12345 PORT TO SEPARATE CONNECTIONS)
|
||||
tiddlywiki --load ~/.zen/tmp/TW/index.html --output ~/.zen/tmp --render '.' 'miz.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
|
||||
OLDIP=$(cat ~/.zen/tmp/miz.json | jq -r .[].secret)
|
||||
echo "TW OFFICIAL GATEWAY : $OLDIP"
|
||||
|
||||
##
|
||||
if [[ ! -d ~/.zen/game/players/$PLAYER/ipfs/moa ]]; then
|
||||
|
||||
echo "MISSING $PLAYER ASTRONAUT LOCAL VISA - REDIRECT TO -"
|
||||
|
||||
TWLINK="http://$OLDIP:8080/ipns/$GNS"
|
||||
echo "$TWLINK"
|
||||
# Injection TWLINK dans template de redirection.
|
||||
sed "s~_TWLINK_~$TWLINK~g" ~/.zen/Astroport.ONE/templates/index.redirect > ~/.zen/tmp/index.redirect
|
||||
|
||||
## Attente cloture WAITING 12345. Puis Lancement one shot http server
|
||||
while [[ $(ps auxf --sort=+utime | grep -w 'nc -l -p 12345' | grep -v -E 'color=auto|grep') ]]; do sleep 0.5; done
|
||||
cat ~/.zen/tmp/index.redirect | nc -l -p 12345 -q 1 &
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
$MY_PATH/tools/VISA.new.sh "$SALT" "$PEPPER" "$PLAYER" "$PSEUDO"
|
||||
|
||||
###################################################################################################
|
||||
# EXTRACTION MOA
|
||||
|
@ -267,6 +74,7 @@ while [[ ! -f ~/.zen/tmp/index.redirect && ! $(ps auxf --sort=+utime | grep -w '
|
|||
tiddlywiki --load ~/.zen/tmp/TW/index.html --output ~/.zen/tmp --render '.' 'tiddlers.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[moa]]'
|
||||
TITLE=$(cat ~/.zen/tmp/tiddlers.json | jq -r '.[].title') # Dessin de PLAYER
|
||||
PLAYER=$(echo $TITLE | rev | cut -f 1 -d ' ' | rev)
|
||||
[[ ! $PLAYER ]] && echo "ERROR WRONG TW" && continue
|
||||
|
||||
echo "Bienvenue Astronaute $PLAYER. Nous avons capté votre TW"
|
||||
echo "Redirection"
|
||||
|
|
|
@ -37,7 +37,7 @@ for PLAYER in $(ls ~/.zen/game/players/); do
|
|||
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
||||
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
||||
echo "$LIBRA/ipns/$ASTRONAUTENS"
|
||||
echo "http://$myIP:8080/ipns/$ASTRONAUTENS"
|
||||
echo "http://$myIP:8080/ipns/$ASTRONAUTENS ($YOU)"
|
||||
[[ $YOU ]] && ipfs --timeout 12s cat /ipns/$ASTRONAUTENS > ~/.zen/tmp/astro/index.html \
|
||||
|| curl -m 12 -so ~/.zen/tmp/astro/index.html "$LIBRA/ipns/$ASTRONAUTENS"
|
||||
|
||||
|
@ -67,7 +67,7 @@ for PLAYER in $(ls ~/.zen/game/players/); do
|
|||
##############################################################
|
||||
## SPECIAL TAG "voeu" => Creation G1Voeu (G1Titre) makes AstroBot TW G1Processing
|
||||
##############################################################
|
||||
$MY_PATH/VOEU.create.sh ~/.zen/tmp/astro/index.html $PLAYER
|
||||
$MY_PATH/VOEUX.create.sh ~/.zen/tmp/astro/index.html $PLAYER
|
||||
##############################################################
|
||||
## RUN ASTROBOT SUBPROCESS (SEARCH FOR SPECIFIC OR RUN STANDARD Ŋ1 SYNC)
|
||||
##############################################################
|
||||
|
|
|
@ -52,7 +52,8 @@ echo
|
|||
echo "# NOUVEAU VOEU"
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/
|
||||
${MY_PATH}/tools/keygen -t ipfs -o ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/qrtw.ipfskey "$SALT" "$PEPPER"
|
||||
VOEUXNS=$(ipfs key import $WISHKEY -f pem-pkcs8-cleartext ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/qrtw.ipfskey)
|
||||
ipfs key import $WISHKEY -f pem-pkcs8-cleartext ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/qrtw.ipfskey
|
||||
VOEUXNS=$(ipfs key list -l | grep -w "$WISHKEY" | cut -d ' ' -f 1 )
|
||||
echo "/ipns/$VOEUNS"
|
||||
|
||||
# CRYPTO BUG. TODO use natools to protect and share key with Ŋ1 only ;)
|
||||
|
|
2
start.sh
2
start.sh
|
@ -29,7 +29,7 @@ echo
|
|||
## VERIFY SOFTWARE DEPENDENCIES
|
||||
[[ ! $(which ipfs) ]] && echo "EXIT. Vous devez avoir installé ipfs CLI sur votre ordinateur" && echo "https://dist.ipfs.io/#go-ipfs" && exit 1
|
||||
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
||||
[[ ! $YOU ]] && echo "Lancez 'ipfs daemon' SVP" && exit 1
|
||||
[[ ! $YOU ]] && echo "Lancez 'ipfs daemon' SVP sudo systemctl start ipfs" && exit 1
|
||||
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
|
||||
|
||||
## CREATE AND OR CONNECT USER
|
||||
|
|
|
@ -12,6 +12,11 @@ ME="${0##*/}"
|
|||
|
||||
SALT="$1"
|
||||
PEPPER="$2"
|
||||
PLAYER="$3"
|
||||
PSEUDO="$4"
|
||||
|
||||
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
|
||||
|
||||
|
||||
## Chargement TW !!!
|
||||
if [[ $SALT != "" && PEPPER != "" ]]; then
|
||||
|
@ -31,23 +36,27 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
|
|||
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
||||
echo "$LIBRA/ipns/$voeuns"
|
||||
[[ $YOU ]] && ipfs --timeout 12s cat /ipns/$GNS > ~/.zen/tmp/TW/index.html \
|
||||
|| curl -so ~/.zen/tmp/TW/index.html "$LIBRA/ipns/$GNS"
|
||||
|| curl -m 12 -so ~/.zen/tmp/TW/index.html "$LIBRA/ipns/$GNS"
|
||||
|
||||
if [ ! -s ~/.zen/tmp/TW/index.html ]; then
|
||||
rm -f ~/.zen/tmp/TW/index.html
|
||||
echo "Aucun ancien TW détecté! Appuyez sur ENTRER pour créer votre TW Astronaute" ## Compte Gchange
|
||||
read
|
||||
echo "Aucun ancien TW détecté! CREATION DU TW Astronaute" ## Compte Gchange
|
||||
|
||||
else
|
||||
ASTRO="yes"
|
||||
# EXTRACTION MOA
|
||||
rm -f ~/.zen/tmp/tiddlers.json
|
||||
tiddlywiki --load ~/.zen/tmp/TW/index.html --output ~/.zen/tmp --render '.' 'tiddlers.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[moa]]'
|
||||
TITLE=$(cat ~/.zen/tmp/tiddlers.json | jq -r '.[].title') # Dessin de PLAYER
|
||||
PLAYER=$(echo $TITLE | rev | cut -f 1 -d ' ' | rev)
|
||||
[[ $(ls ~/.zen/game/players/$PLAYER 2>/dev/null) ]] && echo "PLAYER déjà présent sur cet Astroport" && exit 0
|
||||
echo "Bienvenue Astronaute $PLAYER. Nous avons capté votre TW"
|
||||
echo "http://127.0.0.1:8080/ipns/$GNS"
|
||||
echo "Initialisation de votre compte local"
|
||||
|
||||
# EXTRACTION myIP
|
||||
rm -f ~/.zen/tmp/miz.json
|
||||
tiddlywiki --load ~/.zen/tmp/TW/index.html --output ~/.zen/tmp --render '.' 'miz.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
|
||||
OLDIP=$(cat ~/.zen/tmp/miz.json | jq -r .[].secret)
|
||||
echo "TW OFFICIAL GATEWAY : http://$OLDIP:8080//ipns/$GNS"
|
||||
if [[ ! -d ~/.zen/game/players/$PLAYER/ipfs/moa ]]; then
|
||||
echo "UPDATE LOCAL COPY ~/.zen/game/players/$PLAYER/ipfs/moa"
|
||||
[[ "$myIP" == "$OLDIP" ]] && cp ~/.zen/tmp/TW/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/
|
||||
fi
|
||||
# DO NOT CONTINUE
|
||||
echo "VISA ALREADY EXISTS"
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
@ -60,9 +69,7 @@ Solar Punk garden forest terraforming game.
|
|||
=============================================
|
||||
Bienvenue 'Astronaute'"; sleep 1
|
||||
|
||||
|
||||
echo "$TITLE"
|
||||
[[ ! $ASTRO ]] && echo "Création de votre PSEUDO, votre PLAYER, avec PASS (6 chiffres)"
|
||||
echo "Création de votre PSEUDO, votre PLAYER, avec PASS (6 chiffres)"
|
||||
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
|
@ -79,10 +86,14 @@ echo "-> PEPPER : $PEPPER"
|
|||
|
||||
PSEUDO=${PLAYER%%[0-9]*}
|
||||
|
||||
[[ ! $PSEUDO ]] && echo "Choisissez un pseudo : " && read PSEUDO; PSEUDO=${PSEUDO,,}; PSEUDO=${PSEUDO%%[0-9]*} && [[ $(ls ~/.zen/game/players/$PSEUDO* 2>/dev/null) ]] && echo "CE PSEUDO EST DEJA UN PLAYER. EXIT" && exit 1
|
||||
[[ ! $PSEUDO ]] && echo "Choisissez un pseudo : " && read PSEUDO
|
||||
PSEUDO=${PSEUDO,,}
|
||||
PSEUDO=${PSEUDO%%[0-9]*}
|
||||
[[ $(ls ~/.zen/game/players/$PSEUDO* 2>/dev/null) ]] && echo "CE PSEUDO EST DEJA UN PLAYER. EXIT" && exit 1
|
||||
|
||||
# PSEUDO=${PSEUDO,,} #lowercase
|
||||
[[ ! $PLAYER ]] && PLAYER=${PSEUDO}${RANDOM:0:2}$(${MY_PATH}/diceware.sh 1 | xargs)${RANDOM:0:2}
|
||||
[[ $ASTRO ]] && echo "$PLAYER ! Vous aviez déjà un autre Player ?" && read OPLAYER && [[ $OPLAYER ]] && PLAYER=$OPLAYER
|
||||
[[ ! $PLAYER ]] && PLAYER=${PSEUDO}${RANDOM:0:2}$(${MY_PATH}/diceware.sh 1 | xargs)${RANDOM:0:2} \
|
||||
&& echo "$PLAYER ! Vous aviez déjà un autre Player ?" && read OPLAYER && [[ $OPLAYER ]] && PLAYER=$OPLAYER
|
||||
[[ -d ~/.zen/game/players/$PLAYER ]] && echo "FATAL ERROR $PLAYER NAME COLLISION. TRY AGAIN." && exit 1
|
||||
|
||||
[[ ! $PSEUDO ]] && PSEUDO=$PLAYER
|
||||
|
@ -123,7 +134,6 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
|||
|
||||
mv /tmp/secret.dunikey ~/.zen/game/players/$PLAYER/
|
||||
|
||||
|
||||
# Create Player "IPNS Key" (key import)
|
||||
${MY_PATH}/keygen -t ipfs -o ~/.zen/game/players/$PLAYER/secret.player "$SALT" "$PEPPER"
|
||||
ipfs key import $PLAYER -f pem-pkcs8-cleartext ~/.zen/game/players/$PLAYER/secret.player
|
||||
|
@ -147,7 +157,7 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
|||
### INITALISATION WIKI dans leurs répertoires de publication IPFS
|
||||
############ TODO améliorer templates, sed, ajouter index.html, etc...
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
if [ ! -f ~/.zen/tmp/TW.html ]; then
|
||||
if [ ! -f ~/.zen/tmp/TW.html ]; then
|
||||
|
||||
echo "Nouveau Canal TW Astronaute"
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/moa/
|
||||
|
@ -172,7 +182,6 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
|||
sed -i "s~k2k4r8kxfnknsdf7tpyc46ks2jb3s9uvd3lqtcv9xlq9rsoem7jajd75~${ASTRONAUTENS}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
|
||||
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
|
||||
sed -i "s~127.0.0.1~$myIP~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
sed -i "s~_SECRET_~$myIP~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html # IP of the Astronaut KeyKeeper Gateway
|
||||
|
||||
|
@ -219,12 +228,6 @@ fi
|
|||
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
|
||||
ipfs name publish --key=${PLAYER} /ipfs/$IPUSH 2>/dev/null
|
||||
|
||||
# Lanch newly created TW
|
||||
# cd ~/.zen/game/players/$PLAYER/ipfs/
|
||||
# tiddlywiki $PLAYER --verbose --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --listen port=8282
|
||||
# sleep 3
|
||||
# killall node
|
||||
|
||||
## MEMORISE PLAYER Ŋ1 ZONE
|
||||
echo "$PLAYER" > ~/.zen/game/players/$PLAYER/.player
|
||||
echo "$PSEUDO" > ~/.zen/game/players/$PLAYER/.pseudo
|
||||
|
@ -281,5 +284,5 @@ echo "Retenez votre PASS : $PASS"; sleep 2
|
|||
|
||||
echo $PSEUDO > ~/.zen/tmp/PSEUDO ## Return data to start.sh
|
||||
echo "cool $(${MY_PATH}/face.sh cool)"
|
||||
echo "Relancez start."
|
||||
echo "$PASS"
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue