Now PLAYER can create any G1CARTE from any Station (without TW)

This commit is contained in:
fred 2023-05-10 13:56:07 +02:00
parent b5e78178eb
commit ce2c04eac6
4 changed files with 56 additions and 14 deletions

View File

@ -132,7 +132,7 @@ while true; do
for znod in $(cat ~/.zen/tmp/_swarm.${ipfsnodeid}); do
# CHECK znod validity
cznod=$(${MY_PATH}/tools/ipfs_to_g1.py ${znod} 2>/dev/null)
[[ ${cznod} == "" ]] && echo "xxxxxxxxxxxx BAD ${znod} xxxx ON xxxxxx ${ipfsnodeid} - ERROR - CONTINUE" && continue
[[ ${cznod} == "" || ${cznod} == "null" ]] && echo "xxxxxxxxxxxx BAD ${znod} xxxx ON xxxxxx ${ipfsnodeid} - ERROR - CONTINUE" && continue
if [[ -d ~/.zen/tmp/swarm/${znod} ]]; then
echo "COMPLETING MY SWARM DATA WITH ZNOD=${znod}"

View File

@ -34,18 +34,35 @@ echo 'PRESS ENTER... '; read
## CREATE AND OR CONNECT USER
PS3='Astronaute connectez votre PLAYER ___ '
players=("MAKE G1PASS" "IMPORT G1PASS" $(ls ~/.zen/game/players | grep "@" 2>/dev/null))
players=( "PRINT G1CARTE" "CREATE PLAYER" "IMPORT PLAYER" $(ls ~/.zen/game/players | grep "@" 2>/dev/null))
## MULTIPLAYER
select fav in "${players[@]}"; do
case $fav in
"MAKE G1PASS")
"PRINT G1CARTE")
## DIRECT VISA.print.sh
echo "'Email ?'"
read EMAIL
echo "'Secret 1 ?'"
read SALT
[[ ${SALT} == "" ]] && SALT=$(${MY_PATH}/tools/diceware.sh 4 | xargs)
echo "'Secret 2?'"
read PEPPER
[[ ${PEPPER} == "" ]] && PEPPER=$(${MY_PATH}/tools/diceware.sh 4 | xargs)
echo "'PIN ?'"
read PASS
[[ ${PASS} == "" ]] && PASS="@"
${MY_PATH}/tools/VISA.print.sh "${EMAIL}" "$SALT" "$PEPPER" "$PASS" ##
echo "Astronaute $fav bienvenue dans le jeu de terraformation forêt jardin MadeInZion"
exit
;;
"CREATE PLAYER")
${MY_PATH}/tools/VISA.new.sh
fav=$(cat ~/.zen/tmp/PSEUDO 2>/dev/null) && rm ~/.zen/tmp/PSEUDO
echo "Astronaute $fav bienvenue dans le jeu de terraformation forêt jardin MadeInZion"
exit
;;
"IMPORT G1PASS")
"IMPORT PLAYER")
echo "'Secret 1'"
read SALT
echo "'Secret 2'"

View File

@ -48,7 +48,7 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
[[ $XDG_SESSION_TYPE == 'x11' ]] \
&& [[ -s ~/.zen/tmp/${MOATS}/TW/index.html ]] \
&& echo "TYPE 'yes' TO RESET TW. HIT ENTER TO KEEP IT." \
&& echo "TW FOUND ENTER 'yes' TO RESET TW. HIT ENTER TO KEEP IT." \
&& read ENTER \
&& [[ $ENTER != "" ]] && rm ~/.zen/tmp/${MOATS}/TW/index.html

View File

@ -13,18 +13,41 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
PLAYER="$1"
[[ ! -f ~/.zen/game/players/${PLAYER}/QR.png ]] &&\
echo "ERREUR. Aucun PLAYER Astronaute connecté .ERREUR ~/.zen/game/players/${PLAYER}/" && exit 1
SALT="$2"
PEPPER="$3"
# Check who is .current PLAYER
PLAYER=$(cat ~/.zen/game/players/${PLAYER}/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null) || ( echo "nopseudo" && exit 1 )
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
ASTRONAUTENS=$(cat ~/.zen/game/players/${PLAYER}/.playerns 2>/dev/null) || ( echo "noastronautens" && exit 1 )
PASS="$4"
if [[ ${SALT} == "" || ${PEPPER} == "" ]]; then
[[ ! -f ~/.zen/game/players/${PLAYER}/QR.png ]] &&\
echo "ERREUR. Aucun PLAYER Astronaute connecté .ERREUR ~/.zen/game/players/${PLAYER}/" && exit 1
# Check who is .current PLAYER
PLAYER=$(cat ~/.zen/game/players/${PLAYER}/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null) || ( echo "nopseudo" && exit 1 )
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
ASTRONAUTENS=$(cat ~/.zen/game/players/${PLAYER}/.playerns 2>/dev/null) || ( echo "noastronautens" && exit 1 )
PASS=$(cat ~/.zen/game/players/${PLAYER}/.pass)
source ~/.zen/game/players/${PLAYER}/secret.june
else
echo "VIRTUAL PLAYER ${PLAYER} WELCOME - CREATING G1CARD"
VIRTUAL=1
G1PUB=$(${MY_PATH}/keygen -t duniter "${SALT}" "${PEPPER}")
ASTRONAUTENS=$(${MY_PATH}/keygen -t ipfs "${SALT}" "${PEPPER}")
PSEUDO="${PLAYER}"
mkdir -p ~/.zen/game/players/${PLAYER}/
CIMG="${MY_PATH}/../images/g1ticket.png"
amzqr ${G1PUB} -l H -p "$CIMG" -c -n QRG1avatar.png -d ~/.zen/game/players/${PLAYER}/
fi
PASS=$(cat ~/.zen/game/players/${PLAYER}/.pass)
source ~/.zen/game/players/${PLAYER}/secret.june
[[ $SALT == "" ]] && echo "BAD ACCOUNT. PLEASE BACKUP. MOVE. RESTORE." && exit 1
LP=$(ls /dev/usb/lp* | head -n 1 2>/dev/null)
@ -90,5 +113,7 @@ composite -compose Over -gravity Center -geometry +0+0 ~/.zen/tmp/one.png ${MY_P
#~ rm -Rf ~/.zen/G1BILLET/tmp/${PASS}
#~ rm ~/.zen/G1BILLET/tmp/${PASS}*
#~ rm ~/.zen/tmp/${PASS}*
[[ $VIRTUAL == 1 ]] && rm -Rf ~/.zen/game/players/${PLAYER}/
exit 0