forked from STI/Astroport.ONE
Astronauts Login procedure implement
This commit is contained in:
parent
8fd31f89c1
commit
61400a2f06
|
@ -89,6 +89,7 @@ else
|
||||||
mv /tmp/secret.dunikey ~/.zen/game/players/$PLAYER/
|
mv /tmp/secret.dunikey ~/.zen/game/players/$PLAYER/
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
qrencode -s 6 -o ~/.zen/game/players/$PLAYER/QR.png "$G1PUB"
|
qrencode -s 6 -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
|
||||||
|
@ -113,7 +114,7 @@ else
|
||||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||||
IPFSNODEID=$(cat ~/.zen/game/players/$PLAYER/ipfs.config | jq -r .Identity.PeerID) # ACTUAL USER
|
IPFSNODEID=$(cat ~/.zen/game/players/$PLAYER/ipfs.config | jq -r .Identity.PeerID) # ACTUAL USER
|
||||||
|
|
||||||
# PLAYER Home ~/.zen/game/players/$PLAYER/index.html
|
# PLAYER Home ~/.zen/game/players/$PLAYER/index.html (IFRAME CONTAINING MOANS & QOOPNS)
|
||||||
PLAYERNS=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f 1)
|
PLAYERNS=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f 1)
|
||||||
cp ${MY_PATH}/../templates/playerhome.html ~/.zen/game/players/$PLAYER/index.html
|
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~_PLAYER_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/index.html
|
||||||
|
|
|
@ -7,6 +7,9 @@ ME="${0##*/}"
|
||||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||||
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
|
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
|
||||||
|
|
||||||
|
instascan=$(ps auxf --sort=+utime | grep -w nc | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
||||||
|
[[ $instascan ]] && echo "already running" && exit 1
|
||||||
|
|
||||||
# Check who is .current PLAYER
|
# Check who is .current PLAYER
|
||||||
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
|
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 )
|
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null) || ( echo "nopseudo" && exit 1 )
|
||||||
|
@ -38,12 +41,27 @@ while true; do
|
||||||
g1pubpath=$(grep $QRCODE ~/.zen/game/players/*/.g1pub | cut -d ':' -f 1 2>/dev/null)
|
g1pubpath=$(grep $QRCODE ~/.zen/game/players/*/.g1pub | cut -d ':' -f 1 2>/dev/null)
|
||||||
PLAYER=$(echo "$g1pubpath" | rev | cut -d '/' -f 2 | rev 2>/dev/null)
|
PLAYER=$(echo "$g1pubpath" | rev | cut -d '/' -f 2 | rev 2>/dev/null)
|
||||||
|
|
||||||
|
[[ ! -d ~/.zen/game/players/$PLAYER || $PLAYER == "" ]] && exit 1
|
||||||
|
## LOGIN
|
||||||
|
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
|
||||||
|
|
||||||
# Get IPFS ID
|
# Get IPFS ID
|
||||||
ASTROID=$(~/.zen/Astroport.ONE/tools/g1_to_ipfs.py $QRCODE)
|
ASTROID=$(~/.zen/Astroport.ONE/tools/g1_to_ipfs.py $QRCODE)
|
||||||
echo "ASTROID = $ASTROID"
|
echo "ASTROID = $ASTROID"
|
||||||
# Rechercher dans mon essaim Gchange
|
echo "Get ASTROID astrXbian Drive into $USER ipfs_swarm (/ipns/$ASTROID)"
|
||||||
|
ipfs --timeout=21s get --output=/home/$USER/.zen/ipfs_swarm/ /ipns/$ASTROID
|
||||||
|
if [ $? == 0 ]; then
|
||||||
|
echo "Cache OK"
|
||||||
|
else
|
||||||
|
echo "TODO Create PLAYER ipfs astrXbian qo-op_PLAYER !!"
|
||||||
|
fi
|
||||||
|
|
||||||
## Open "qo-op_PLAYER" TW
|
|
||||||
|
|
||||||
|
## LOCAL PLAYER => Open "qo-op_PLAYER" TW
|
||||||
if [[ $PLAYER ]]; then
|
if [[ $PLAYER ]]; then
|
||||||
echo "$PLAYER"
|
echo "$PLAYER"
|
||||||
qoop=$(ipfs key list -l | grep -w qo-op_$PLAYER | cut -d ' ' -f 1)
|
qoop=$(ipfs key list -l | grep -w qo-op_$PLAYER | cut -d ' ' -f 1)
|
||||||
|
@ -53,6 +71,7 @@ while true; do
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "Astronaute INCONNU ? $QRCODE" # && continue
|
echo "Astronaute INCONNU ? $QRCODE" # && continue
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ ${arr[2]} == "" ]] && continue
|
[[ ${arr[2]} == "" ]] && continue
|
||||||
|
@ -78,7 +97,8 @@ while true; do
|
||||||
|
|
||||||
## ENVOYER MESSAGE GCHANGE POUR QRCODE
|
## ENVOYER MESSAGE GCHANGE POUR QRCODE
|
||||||
|
|
||||||
|
## Une seule boucle !!!
|
||||||
|
[[ "$1" == "ONE" ]] && exit 0
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue