Now Astronauts owns Tiddlywiki's shared on confidence channels 0/1 + 3 + 5

This commit is contained in:
fred 2022-05-02 23:10:48 +02:00
parent 33f22f4976
commit 37cf950e49
8 changed files with 10063 additions and 66 deletions

View File

@ -17,7 +17,8 @@ echo '
/_/ \_\____/ |_| |_| \_\\___/|_| \___/|_| \_\|_| \___/|_| \_|_____|
ASTROPORT jeu de terraformation planétaire sur IPFS.<
ASTROPORT Ambassade numérique pair à pair sur IPFS.
VISA : MadeInZion
@@@@@@@@@
ACTUAL PLAYERS
@ -27,20 +28,16 @@ ACTUAL PLAYERS
## 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
## CHECK CONNECTED USER
if [[ -e ~/.zen/game/players/.current/.pseudo ]]; then
PLAYER=$(cat ~/.zen/game/players/.current/.player)
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo)
echo "BIENVENUE $PSEUDO - $PLAYER"
else
PS3='Choisissez ou créez votre identité : '
players=($(ls ~/.zen/game/players) "NOUVEAU VISA")
## CONNECT USER
PS3='Choisissez votre combinaison Astronaute ou ajoutez la votre. Identité ? '
players=("NOUVEAU VISA" $(ls ~/.zen/game/players))
select fav in "${players[@]}"; do
case $fav in
"NOUVEAU VISA")
${MY_PATH}/tools/VISA.new.sh
fav=$(cat ~/.zen/tmp/PSEUDO)
break
echo "Astronaute $fav bienvenue dans le jeu de terraformation forêt jardin MadeInZion"
exit
;;
"")
echo "Choix obligatoire. exit"
@ -52,13 +49,13 @@ else
esac
done
PLAYER=$fav
fi
PLAYER=$fav
echo "SVP entrez votre PASS $fav"
rm -f ~/.zen/game/players/.current
ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
cat ~/.zen/game/players/.current/.pass # DEVEL
cat ~/.zen/game/players/.current/.pass 2>/dev/null # DEVEL
echo "Saisissez votre PASS "
read PASS
## DECODE CURRENT PLAYER CRYPTO
@ -66,7 +63,7 @@ openssl enc -aes-256-cbc -d -in "$HOME/.zen/game/players/.current/enc.secret.dun
[ $? != 0 ] && echo "ERROR. MAUVAIS PASS. EXIT" && rm $HOME/.zen/tmp/${PLAYER}.dunikey && exit 1
PS3="$PLAYER choisissez une action à mener : "
choices=("AJOUTER VIDEOBLOG" "IMPRIMER VISA" "EXPORTER VISA" "SUPPRIMER VISA" "QUITTER")
choices=("WEBCAM" "JOURNAUX" "IMPRIMER VISA" "EXPORTER VISA" "SUPPRIMER VISA" "QUITTER")
select fav in "${choices[@]}"; do
case $fav in
"IMPRIMER VISA")
@ -86,10 +83,14 @@ select fav in "${choices[@]}"; do
rm -Rf ~/.zen/game/players/$PLAYER
break
;;
"AJOUTER VIDEOBLOG")
"WEBCAM")
echo "VIDEOBLOG"
${MY_PATH}/tools/vlc_webcam.sh
;;
"JOURNAUX")
${MY_PATH}/tools/PLAYER.entrance.sh
break
;;
"QUITTER")
echo "CIAO" && exit 0
;;

3244
templates/moawiki.html Normal file

File diff suppressed because one or more lines are too long

3262
templates/playerwiki.html Normal file

File diff suppressed because one or more lines are too long

3244
templates/qoopwiki.html Normal file

File diff suppressed because one or more lines are too long

72
tools/JOURNAL.visit.sh Executable file
View File

@ -0,0 +1,72 @@
#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
################################################################################
# INTERFACE DE GESTION DE JOURNAUX DES PLAYERS
# Le Journal du CAPTAIN est désormais le journal de bord de cet Astroport
# Sa tâche sera de faire le tour des nouveaux rêves pour les ajouter à son journal désormais publié comme balise de la station astrXbian
# Alerter de manque de placement sur certains ou sur les primes de maintenance.
# ~/.zen/game/players/$PLAYER/ipfs/
# ~/.zen/ipfs/.$IPFSNODEID
################################################################################
################################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
# Check who is currently current connected PLAYER
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null)
source ~/.zen/ipfs.sync
if [[ $IPFS_SYNC_DIR == "$PLAYER" ]]; then
echo "Bienvenue capitaine $PLAYER !"; sleep 2
echo "$PSEUDO ouverture du journal de votre Astroport (rassemblez les Good News des journaux Moa) ?"
# Récupération de la clef du capitaine PLAYER ( identique à celle du démon IPFS )
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
[ $? == 0 ] && xdg-open "http://127.0.0.1:8080/ipns/$IPFSNODEID"
# Ouverture des Moa de tous les PLAYER
for play in $(ls ~/.zen/game/players); do
moaplayer=$(ipfs key list -l | grep -w moa_$play | cut -d ' ' -f 1)
g1pub=$(cat ~/.zen/game/players/$play/_g1.pubkey)
# Check if different from last record (check .chain)
nowchain=$(ipfs cat /ipns/$moaplayer/chain 2>/dev/null)
moachain=$(cat ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/chain.moa 2>/dev/null)
[[ $nowchain != $moachain ]] && xdg-open "http://127.0.0.1:8080/ipns/$moaplayer"
# TODO Save actual moachain from a command received through Instscan/nc trick for exemple, or recurrent astrXbian actions...
# ipfs cat /ipns/$moaplayer/chain > ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/chain.moa
done
zenity --question --width 300 --text "$PLAYER souhaitez-vous ouvrir votre journal 'secret' (niveau 5) ?"
# Récupération de la clef du capitaine PLAYER ( identique à celle du démon IPFS )
player=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f 1)
[ $? == 0 ] && xdg-open "http://127.0.0.1:8080/ipns/$player"
fi
# NOT CAPTAIN
zenity --question --width 300 --text "$PSEUDO souhaitez-vous ouvrir votre journal 'Moa' (niveau 3) ?"
# Récupération de la clef du capitaine PLAYER ( identique à celle du démon IPFS )
moa=$(ipfs key list -l | grep -w moa_$PLAYER | cut -d ' ' -f 1)
[ $? == 0 ] && xdg-open "http://127.0.0.1:8080/ipns/$moa"
zenity --question --width 300 --text "$PSEUDO souhaitez-vous ouvrir votre journal 'qo-op' (niveau 0) ?"
# Récupération de la clef du capitaine PLAYER ( identique à celle du démon IPFS )
qo-op=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f 1)
[ $? == 0 ] && xdg-open "http://127.0.0.1:8080/ipns/$qo-op"
# TODO: fabriquer une interface où passer d'un journal à l'autre, y glisser déposer, etc ...
# Le journal transmit par la balise IPFS est celui de la clef PLAYER du CAPTAIN.
# Ce journal ne se remplit pour un joueur que lorsqu'il devient CAPTAIN (y compris pour le canal secret).
#
# Le journal Moa = NFT où nous repertorions nos exploits et talents
# Le journal qo-op fait partie de la diffusion incensurable des bunkerbox (evolutions Youtube/Facebook/etc... ici on se branche au vieux web)
exit 0

84
tools/PLAYER.entrance.sh Executable file
View File

@ -0,0 +1,84 @@
#!/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'identité IPFS de la Station parmis celle des PLAYER
# La première clef n'a aucun chalenge pour le faire.
# Les suivantes peuvent être soumises au niveau de confiance (LOVE) des meilleurs Astronautes.
#
# ~/.zen/game/players/$PLAYER/ipfs/
# ~/.zen/ipfs/.$IPFSNODEID
################################################################################
################################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
# Check who is currently current connected PLAYER
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null)
# Check if Astroport Station already has a "captain"
source ~/.zen/ipfs.sync
### AN ASTROPORT NEEDS A CAPTAIN
##############################
if [[ $IPFS_SYNC_DIR == "" || $IPFS_SYNC_DIR == "$HOME/astroport" ]]; then
echo "Aucun pilote dans le cockpit."; sleep 1
echo "$PLAYER séquence déplacement clef balise station..."; sleep 1
# astrXbian tranformation only once!
[[ -f ~/.ipfs/config.astrXbian ]] && echo "FATAL ERROR"; echo "File corruption detected. EXIT"; exit 1
# 1st Captain. Changing IPFS station key.
sudo service ipfs stop
# Replace ~/.ipfs
mv ~/.ipfs/config ~/.ipfs/config.astrXbian
cp ~/.zen/game/players/$PLAYER/ipfs.config ~/.ipfs/config
## TODO CONTROL keystore to enhance security level
## ajouter_video KEYS will be moved when captain is changing?
# Moving captain data into Balise Station
mv ~/.zen/game/players/$PLAYER/ipfs/.* ~/.zen/ipfs/
## Start IPFS DAEMON
sudo service ipfs start
echo "Nouvelle Identité balise IPFS"; sleep 1
ipfs id
echo "##################################################### OK"
echo "IPFS_SYNC_DIR=$PLAYER" > ~/.zen/ipfs.sync ## PLAYER IS ASTROPORT CAPTAIN NOW
else
if [[ $IPFS_SYNC_DIR == "$PLAYER" ]]; then
## THE CAPTAIN IS LOGGED IN
echo "Bienvenue capitaine !"; sleep 2
echo "Ouverture des journaux...";
else
# A PLAYER IS LOGGED IN
echo "Joueur $PLAYER, $IPFS_SYNC_DIR est votre capitaine"; sleep 1
echo "$PSEUDO, inscrivez dans votre 'Moa Journal' vos rêves et remarques à adresser au monde ou capitaine de cet Astroport"; sleep 1
fi
fi
${MY_PATH}/tools/JOURNAL.visit.sh # OPEN TIDDLYWIKIS
[[ $1 != "quiet" ]] && echo "=============================================
Appuyez sur ENTRER pour vous déconnecter.
Saisissez 'S' avant pour copier vos données sur clef USB ?
=======================================================
"
read EJECT
[[ $EJECT == "" ]] && echo "Merci. Au revoir"; rm -f ~/.zen/game/players/.current && exit 0
echo "## TODO BACKUP SUR CLEF USB"
# ${MY_PATH}/tools/SAVE.astronaut.sh # tar.gzip PLAYER DATA TO USB KEY TODO
exit 0

View File

@ -11,71 +11,68 @@ MadeInZion DIPLOMATIC PASSPORT
=============================================
A cryptographic key pair to control your P2P Digital Life.
Solar Punk garden forest terraforming game.
=============================================
Bienvenue 'Astronaute'"; sleep 1
Création de votre PSEUDO, votre PLAYER, votre PASS (6 chiffres)
Création de votre SALT PEPPER : compte Gchange et son portefeuille G1.
Création de votre clef DUNITER : la clef d'accès Cesium
Création de vos clef IPNS : vos balises de publication dans le réseau IPFS.
PLAYER, MOA & STARGATES
Vos identifiants 'Astronaute' sont:
"
echo ""
################################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
SALT=$(${MY_PATH}/diceware.sh 4 | xargs)
[[ $1 != "quiet" ]] && echo "-> SALT : $SALT"
# [[ $1 != "quiet" ]] && echo "-> SALT : $SALT"
PEPPER=$(${MY_PATH}/diceware.sh 4 | xargs)
[[ $1 != "quiet" ]] && echo "-> PEPPER : $PEPPER"
# [[ $1 != "quiet" ]] && echo "-> PEPPER : $PEPPER"
[[ $1 != "quiet" ]] && echo "CHOISISSEZ UN PSEUDO" && read PSEUDO; PSEUDO=${PSEUDO,,} && [[ -d ~/.zen/game/players/$PSEUDO ]] && echo "CE PSEUDO EST DEJA UN PLAYER. EXIT" && exit 1
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}
[[ ! $PSEUDO ]] && PSEUDO=$PLAYER
[[ $1 != "quiet" ]] && echo "$PSEUDO voici votre identifiant Astronaute: $PLAYER"; sleep 1
[[ $1 != "quiet" ]] && echo; echo "Génération de vos identités Astronaute (PLAYER):"; sleep 1; echo "$PLAYER"; sleep 2
PASS=$(echo "${RANDOM}${RANDOM}${RANDOM}${RANDOM}" | tail -c-7)
[[ $1 != "quiet" ]] && echo "et votre PASS : $PASS"; sleep 2
############################################################
######### CLEFS IPNS PLAYER + moa_ + qo-op_
PLAYERNS=$(ipfs key gen $PLAYER)
PLAYERKEYFILE=$(${MY_PATH}/give_me_keystore_filename.py "$PLAYER")
[[ $1 != "quiet" ]] && echo "Votre clef $PLAYER <=> $PLAYERNS ($PLAYERKEYFILE)"; sleep 2
# 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")
echo "Votre coffre personnel constitués des média que vous aurez embarqué dans votre 'Astroport' (amis de niveau 3)"
[[ $1 != "quiet" ]] && echo "Votre clef moa_$PLAYER <=> $MOANS ($MOAKEYFILE)"; sleep 2
# 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 'Astroport One' (zone 'publique' niveau 0 du réseau Astroport)"
[[ $1 != "quiet" ]] && echo "Votre clef qo-op_$PLAYER <=> $QOOPNS ($QOOPKEYFILE)"; sleep 2
# 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
## CREATE Player personnal files storage and IPFS publish directory
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/
echo "$PSEUDO" > ~/.zen/game/players/$PLAYER/.pseudo
echo "$PLAYER" > ~/.zen/game/players/$PLAYER/.player
echo "$SALT" > ~/.zen/game/players/$PLAYER/secret.june
echo "$PEPPER" >> ~/.zen/game/players/$PLAYER/secret.june
[[ $1 != "quiet" ]] && echo "Rendez-vous sur https://gchange.fr
[[ $1 != "quiet" ]] && echo "Compte Gchange et portefeuille G1.
Utilisez ces identifiants pour rejoindre le réseau JUNE
$SALT
$PEPPER
"; sleep 3
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;
G1PUB=$(python3 ${MY_PATH}/key_create_dunikey.py "$SALT" "$PEPPER")
if [[ ! $G1PUB ]]; then
[[ $1 != "quiet" ]] && echo "Désolé. Nous n'avons pas pu générer votre clef Cesium automatiquement."
else
## CREATE Player personnal files storage and IPFS publish directory
mkdir -p ~/.zen/game/players/$PLAYER # Prepare PLAYER datastructure
########################################################################
echo "CREATING ~/.zen/game/players/$PLAYER/ipfs.config"
#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
@ -86,10 +83,13 @@ else
rm -f ~/.zen/tmp/config.tmp ~/.zen/tmp/config.ipfs
mv ~/.zen/tmp/ipfs.config ~/.zen/game/players/$PLAYER/
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.$PeerID # Prepare astrXbian datastructure
mv /tmp/secret.dunikey ~/.zen/game/players/$PLAYER/
qrencode -s 6 -o $HOME/.zen/game/players/$PLAYER/QR.png "$G1PUB"
# plus on est proche de root, plus les données sont privés à cause des partages recursif ipfs
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB # Prepare astrXbian sub-datastructure
qrencode -s 6 -o ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/QR.png "$G1PUB"
echo "$G1PUB" > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/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
@ -98,16 +98,82 @@ else
qrencode -s 6 -o $HOME/.zen/game/players/$PLAYER/QRsec.png $PASsec
[[ $1 != "quiet" ]] && echo "Votre Clef publique G1 est : $G1PUB"; sleep 1
[[ $1 != "quiet" ]] && echo "SEC $secFromDunikey"; 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 ~/.ipfs/config | jq -r .Identity.PeerID) # We should have a Captain already...
# PLAYER WIKI
cp ${MY_PATH}/../templates/playerwiki.html ~/.zen/game/players/$PLAYER/
sed -i "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/game/players/$PLAYER/playerwiki.html
sed -i "s~_PSEUDO_~${PSEUDO}~g" ~/.zen/game/players/$PLAYER/playerwiki.html
sed -i "s~_MOAID_~${PLAYERNS}~g" ~/.zen/game/players/$PLAYER/playerwiki.html
sed -i "s~_QOOP_~${QOOPNS}~g" ~/.zen/game/players/$PLAYER/playerwiki.html
sed -i "s~_MOAKEY_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/playerwiki.html
sed -i "s~k2k4r8opmmyeuee0xufn6txkxlf3qva4le2jlbw6da7zynhw46egxwp2~${PLAYERNS}~g" ~/.zen/game/players/$PLAYER/playerwiki.html
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/players/$PLAYER/playerwiki.html
sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/game/players/$PLAYER/playerwiki.html
#echo "## PUBLISHING ${PLAYER} /ipns/$PLAYERNS"
IPUSH=$(ipfs add -wHq ~/.zen/game/players/$PLAYER/playerwiki.html | tail -n 1)
ipfs name publish --key=${PLAYER} /ipfs/$IPUSH 2>/dev/null
# Moa WIKI
cp ${MY_PATH}/../templates/moawiki.html ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moawiki.html
sed -i "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moawiki.html
sed -i "s~_PSEUDO_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moawiki.html
sed -i "s~_MOAID_~${MOANS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moawiki.html
sed -i "s~_QOOP_~${QOOPNS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moawiki.html
sed -i "s~_MOAKEY_~moa_${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moawiki.html
sed -i "s~k2k4r8opmmyeuee0xufn6txkxlf3qva4le2jlbw6da7zynhw46egxwp2~${MOANS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moawiki.html
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moawiki.html
sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moawiki.html
#echo "## PUBLISHING moa_${PLAYER} /ipns/$MOANS"
IPUSH=$(ipfs add -wHq ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moawiki.html | tail -n 1)
ipfs name publish --key=moa_${PLAYER} /ipfs/$IPUSH 2>/dev/null
# qo-op WIKI
cp ${MY_PATH}/../templates/qoopwiki.html ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB/qoopwiki.html
sed -i "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB/qoopwiki.html
sed -i "s~_PSEUDO_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB/qoopwiki.html
sed -i "s~_MOAID_~${QOOPNS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB/qoopwiki.html
sed -i "s~_QOOP_~${QOOPNS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB/qoopwiki.html
sed -i "s~_MOAKEY_~qo-op_${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB/qoopwiki.html
sed -i "s~k2k4r8opmmyeuee0xufn6txkxlf3qva4le2jlbw6da7zynhw46egxwp2~${QOOPNS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB/qoopwiki.html
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB/qoopwiki.html
sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB/qoopwiki.html
#echo "## PUBLISHING qo-op_${PLAYER} /ipns/$QOOPNS"
IPUSH=$(ipfs add -wHq ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB/qoopwiki.html | tail -n 1)
ipfs name publish --key=qo-op_${PLAYER} /ipfs/$IPUSH 2>/dev/null
echo "$PSEUDO" > ~/.zen/game/players/$PLAYER/.pseudo
echo "$PLAYER" > ~/.zen/game/players/$PLAYER/.player
echo "$SALT" > ~/.zen/game/players/$PLAYER/secret.june
echo "$PEPPER" >> ~/.zen/game/players/$PLAYER/secret.june
fi
[[ $1 != "quiet" ]] && echo "Rendez-vous sur https://cesium.app et utilisez les mêmes identifiants pour accéder à votre portefeuille JUNE"; sleep 2
qrencode -s 6 -o "$HOME/.zen/game/players/$PLAYER/QR.PLAYERNS.png" "$PLAYERNS"
qrencode -s 6 -o "$HOME/.zen/game/players/$PLAYER/QR.MOANS.png" "$MOANS"
qrencode -s 6 -o "$HOME/.zen/game/players/$PLAYER/QR.QOOPNS.png" "$QOOPNS"
echo; echo "Création de vos QR codes IPNS, clefs de votre réseau IPFS."; sleep 1
cp $HOME/.ipfs/keystore/$KEYFILE ~/.zen/game/players/$PLAYER/
qrencode -s 6 -o "$HOME/.zen/game/players/$PLAYER/QR.IPNSFL.PLAYER.png" "http://localhost:8080/ipns/$IPNS"
[[ $1 != "quiet" ]] && echo; echo; echo "*** Espace privé activé : ~/.zen/game/players/$PLAYER/"; sleep 1
[[ $1 != "quiet" ]] && echo; echo "*** Votre journal de bord : http://localhost:8080/ipns/$IPNS"; sleep 1
[[ $1 != "quiet" ]] && echo; echo "*** Espace Astronaute Activé : ~/.zen/game/players/$PLAYER/"; sleep 1
[[ $1 != "quiet" ]] && echo; echo "*** Votre Journal Personnel (niveau 5) : $PLAYER"; echo "http://127.0.0.1:8080/ipns/$PLAYERNS/playerwiki.html"; sleep 2
[[ $1 != "quiet" ]] && echo; echo "*** Votre Journal Astronaute (niveau 3) : moa_$PLAYER"; echo " http://127.0.0.1:8080/ipns/$MOANS/moawiki.html"; sleep 2
[[ $1 != "quiet" ]] && echo; echo "*** Votre Journal Passerelle (niveau 0/1) : qo-op_$PLAYER"; echo " http://127.0.0.1:8080/ipns/$QOOPNS/qoopwiki.html"; sleep 2
# PASS CRYPTING KEY
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
@ -116,7 +182,7 @@ openssl enc -aes-256-cbc -salt -in "$HOME/.zen/game/players/$PLAYER/$KEYFILE -ou
## 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 "Sécurisation de vos clefs par chiffrage SSL... $PASS"; sleep 1
[[ $1 != "quiet" ]] && echo; echo "Sécurisation de vos clefs par chiffrage SSL... $PASS"; sleep 1
#################################################
# !!!! # DEV MODE. REMOVE FOR PRODUCTION STATION FORGET PASS
@ -127,17 +193,14 @@ echo "$PASS" > ~/.zen/game/players/$PLAYER/.pass
rm -f ~/.zen/game/players/.current
ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
## CLEANING CLEAR FILES
rm -f ~/.zen/game/players/$PLAYER/$KEYFILE
rm -f ~/.zen/game/players/$PLAYER/secret.dunikey
[[ $1 != "quiet" ]] && echo "_____ REINIT COMMAND____"
[[ $1 != "quiet" ]] && echo "for p in \$(ls ~/.zen/game/players/); do rm -Rf ~/.zen/game/players/\$p"
[[ $1 != "quiet" ]] && echo "for k in \$(ipfs key list | grep \$p); do ipfs key rm \$k; done; done"
[[ $1 != "quiet" ]] && echo "_____ALL PLAYERS REMOVAL____"
[[ $1 != "quiet" ]] && echo "_____DEBUG PLAYER REMOVE COMMANDS____"
[[ $1 != "quiet" ]] && echo "rm -Rf ~/.zen/game/players/$PLAYER"
[[ $1 != "quiet" ]] && echo "ipfs key rm $PLAYER > /dev/null"
[[ $1 != "quiet" ]] && echo "_____DEBUG PLAYER REMOVE COMMANDS____"
[[ $1 != "quiet" ]] && echo "Bienvenue à toi Astronaute $PSEUDO ($PLAYER)"
echo $PSEUDO > ~/.zen/tmp/PSEUDO
[[ $1 != "quiet" ]] && echo "Bienvenue 'Astronaute' $PSEUDO ($PLAYER)"
[[ $1 != "quiet" ]] && echo "Votre PASS : $PASS"; sleep 2
echo $PSEUDO > ~/.zen/tmp/PSEUDO ## Return data to start.sh
echo "cool $(${MY_PATH}/face.sh cool)"
exit 0

27
tools/face.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
# Inpored from https://pwnagotchi.ai/
[[ $1 == 'sleep' ]] && face='(⇀‿‿↼)'
[[ $1 == 'awake' ]] && face='(≖‿‿≖)'
[[ $1 == 'normal' ]] && face='(◕‿‿◕)'
[[ $1 == 'surprise' ]] && face='(☉_☉ )'
[[ $1 == 'observe' ]] && face='(◕‿◕ )'
[[ $1 == 'intense' ]] && face='(°▃▃°)'
[[ $1 == 'cool' ]] && face='(⌐■_■)'
[[ $1 == 'happy' ]] && face='(•‿‿•)'
[[ $1 == 'grateful' ]] && face='(^‿‿^)'
[[ $1 == 'excited' ]] && face='(ᵔ◡◡ᵔ)'
[[ $1 == 'smart' ]] && face='(✜‿‿✜)'
[[ $1 == 'friendly' ]] && face='(♥‿‿♥)'
[[ $1 == 'motivated' ]] && face='(☼‿‿☼)'
[[ $1 == 'demotivated' ]] && face='(≖__≖)'
[[ $1 == 'bored' ]] && face='(-__-)'
[[ $1 == 'sad' ]] && face='(╥☁╥ )'
[[ $1 == 'lonely' ]] && face='(ب__ب)'
[[ $1 == 'broken' ]] && face='(☓‿‿☓)'
[[ $1 == 'bug' ]] && face='(#__#)'
[[ $face == '' ]] && face='(☉_☉ )'
echo $face
exit 0