Astronauts are creating ASTROMIZ world

This commit is contained in:
fred 2022-08-15 19:07:39 +02:00
parent 457908ec09
commit b72348dea4
7 changed files with 85 additions and 360 deletions

View File

@ -8,6 +8,7 @@ MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
TS=$(date -u +%s%N | cut -b1-13)
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
echo '
_ ____ _____ ____ ___ ____ ___ ____ _____ ___ _ _ _____
@ -22,8 +23,6 @@ Ambassade numérique pair à pair sur IPFS.
ASTROPORT
VISA : MadeInZion
@@@@@@@@@@@@@@@@@@'
source ~/.zen/ipfs.sync 2>/dev/null
echo "CAPTAIN is $CAPTAIN"
echo
@ -33,7 +32,7 @@ YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail
[[ ! $YOU ]] && echo "Lancez 'ipfs daemon' SVP" && exit 1
## CREATE AND OR CONNECT USER
PS3='Créez votre nouveau VISA ou selectionner un compte Astronaute existant'
PS3='Créez VISA ou connectez-vous à votre compte Astronaute ___ '
players=("NOUVEAU VISA" $(ls ~/.zen/game/players 2>/dev/null))
select fav in "${players[@]}"; do
case $fav in
@ -68,11 +67,14 @@ rm -f ~/.zen/tmp/${PLAYER}.dunikey 2>/dev/null
openssl enc -aes-256-cbc -d -in "$HOME/.zen/game/players/.current/enc.secret.dunikey" -out "$HOME/.zen/tmp/${PLAYER}.dunikey" -k $pass 2>&1>/dev/null
[ ! -f $HOME/.zen/tmp/${PLAYER}.dunikey ] && echo "ERROR. MAUVAIS PASS. EXIT" && exit 1
echo "____________________";
${MY_PATH}/tools/PLAYER.entrance.sh ## Switch IPFS Layer with Astronaut ID & astrXbian data index structure
G1PUB=$(cat ~/.zen/tmp/${PLAYER}.dunikey | grep 'pub:' | cut -d ' ' -f 2)
echo "________LOGIN OK____________";
echo $G1PUB
echo
PS3="$PLAYER choisissez une action à mener : "
choices=("AJOUTER MEDIA" "JOURNAUX" "IMPRIMER VISA" "EXPORTER VISA" "SUPPRIMER VISA" "QUITTER")
echo "MOA : http://127.0.0.1:8080/ipns/$(cat ~/.zen/game/players/$PLAYER/.ipfsnodeid)"
PS3="$PLAYER choisissez : __ "
choices=("AJOUTER MEDIA" "IMPRIMER VISA" "EXPORTER VISA" "SUPPRIMER VISA" "QUITTER")
select fav in "${choices[@]}"; do
case $fav in
"IMPRIMER VISA")
@ -85,7 +87,7 @@ select fav in "${choices[@]}"; do
du -h ~/.zen/game/players/.current/
echo "Enter to continue. Ctrl+C to stop"
read
echo "TODO... ${MY_PATH}/tools/SAVE.astronaut.sh"
echo "NOT FINISHED TODO... ${MY_PATH}/tools/SAVE.astronaut.sh"
break
;;
@ -93,20 +95,16 @@ select fav in "${choices[@]}"; do
echo "ATTENTION SUPPRESSION DEFINITIVE"
echo "Enter to continue. Ctrl+C to stop"
read
ipfs key rm $PLAYER; ipfs key rm qo-op_$PLAYER; ipfs key rm moa_$PLAYER;
ipfs key rm $PLAYER; ipfs key rm $G1PUB;
~/.zen/astrXbian/zen/jaklis/jaklis.py -k $HOME/.zen/tmp/${PLAYER}.dunikey -n https://data.gchange.fr erase
rm -Rf ~/.zen/game/players/$PLAYER
break
;;
"AJOUTER MEDIA")
echo "VIDEOBLOG"
# ${MY_PATH}/tools/vlc_webcam.sh
~/.zen/astrXbian/ajouter_video.sh
;;
"JOURNAUX")
${MY_PATH}/tools/PLAYER.entrance.sh
break
${MY_PATH}/tools/vlc_webcam.sh
#~/.zen/astrXbian/ajouter_video.sh
;;
"QUITTER")

View File

@ -39,7 +39,7 @@ body {
</div>
<div class="column">
<iframe src="http://127.0.0.1:8080/ipns/_QOOPNS_" id="iframe2" style="height:100%;width:100%;border:none;overflow:hidden;"></iframe>
<iframe src="http://127.0.0.1:8080/ipns/_PLAYERNS_" id="iframe2" style="height:100%;width:100%;border:none;overflow:hidden;"></iframe>
</div>
</div>

View File

@ -1,4 +1,5 @@
#!/bin/bash
# Run After PLAYER.entrance.sh
######################################################################### CONNECT PLAYER WITH GCHANGE
# Check who is .current PLAYER
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
@ -6,15 +7,17 @@ PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null) || ( echo "nopseu
G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
ASTRONAUTENS=$(ipfs key list -l | grep -w "$PLAYER" | cut -d ' ' -f 1)
########################################################################
echo "CREATING $PLAYER GCHANGE+ PROFILE"
########################################################################
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" set --name "Astronaute $PLAYER" --avatar "/home/$USER/.zen/astrXbian/logo.png" --site "https://astroport.com/ipns/$(cat ~/.zen/game/players/$PLAYER/.qoopns)" #GCHANGE+
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/game/$PLAYER/secret.dunikey -n "https://data.gchange.fr" set --name "Astronaute $PLAYER" --avatar "/home/$USER/.zen/astrXbian/logo.png" --site "https://astroport.com/ipns/$ASTRONAUTENS" #GCHANGE+
[[ ! $? == 0 ]] && echo "GCHANGE PROFILE CREATION FAILED" && exit 1
########################################################################
echo "CREATING $PLAYER CESIUM+ PROFILE"
########################################################################
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://g1.data.e-is.pro" set --name "Astronaute $PLAYER" --avatar "/home/$USER/.zen/astrXbian/logo.png" --site "https://astroport.com/ipns/$(cat ~/.zen/game/players/$PLAYER/.moans)" #CESIUM+
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/game/$PLAYER/secret.dunikey -n "https://g1.data.e-is.pro" set --name "Astronaute $PLAYER" --avatar "/home/$USER/.zen/astrXbian/logo.png" --site "https://astroport.com/ipns/$ASTRONAUTENS" #CESIUM+
[[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED" && exit 1
########################################################################
@ -27,7 +30,7 @@ if [[ $bootnode != "" ]]; then
ipfsnodeid=${bootnode##*/}
g1node=$(~/.zen/astrXbian/zen/tools/ipfs_to_g1.py $ipfsnodeid)
echo "SENDING STAR TO BOOTSTRAP NODE : $g1node"
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" stars -p $g1node -n 1
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/game/$PLAYER/secret.dunikey -n "https://data.gchange.fr" stars -p $g1node -n 1
### DELETE
# ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" unstars -p $g1node
fi
@ -50,7 +53,7 @@ if [[ $bootnode != "" ]]; then
g1node=$(~/.zen/astrXbian/zen/tools/ipfs_to_g1.py $ipfsnodeid)
echo "SENDING ipfstryme to BOOTSTRAP node : $g1node"
filelines=$(cat ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr | wc -l)
[[ "$filelines" != "0" ]] && ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" send -d $g1node -t "ipfstryme" -f ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr
[[ "$filelines" != "0" ]] && ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/game/$PLAYER/secret.dunikey -n "https://data.gchange.fr" send -d $g1node -t "ipfstryme" -f ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr
fi
done

View File

@ -1,224 +0,0 @@
#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
################################################################################
# Gestion de l'entrée du PLAYER dans la Station
# Le premier devient Capitaine...
# Les suivants selon le niveau de confiance (LOVE) des meilleurs Astronautes?!
#
# 'player' 'moa'
# ~/.zen/ipfs/ -> ~/.zen/game/players/$PLAYER/ipfs/
################################################################################
################################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
# Check who is .current PLAYER
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null) || ( echo "nopseudo" && exit 1 )
G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
# Check if Astroport Station already has a "captain"
source ~/.zen/ipfs.sync; echo "CAPTAIN is $CAPTAIN"
echo
echo "** Stop or Kill ipfs daemon **"
# 1st Captain. Changing IPFS station key.
sudo service ipfs stop
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
[[ $YOU ]] && sudo killall -5 ipfs
#-----------------------------------
### CHECK FOR THE CAPTAIN
##############################
if [[ ! -d ~/.zen/game/players/$CAPTAIN || $CAPTAIN == "" || $CAPTAIN == "$HOME/astroport" ]]; then
echo "#-----------------------------------"
echo $CAPTAIN
echo "Aucun Capitaine à bord."; sleep 1
echo "$PLAYER vous devenez la clef maitre de la Station et de sa balise astrXbian..."; sleep 2
echo "Vous validez et activez les canaux, public 'qo-op' et administratif 'moa'"; sleep 2
echo "Contactez support@qo-op.com afin le Canal original MadeInZion"; sleep 2
echo
echo "=== Replacing ~/.ipfs/config ==="; sleep 2
[[ ! -f ~/.ipfs/config.astrXbian ]] && mv ~/.ipfs/config ~/.ipfs/config.astrXbian && echo "BACKUP OLD ipfs config" || rm ~/.ipfs/config
ln -s ~/.zen/game/players/$PLAYER/ipfs.config ~/.ipfs/config && echo "Installing $PLAYER 'G1' ipfs config"; sleep 2
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID); echo $IPFSNODEID
echo
echo "==== qo-op & moa Captain/Station keystore ===="; sleep 2
[[ ! -d ~/.ipfs/keystore.astrXbian ]] && mv ~/.ipfs/keystore ~/.ipfs/keystore.astrXbian
ln -s ~/.zen/game/players/$PLAYER/keystore ~/.ipfs/keystore
# Keep already created keys !!?
cp ~/.ipfs/keystore.astrXbian/* ~/.ipfs/keystore/ 2>/dev/null
###################################################################################
# 'tokenring' Key there? TOKENRING IS A SHARED KEY TO KNOW WHO IS NEXT IN MY FRIEND TO WRITE COMMON IPNS KEY
# In case of corruption... Swarm goes into DEFCON 3 procedure and eject "bad friend"
# Shared between Astroport to choose Station next write time.
[[ ! -f ~/.ipfs/keystore/key_orxwwzloojuw4zy ]] && qoopns=$(ipfs key gen tokenring)
# tokenring show which PLAYER is the actual 'official' qo-op and moa channels publisher/
# tokenringnns is used to choose who is next...
ipfs key list -l | grep -w tokenring
tokenringns=$(ipfs key list -l | grep -w tokenring | cut -d ' ' -f 1)
ipfs name publish --key=tokenring /ipfs/$(echo $PLAYER | ipfs add -q) 2>/dev/null
echo "----> 'tokenringnns' WHO IS NEXT : http://127.0.0.1:8080/ipns/$tokenringns"; sleep 1
echo "$tokenringnns" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/.tokenringnns ## 'tokenring' is "who is next player to play"
## IDEE utiliser ipfs pubsub en mode RAPIDE
###################################################################################
# 'qo-op' Key there? Or Captain already join a flag
# Astroport public channel 'state of mind' propagation...
[[ ! -f ~/.ipfs/keystore/key_ofxs233q ]] &&\
qoopns=$(ipfs key gen qo-op) && \
IPUSH=$(ipfs add -Hq ${MY_PATH}/../templates/qoopwiki.html | tail -n 1) && \
ipfs name publish --key=qo-op /ipfs/$IPUSH 2>/dev/null
# qo-op channel is created from template
ipfs key list -l | grep -w qo-op
qoopns=$(ipfs key list -l | grep -w qo-op | cut -d ' ' -f 1)
echo "----> Station 'qo-op' channel : http://127.0.0.1:8080/ipns/$qoopns"; sleep 1
echo "$qoopns" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/.qoopns ## 'qo-op' public channel declared in ipfs balise
###################################################################################
# 'moa' Key there? It is the 'Administrative' 3 star.level confidence information layer.
[[ ! -f ~/.ipfs/keystore/key_nvxwc ]] &&\
moans=$(ipfs key gen moa) && \
IPUSH=$(ipfs add -Hq ${MY_PATH}/../templates/moawiki.html | tail -n 1) && \
ipfs name publish --key=moa /ipfs/$IPUSH 2>/dev/null
# moa channel is created from template
ipfs key list -l | grep -w moa
moans=$(ipfs key list -l | grep -w moa | cut -d ' ' -f 1)
echo "----> Station 'moa' channel : http://127.0.0.1:8080/ipns/$moans"; sleep 1
echo "$moans" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/.moans ## 'moa' captain controled channel
###################################################################################
echo
echo "===== Connect captain IPFS datadir to Station (balise junction) ====="; sleep 2
## TODO MAKE FUNCTIONS
echo
echo "=== Switching ~/.ipfs/config ==="; sleep 2
[[ ! -f ~/.ipfs/config.astrXbian ]] && mv ~/.ipfs/config ~/.ipfs/config.astrXbian && echo "BACKUP OLD ipfs config" || rm ~/.ipfs/config
ln -s ~/.zen/game/players/$PLAYER/ipfs.config ~/.ipfs/config && echo "Installing $PLAYER 'G1' ipfs config"; sleep 2
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID); echo $IPFSNODEID
echo
echo "==== Astronaute keystore switch ===="; sleep 2
[[ ! -d ~/.ipfs/keystore.astrXbian ]] && mv ~/.ipfs/keystore ~/.ipfs/keystore.astrXbian || rm ~/.ipfs/keystore
ln -s ~/.zen/game/players/$PLAYER/keystore ~/.ipfs/keystore
echo "==== linking G1 Libre ID and Station ~/.zen/ipfs ===="; sleep 2
[[ ! -f ~/.zen/secret.dunikey.astrXbian ]] && mv ~/.zen/secret.dunikey ~/.zen/secret.dunikey.astrXbian || rm ~/.zen/secret.dunikey
ln -s ~/.zen/game/players/$PLAYER/secret.dunikey ~/.zen/secret.dunikey
[[ ! -f ~/.zen/secret.june.astrXbian ]] && mv ~/.zen/secret.june ~/.zen/secret.june.astrXbian || rm ~/.zen/secret.june
ln -s ~/.zen/game/players/$PLAYER/secret.june ~/.zen/secret.june
[[ ! -d ~/.zen/ipfs.astrXbian ]] && mv ~/.zen/ipfs ~/.zen/ipfs.astrXbian && echo "BACKUP ~/.zen/ipfs.astrXbian" || rm ~/.zen/ipfs
ln -s ~/.zen/game/players/$PLAYER/ipfs ~/.zen/ipfs && echo "$PLAYER ~/.zen/ipfs "
echo "VOUS ETES CAPITAINE DE LA STATION ET SES CANAUX 'qo-op', 'moa', etc ..."
echo "##################################################### OK"
echo "Identité 'self' Balise IPFS"; sleep 1
ipfs id -f='<id>\n'
echo "##################################################### OK"
echo "CAPTAIN=$PLAYER" > ~/.zen/ipfs.sync ## PLAYER IS ASTROPORT CAPTAIN NOW
## CAPTAIN is define in ~/.zen/ipfs.sync
else
##############################
echo
echo "=== Switching ~/.ipfs/config ==="; sleep 2
[[ ! -f ~/.ipfs/config.astrXbian ]] && mv ~/.ipfs/config ~/.ipfs/config.astrXbian && echo "BACKUP OLD ipfs config" || rm ~/.ipfs/config
ln -s ~/.zen/game/players/$PLAYER/ipfs.config ~/.ipfs/config && echo "Installing $PLAYER 'G1' ipfs config"; sleep 2
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID); echo $IPFSNODEID
echo
echo "==== Astronaute keystore switch ===="; sleep 2
[[ ! -d ~/.ipfs/keystore.astrXbian ]] && mv ~/.ipfs/keystore ~/.ipfs/keystore.astrXbian || rm ~/.ipfs/keystore
ln -s ~/.zen/game/players/$PLAYER/keystore ~/.ipfs/keystore
echo "==== linking G1 Libre ID and Station ~/.zen/ipfs ===="; sleep 2
[[ ! -f ~/.zen/secret.dunikey.astrXbian ]] && mv ~/.zen/secret.dunikey ~/.zen/secret.dunikey.astrXbian || rm ~/.zen/secret.dunikey
ln -s ~/.zen/game/players/$PLAYER/secret.dunikey ~/.zen/secret.dunikey
[[ ! -f ~/.zen/secret.june.astrXbian ]] && mv ~/.zen/secret.june ~/.zen/secret.june.astrXbian || rm ~/.zen/secret.june
ln -s ~/.zen/game/players/$PLAYER/secret.june ~/.zen/secret.june
[[ ! -d ~/.zen/ipfs.astrXbian ]] && mv ~/.zen/ipfs ~/.zen/ipfs.astrXbian && echo "BACKUP ~/.zen/ipfs.astrXbian" || rm ~/.zen/ipfs
ln -s ~/.zen/game/players/$PLAYER/ipfs ~/.zen/ipfs && echo "$PLAYER ~/.zen/ipfs "
if [[ $CAPTAIN == "$PLAYER" ]]; then
## THE CAPTAIN IS LOGGED IN
echo "Bienvenue CAPITAINE !"; sleep 2
echo "Ouverture des journaux 'moa' et 'qo-op' de votre Station Astroport";
# OPEN 'moa' channel
moans=$(ipfs key list -l | grep -w moa | cut -d ' ' -f 1) || moans=$(cat ~/.zen/game/players/$CAPTAIN/ipfs/.12D*/.moans | tail -n 1)
ipfs --timeout=3s ls /ipns/$moans
if [ $? != 0 ]; then
IPUSH=$(ipfs add -Hq ${MY_PATH}/../templates/moawiki.html | tail -n 1) && \
ipfs name publish --key=moa /ipfs/$IPUSH 2>/dev/null
fi
xdg-open "http://127.0.0.1:8080/ipns/$moans"
# OPEN 'qo-op' channel
qoopns=$(ipfs key list -l | grep -w qo-op | cut -d ' ' -f 1) || moans=$(cat ~/.zen/game/players/$CAPTAIN/ipfs/.12D*/.qoopns | tail -n 1)
ipfs --timeout=3s ls /ipns/$qoopns
if [ $? != 0 ]; then
IPUSH=$(ipfs add -Hq ${MY_PATH}/../templates/qoopwiki.html | tail -n 1) && \
ipfs name publish --key=qo-op /ipfs/$IPUSH 2>/dev/null
fi
xdg-open "http://127.0.0.1:8080/ipns/$qoopns"
else
# ASTRONAUT PLAYER IS LOGGED IN
echo "Joueur $PLAYER. Le Capitaine de cet Astroport est - $CAPTAIN -"; sleep 1
echo
echo "$PSEUDO, Décrivez vos 'Talents', soumettez vos 'Rêves' pour améliorer cet Astroport dans votre journal 'moa'."; sleep 2
echo "Publiez dans votre journal public 'qo-op'"; sleep 2
echo
fi
fi
echo
echo "** Restart IPFS DAEMON **"
sudo service ipfs start
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
[[ ! $YOU ]] && ipfs daemon --writable &
#-----------------------------------
echo "#-----------------------------------"
# OPEN PLAYER HOME (contains 'moa_player' + 'qo-op_player' vertical iframes
echo "OUVERTURE DE VOTRE INTERFACE JOUEUR"; sleep 1
qplayer=$(ipfs key list -l | grep -w qo-op_$PLAYER | cut -d ' ' -f 1)
~/.zen/astrXbian/zen/ipns_MOA_publish.sh
~/.zen/astrXbian/zen/ipns_TW5_publish.sh
~/.zen/astrXbian/zen/ipns_PLAYER_publish.sh
xdg-open "http://127.0.0.1:8080/ipns/$qplayer"
exit 0

View File

@ -26,7 +26,7 @@ ME="${0##*/}"
SALT=$(${MY_PATH}/diceware.sh 4 | xargs)
# [[ $1 != "quiet" ]] && echo "-> SALT : $SALT"
PEPPER=$(${MY_PATH}/diceware.sh 4 | xargs)
PEPPER=$(${MY_PATH}/diceware.sh 2 | xargs)
# [[ $1 != "quiet" ]] && echo "-> PEPPER : $PEPPER"
echo "Création de votre PSEUDO, votre PLAYER, avec PASS (6 chiffres)"
@ -34,26 +34,21 @@ echo "Création de votre PSEUDO, votre PLAYER, avec PASS (6 chiffres)"
[[ $1 != "quiet" ]] && 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
PLAYER=${PSEUDO}${RANDOM:0:2}$(${MY_PATH}/diceware.sh 1 | xargs)${RANDOM:0:2}
[[ -d ~/.zen/game/players/$PLAYER ]] && echo "FATAL ERROR $PLAYER NAME COLLISION. TRY AGAIN." && exit 1
[[ ! $PSEUDO ]] && PSEUDO=$PLAYER
[[ $1 != "quiet" ]] && echo; echo "Génération de vos identités Astronaute (PLAYER):"; sleep 1; echo "$PLAYER"; sleep 2
# 6 DIGIT PASS CODE TO PROTECT QRSEC
PASS=$(echo "${RANDOM}${RANDOM}${RANDOM}${RANDOM}" | tail -c-7)
############################################################
######### CLEFS IPNS PLAYER + moa_ + qo-op_
PLAYERNS=$(ipfs key gen $PLAYER)
PLAYERKEYFILE=$(${MY_PATH}/give_me_keystore_filename.py "$PLAYER")
# echo "Votre espace Astronaute privé. Compteurs LOVE 'Astroport' (amis de niveau 5)"
# [[ $1 != "quiet" ]] && echo "Votre clef $PLAYER <=> $PLAYERNS ($PLAYERKEYFILE)"; sleep 2
MOANS=$(ipfs key gen moa_$PLAYER)
MOAKEYFILE=$(${MY_PATH}/give_me_keystore_filename.py "moa_$PLAYER")
######### TODO Ajouter d'autres clefs IPNS, GPG ?
# MOANS=$(ipfs key gen moa_$PLAYER)
# MOAKEYFILE=$(${MY_PATH}/give_me_keystore_filename.py "moa_$PLAYER")
# echo "Coffre personnel multimedia journalisé dans votre 'Astroport' (amis de niveau 3)"
# [[ $1 != "quiet" ]] && echo "Votre clef moa_$PLAYER <=> $MOANS ($MOAKEYFILE)"; sleep 2
QOOPNS=$(ipfs key gen qo-op_$PLAYER)
QOOPKEYFILE=$(${MY_PATH}/give_me_keystore_filename.py "qo-op_$PLAYER")
# echo "Votre journal de bord pubié dans le réseau des ambassades/passerelles 'Astroport One' (zone 'publiques' niveau 0 et 1)"
# [[ $1 != "quiet" ]] && echo "Votre clef qo-op_$PLAYER <=> $QOOPNS ($QOOPKEYFILE)"; sleep 2
############################################################
[[ $1 != "quiet" ]] && echo "Compte Gchange et portefeuille G1.
Utilisez ces identifiants pour rejoindre le réseau JUNE
@ -63,33 +58,30 @@ Utilisez ces identifiants pour rejoindre le réseau JUNE
Rendez-vous sur https://gchange.fr"; sleep 3
echo; echo "Création de votre clef 'secret.dunikey' accès aux réseaux DU(G1) + LOVE + IPFS astrXbian."; sleep 2
echo; echo "Création de votre clef multi-accès..."; sleep 2
echo;
keygen -t duniter -o /tmp/secret.dunikey "$SALT" "$PEPPER"
${MY_PATH}/keygen -t duniter -o /tmp/secret.dunikey "$SALT" "$PEPPER"
G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
if [[ ! $G1PUB ]]; then
[[ $1 != "quiet" ]] && echo "Désolé. Nous n'avons pas pu générer votre clef Cesium automatiquement."
else
[[ ! $G1PUB ]] && echo "Désolé. 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/
########################################################################
#echo "CREATION ~/.zen/game/players/$PLAYER/ipfs.config"; sleep 1
########################################################################
ipfs_ID=$(python3 ~/.zen/astrXbian/zen/tools/create_ipfsnodeid_from_tmp_secret.dunikey.py)
echo $ipfs_ID > ~/.zen/game/players/$PLAYER/secret.ipfs && source ~/.zen/game/players/$PLAYER/secret.ipfs
[[ $PrivKEY == "" ]] && echo "ERROR CREATING IPFS IDENTITY" && exit 1
jq -r --arg PeerID "$PeerID" '.Identity.PeerID=$PeerID' ~/.ipfs/config > ~/.zen/tmp/config.tmp
jq -r --arg PrivKEY "$PrivKEY" '.Identity.PrivKey=$PrivKEY' ~/.zen/tmp/config.tmp > ~/.zen/tmp/config.ipfs
jq '.Peering.Peers = []' ~/.zen/tmp/config.ipfs > ~/.zen/tmp/ipfs.config ## RESET .Peering.Peers FRIENDS
rm -f ~/.zen/tmp/config.tmp ~/.zen/tmp/config.ipfs
mv ~/.zen/tmp/ipfs.config ~/.zen/game/players/$PLAYER/
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
ipfs key import $G1PUB -f pem-pkcs8-cleartext ~/.zen/game/players/$PLAYER/secret.player
ASTRONAUTENS=$(ipfs key list -l | grep -w "$PLAYER" | cut -d ' ' -f 1)
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB # Prepare astrXbian sub-datastructure
mkdir -p ~/.zen/game/players/$PLAYER/ipfs_swarm
@ -105,136 +97,97 @@ else
[[ $1 != "quiet" ]] && echo "Votre Clef publique G1 est : $G1PUB"; sleep 1
# TODO ZIP &| ENCRYPT FOR SECURITY (better control to keystore access)
mkdir -p ~/.zen/game/players/$PLAYER/keystore/
cp $HOME/.ipfs/keystore/$PLAYERKEYFILE ~/.zen/game/players/$PLAYER/keystore/
cp $HOME/.ipfs/keystore/$MOAKEYFILE ~/.zen/game/players/$PLAYER/keystore/
cp $HOME/.ipfs/keystore/$QOOPKEYFILE ~/.zen/game/players/$PLAYER/keystore/
### 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")
IPFSNODEID=$(cat ~/.zen/game/players/$PLAYER/ipfs.config | jq -r .Identity.PeerID) # ACTUAL USER
echo "Nouveau Canal TW Astronaute"
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/
# PLAYER Home ~/.zen/game/players/$PLAYER/index.html (IFRAME CONTAINING MOANS & QOOPNS)
PLAYERNS=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f 1)
cp ${MY_PATH}/../templates/playerhome.html ~/.zen/game/players/$PLAYER/index.html
sed -i "s~_PLAYER_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/index.html
sed -i "s~_PSEUDO_~${PSEUDO}~g" ~/.zen/game/players/$PLAYER/index.html
# Not used (yet) TODO make jQuery Slider
sed -i "s~_MOANS_~${MOANS}~g" ~/.zen/game/players/$PLAYER/index.html
sed -i "s~_QOOPNS_~${QOOPNS}~g" ~/.zen/game/players/$PLAYER/index.html
#echo "## PUBLISHING ${PLAYER} /ipns/$PLAYERNS"
IPUSH=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/index.html | tail -n 1)
echo $IPUSH > ~/.zen/game/players/$PLAYER/$PLAYER.chain
echo $MOATS > ~/.zen/game/players/$PLAYER/$PLAYER.ts
echo 1 > ~/.zen/game/players/$PLAYER/$PLAYER.n
ipfs name publish --key=${PLAYER} /ipfs/$IPUSH 2>/dev/null
# Moa WIKI ~/.zen/game/players/$PLAYER/moa/index.html
mkdir -p ~/.zen/game/players/$PLAYER/moa
cp ${MY_PATH}/../templates/moawiki.html ~/.zen/game/players/$PLAYER/moa/index.htm
sed -i "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/game/players/$PLAYER/moa/index.htm
sed -i "s~_PSEUDO_~${PSEUDO}~g" ~/.zen/game/players/$PLAYER/moa/index.htm
sed -i "s~_PLAYER_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/moa/index.htm
sed -i "s~_MOAID_~${MOANS}~g" ~/.zen/game/players/$PLAYER/moa/index.htm
STATION=$(ipfs key list -l | grep -w 'moa' | cut -d ' ' -f 1)
sed -i "s~_QOOP_~${STATION}~g" ~/.zen/game/players/$PLAYER/moa/index.htm
sed -i "s~_MOAKEY_~moa_${PLAYER}~g" ~/.zen/game/players/$PLAYER/moa/index.htm
sed -i "s~k2k4r8opmmyeuee0xufn6txkxlf3qva4le2jlbw6da7zynhw46egxwp2~${MOANS}~g" ~/.zen/game/players/$PLAYER/moa/index.htm
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/players/$PLAYER/moa/index.htm
sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/game/players/$PLAYER/moa/index.htm
## Add QRCode, ID Scan login page. Private p2p level 3 exploration
# cp ${MY_PATH}/../templates/instascan.html ~/.zen/game/players/$PLAYER/moa/index.html
cp ~/.zen/Astroport.ONE/templates/twdefault.html ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
sed -i "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
sed -i "s~_PLAYER_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
sed -i "s~_G1PUB_~${G1PUB}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
# base58 ssl PASS encoded sec from dunikey (contains public/private key TX tuxmain)
sed -i "s~_QRSEC_~${$PASsec}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
#echo "## PUBLISHING moa_${PLAYER} /ipns/$MOANS"
IPUSH=$(ipfs add -wHq ~/.zen/game/players/$PLAYER/moa/* | tail -n 1)
echo $IPUSH > ~/.zen/game/players/$PLAYER/moa/$PLAYER.moa.chain
echo $MOATS > ~/.zen/game/players/$PLAYER/moa/$PLAYER.moa.ts
echo 1 > ~/.zen/game/players/$PLAYER/moa/$PLAYER.moa.n
ipfs name publish --key=moa_${PLAYER} /ipfs/$IPUSH 2>/dev/null
IPNSK=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
# La Clef IPNS porte comme nom G1PUB.
sed -i "s~_MOAKEY_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
sed -i "s~k2k4r8opmmyeuee0xufn6txkxlf3qva4le2jlbw6da7zynhw46egxwp2~${IPNSK}~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
# qo-op WIKI ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html (TODO ENHANCE TW TEMPLATE WITH EXTRA PARMETERS, EXTRA TIDDLERS)
cp ${MY_PATH}/../templates/qoopwiki.html ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html
sed -i "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html
sed -i "s~_PSEUDO_~${PSEUDO}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html
sed -i "s~_PLAYER_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html
sed -i "s~_MOANS_~${MOANS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html
sed -i "s~_QOOPNS_~${QOOPNS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html
STATION=$(ipfs key list -l | grep -w 'qo-op' | cut -d ' ' -f 1)
sed -i "s~_QOOP_~${STATION}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html
sed -i "s~_MOAKEY_~qo-op_${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html
sed -i "s~k2k4r8opmmyeuee0xufn6txkxlf3qva4le2jlbw6da7zynhw46egxwp2~${QOOPNS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html
sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html
#echo "## PUBLISHING qo-op_${PLAYER} /ipns/$QOOPNS"
IPUSH=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html | tail -n 1)
echo $IPUSH > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/$PLAYER.qo-op.chain
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/$PLAYER.qo-op.ts
echo 1 > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/$PLAYER.qo-op.n
ipfs name publish --key=qo-op_${PLAYER} /ipfs/$IPUSH 2>/dev/null
#echo "## PUBLISHING ${PLAYER} /ipns/$PeerID/"
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 $MOATS > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/.moats
ipfs name publish --key=${PLAYER} /ipfs/$IPUSH 2>/dev/null
## MEMORISE PLAYER
# Lanch newly created TW
# cd ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/
# tiddlywiki $PLAYER --verbose --load ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/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
echo "$G1PUB" > ~/.zen/game/players/$PLAYER/.g1pub
echo "$IPFSNODEID" > ~/.zen/game/players/$PLAYER/.ipfsnodeid
echo "$PLAYER" > ~/.zen/game/players/$PLAYER/.player
# astrXbian compatible IPFS sub structure =>$XZUID
cp ~/.zen/game/players/$PLAYER/.player ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/_xbian.zuid
cp ~/.zen/game/players/$PLAYER/.player ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/
# PUBLIC Ŋ7 ZONE
# Record IPNS address for CHANNEL.populate
echo "$PLAYERNS" > ~/.zen/game/players/$PLAYER/.playerns
echo "$MOANS" > ~/.zen/game/players/$PLAYER/.moans
echo "$QOOPNS" > ~/.zen/game/players/$PLAYER/.qoopns
echo "$ASTRONAUTENS" > ~/.zen/game/players/$PLAYER/.playerns
echo "$SALT" > ~/.zen/game/players/$PLAYER/secret.june
echo "$PEPPER" >> ~/.zen/game/players/$PLAYER/secret.june
fi
rm -f ~/.zen/game/players/.current
ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
qrencode -s 6 -o "$HOME/.zen/game/players/$PLAYER/QR.PLAYERNS.png" "http://astroport:8080/ipns/$PLAYERNS"
qrencode -s 6 -o "$HOME/.zen/game/players/$PLAYER/QR.MOANS.png" "http://astroport:8080/ipns/$MOANS"
qrencode -s 6 -o "$HOME/.zen/game/players/$PLAYER/QR.QOOPNS.png" "http://astroport:8080/ipns/$QOOPNS"
## CREATE GCHANGE+ PROFILE
${MY_PATH}/Connect_PLAYER_To_Gchange.sh
qrencode -s 6 -o "$HOME/.zen/game/players/$PLAYER/QR.ASTRONAUTENS.png" "http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
echo; echo "Création de vos QR codes IPNS, clefs de votre réseau IPFS."; sleep 1
[[ $1 != "quiet" ]] && echo; echo "*** Espace Astronaute Activé : ~/.zen/game/players/$PLAYER/"; sleep 1
[[ $1 != "quiet" ]] && echo; echo "*** Votre Home : $PLAYER"; echo "http://127.0.0.1:8080/ipns/$PLAYERNS"; sleep 2
[[ $1 != "quiet" ]] && echo; echo "*** Votre Journal Astronaute (niveau 3) : moa_$PLAYER"; echo " http://astroport:8080/ipns/$(ipfs key list -l | grep -w moa_$PLAYER | cut -d ' ' -f 1)"; sleep 2
[[ $1 != "quiet" ]] && echo; echo "*** Votre Journal Passerelle (niveau 0/1) : qo-op_$PLAYER"; echo " http://astroport:8080/ipns/$(ipfs key list -l | grep -w qo-op_$PLAYER | cut -d ' ' -f 1)"; sleep 2
[[ $1 != "quiet" ]] && echo; echo "*** Votre Journal : $PLAYER"; echo "http://127.0.0.1:8080/ipns/$ASTRONAUTENS"; sleep 2
# PASS CRYPTING KEY
[[ $1 != "quiet" ]] && 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"
[[ $1 != "quiet" ]] && echo; echo "Sécurisation de vos clefs par chiffrage SSL... "; sleep 1
#################################################
# !! 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
## INIT FRIENDSHIP CAPTAIN/ASTRONAUTS
## INIT FRIENDSHIP CAPTAIN/ASTRONAUTS (LATER THROUGH GCHANGE)
## ${MY_PATH}/FRIENDS.init.sh
## NO. GCHANGE+ IS THE MAIN INTERFACE, astrXbian manage
[[ $1 != "quiet" ]] && echo "Bienvenue 'Astronaute' $PSEUDO ($PLAYER)"
[[ $1 != "quiet" ]] && echo "Souvenez-vous bien de votre PASS : $PASS"; sleep 2
[[ $1 != "quiet" ]] && echo "SRetenez votre PASS : $PASS"; sleep 2
echo $PSEUDO > ~/.zen/tmp/PSEUDO ## Return data to start.sh
echo "cool $(${MY_PATH}/face.sh cool)"
${MY_PATH}/VISA.print.sh
exit 0

View File

@ -48,8 +48,6 @@ while true; do
rm -f ~/.zen/game/players/.current
ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
~/.zen/Astroport.ONE/tools/PLAYER.entrance.sh ## Switch IPFS Layer with Astronaut ID & astrXbian data index structure
[[ ${arr[2]} == "" ]] && continue
fi

View File

@ -39,9 +39,6 @@ cat /dev/ttyACM0 | while read line; do
MOANS=$(cat ~/.zen/game/players/.current/.moans 2>/dev/null) || ( echo "noplayermoans" && exit 1 )
QOOPNS=$(cat ~/.zen/game/players/.current/.qoopns 2>/dev/null) || ( echo "noplayerqoopns" && exit 1 )
espeak "Opening your TW5"
~/.zen/Astroport.ONE/tools/PLAYER.entrance.sh ## Switch IPFS Layer with Astronaut ID & astrXbian data index structure
espeak "Report your best dreams and plans to the astroport captain. Love."
break