forked from STI/Astroport.ONE
more friends are coming soon. make some room.
This commit is contained in:
parent
c22bfe5855
commit
84033b7ab7
1
start.sh
1
start.sh
|
@ -68,6 +68,7 @@ openssl enc -aes-256-cbc -d -in "$HOME/.zen/game/players/.current/enc.secret.dun
|
||||||
[ ! -f $HOME/.zen/tmp/${PLAYER}.dunikey ] && echo "ERROR. MAUVAIS PASS. EXIT" && exit 1
|
[ ! -f $HOME/.zen/tmp/${PLAYER}.dunikey ] && echo "ERROR. MAUVAIS PASS. EXIT" && exit 1
|
||||||
|
|
||||||
echo "____________________";
|
echo "____________________";
|
||||||
|
${MY_PATH}/tools/PLAYER.entrance.sh ## Switch IPFS Layer with Astronaut ID & astrXbian data index structure
|
||||||
echo
|
echo
|
||||||
PS3="$PLAYER choisissez une action à mener : "
|
PS3="$PLAYER choisissez une action à mener : "
|
||||||
choices=("WEBCAM" "JOURNAUX" "IMPRIMER VISA" "EXPORTER VISA" "SUPPRIMER VISA" "QUITTER")
|
choices=("WEBCAM" "JOURNAUX" "IMPRIMER VISA" "EXPORTER VISA" "SUPPRIMER VISA" "QUITTER")
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -16,9 +16,8 @@ G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PU
|
||||||
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) || ( echo "noipfsid" && exit 1 )
|
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) || ( echo "noipfsid" && exit 1 )
|
||||||
########################################################################
|
########################################################################
|
||||||
########################################################################
|
########################################################################
|
||||||
# This script used to initialize 'FRIENDS' data and star.level
|
# This script used to initialize 'FRIENDS' data and star.level with beetween crew and new Astronaut
|
||||||
# Astronaut is sendind level3 to Captain
|
# Astronaut is sendind level3 to Captain / # Captain send level1 to Astronaut
|
||||||
# Captain send level1 to Astronaut
|
|
||||||
# astrXbian keychains are written to disk... So IPFS obey to this organisation.
|
# astrXbian keychains are written to disk... So IPFS obey to this organisation.
|
||||||
########################################################################
|
########################################################################
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -31,7 +30,7 @@ G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null) || ( echo "nog1pub"
|
||||||
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
|
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
|
||||||
|
|
||||||
# Astroport Station "Captain" connected?
|
# Astroport Station "Captain" connected?
|
||||||
source ~/.zen/ipfs.sync; echo "CAPTAIN is $CAPTAIN"
|
source ~/.zen/ipfs.sync; echo "CAPTAIN is $CAPTAIN $(${MY_PATH}/face.sh cool)"
|
||||||
|
|
||||||
|
|
||||||
# New Astronaut is entering Astroport
|
# New Astronaut is entering Astroport
|
||||||
|
@ -42,23 +41,27 @@ for player in $(ls ~/.zen/game/players/); do
|
||||||
g1pub=$(cat ~/.zen/game/players/$player/.g1pub) || continue
|
g1pub=$(cat ~/.zen/game/players/$player/.g1pub) || continue
|
||||||
ipfsnodeid=$(cat ~/.zen/game/players/$player/.ipfsnodeid) || continue
|
ipfsnodeid=$(cat ~/.zen/game/players/$player/.ipfsnodeid) || continue
|
||||||
|
|
||||||
|
[[ $PLAYER == $player ]] && continue
|
||||||
## Adding ME as Astronauts Friend. Sharing Stars.
|
## Adding ME as Astronauts Friend. Sharing Stars.
|
||||||
# Inform Network / Application levels
|
# Inform Network / Application levels. Friend of Friends appears here.
|
||||||
|
|
||||||
echo "Adding to $PLAYER ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub"
|
echo "Adding $player to my astrXbian ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub"
|
||||||
read
|
read
|
||||||
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub # Opening FRIEND RELATION
|
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub # Opening FRIEND RELATION
|
||||||
|
echo "$player" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/player # This Astronaut become my level 1 friend
|
||||||
echo "1" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/stars.level # This Astronaut become my level 1 friend
|
echo "1" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/stars.level # This Astronaut become my level 1 friend
|
||||||
echo "$ipfsnodeid" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/ipfsnodeid # This Astronaut become my level 1 friend
|
echo "$ipfsnodeid" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/ipfsnodeid # This Astronaut become my level 1 friend
|
||||||
|
|
||||||
if [[ $player == "$CAPTAIN" ]]; then
|
if [[ $player == "$CAPTAIN" ]]; then
|
||||||
echo "Cet Astronaute est le CAPITAINE. Confiance 3 !!!"
|
echo "Cet Astronaute est le CAPITAINE. Confiance 3 !!!"
|
||||||
echo "3" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/stars.level # Ugrade to Level 3 Friend
|
echo "3" > ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/FRIENDS/$g1pub/stars.level # Ugrade to Level 3 Friend
|
||||||
|
# Need to receive confidence back before acting as Astronaut. 3 days to compare dreams & reality.
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Adding to $player ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB"
|
echo "Adding myself to $player ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB"
|
||||||
read
|
read
|
||||||
mkdir -p ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB # AUTO SYMETRIC RELATION TODO : Not overpassing anymore ?
|
mkdir -p ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB # AUTO SYMETRIC RELATION TODO : Not overpassing anymore ?
|
||||||
|
echo "$PLAYER" > ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB/player # This Astronaut become my level 1 friend
|
||||||
echo "1" > ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB/stars.level
|
echo "1" > ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB/stars.level
|
||||||
echo "$IPFSNODEID" > ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB/ipfsnodeid # TODO : Not overpassing anymore ?
|
echo "$IPFSNODEID" > ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$G1PUB/ipfsnodeid # TODO : Not overpassing anymore ?
|
||||||
echo "Compromis de Confiance 1 ajouté à $player"
|
echo "Compromis de Confiance 1 ajouté à $player"
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
#!/bin/bash
|
||||||
|
########################################################################
|
||||||
|
# Author: Fred (support@qo-op.com)
|
||||||
|
# Version: 2020.03.24
|
||||||
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
|
########################################################################
|
||||||
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
|
ME="${0##*/}"
|
||||||
|
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
|
||||||
|
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
|
||||||
|
start=`date +%s`
|
||||||
|
|
||||||
|
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
|
||||||
|
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1
|
||||||
|
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) || ( echo "noipfsid" && exit 1 )
|
||||||
|
########################################################################
|
||||||
|
########################################################################
|
||||||
|
# This script could be used to manage .current Astronaut Friendships
|
||||||
|
# But thinking about it. Is is better to keep Gchange as confidence level collector.
|
||||||
|
########################################################################
|
||||||
|
echo "# Script needs enhancement or better a dedicated 'AApp' acting on IPFS directly."
|
||||||
|
########################################################################
|
||||||
|
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||||
|
|
||||||
|
# Check who is currently current connected 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 )
|
||||||
|
|
||||||
|
# Astroport Station "Captain" connected?
|
||||||
|
source ~/.zen/ipfs.sync; echo "CAPTAIN is $CAPTAIN $(${MY_PATH}/face.sh cool)"
|
||||||
|
echo
|
||||||
|
echo "$PLAYER bon parcours amical (N+2)"
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
for player in $(ls ~/.zen/game/players/); do
|
||||||
|
# $player g1pub
|
||||||
|
g1pub=$(cat ~/.zen/game/players/$player/.g1pub) || continue
|
||||||
|
ipfsnodeid=$(cat ~/.zen/game/players/$player/.ipfsnodeid) || continue
|
||||||
|
|
||||||
|
echo "Listing FRIENDS from $player"
|
||||||
|
ls ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/
|
||||||
|
echo
|
||||||
|
sleep 1
|
||||||
|
for g1 in $(ls ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/); do
|
||||||
|
echo "$g1 est le player..."
|
||||||
|
cat ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$g1/player 2>/dev/null || echo "???"
|
||||||
|
done
|
||||||
|
|
||||||
|
done
|
||||||
|
|
|
@ -19,22 +19,15 @@ 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)
|
||||||
|
|
||||||
# Check who is currently current connected PLAYER
|
# Check who is .current PLAYER
|
||||||
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
|
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
|
||||||
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null)
|
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"
|
# Check if Astroport Station already has a "captain"
|
||||||
source ~/.zen/ipfs.sync; echo "CAPTAIN is $CAPTAIN"
|
source ~/.zen/ipfs.sync; echo "CAPTAIN is $CAPTAIN"
|
||||||
|
|
||||||
### AN ASTROPORT NEEDS A 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 "Et de ses canaux, public 'qo-op' et administratif 'moa'"; sleep 2
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "** Stop or Kill ipfs daemon **"
|
echo "** Stop or Kill ipfs daemon **"
|
||||||
# 1st Captain. Changing IPFS station key.
|
# 1st Captain. Changing IPFS station key.
|
||||||
|
@ -43,6 +36,16 @@ echo "** Stop or Kill ipfs daemon **"
|
||||||
[[ $YOU ]] && sudo killall -5 ipfs
|
[[ $YOU ]] && sudo killall -5 ipfs
|
||||||
#-----------------------------------
|
#-----------------------------------
|
||||||
|
|
||||||
|
### AN ASTROPORT NEEDS A 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
|
||||||
echo "=== Replacing ~/.ipfs/config ==="; sleep 2
|
echo "=== Replacing ~/.ipfs/config ==="; sleep 2
|
||||||
|
|
||||||
|
@ -70,7 +73,7 @@ echo "==== qo-op & moa Captain/Station keystore ===="; sleep 2
|
||||||
qoopns=$(ipfs key list -l | grep -w qo-op | cut -d ' ' -f 1)
|
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 "----> 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.
|
# 'moa' Key there? It is the 'Administrative' 3 star.level confidence information layer.
|
||||||
[[ ! -f ~/.ipfs/keystore/key_nvxwc ]] &&\
|
[[ ! -f ~/.ipfs/keystore/key_nvxwc ]] &&\
|
||||||
|
@ -82,6 +85,7 @@ echo "==== qo-op & moa Captain/Station keystore ===="; sleep 2
|
||||||
moans=$(ipfs key list -l | grep -w moa | cut -d ' ' -f 1)
|
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 "----> 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
|
||||||
echo "===== Connect captain IPFS datadir to Station (balise junction) ====="; sleep 2
|
echo "===== Connect captain IPFS datadir to Station (balise junction) ====="; sleep 2
|
||||||
|
@ -89,19 +93,14 @@ echo "===== Connect captain IPFS datadir to Station (balise junction) ====="; sl
|
||||||
[[ -d ~/.zen/ipfs.astrXbian ]] && mv ~/.zen/ipfs.astrXbian ~/.zen/ipfs.astrXbian.${MOATS} && echo "BACKUP ~/.zen/ipfs.astrXbian.${MOATS}"; sleep 2
|
[[ -d ~/.zen/ipfs.astrXbian ]] && mv ~/.zen/ipfs.astrXbian ~/.zen/ipfs.astrXbian.${MOATS} && echo "BACKUP ~/.zen/ipfs.astrXbian.${MOATS}"; sleep 2
|
||||||
mv ~/.zen/ipfs ~/.zen/ipfs.astrXbian && echo "BACKUP current ~/.zen/ipfs"; sleep 2
|
mv ~/.zen/ipfs ~/.zen/ipfs.astrXbian && echo "BACKUP current ~/.zen/ipfs"; sleep 2
|
||||||
|
|
||||||
# Linking ~/.zen/ipfs & ~/.zen/secret.dunikey
|
# Linking ~/.zen/ipfs
|
||||||
|
# ~/.zen/secret.dunikey
|
||||||
|
[[ ! -f ~/.zen/secret.dunikey.astrXbian ]] && mv ~/.zen/secret.dunikey ~/.zen/secret.dunikey.astrXbian && echo "BACKUP ~/.zen/secret.dunikey.astrXbian"; sleep 2
|
||||||
|
|
||||||
echo "CAPITAINE VOUS ETES EN POSSESSION DES CANAUX PRINCIPAUX DE LA STATION 'qo-op', 'moa', etc ..."
|
echo "CAPITAINE VOUS ETES EN POSSESSION DES CANAUX PRINCIPAUX DE LA STATION 'qo-op', 'moa', etc ..."
|
||||||
ln -s ~/.zen/game/players/$PLAYER/ipfs ~/.zen/ipfs && echo "$PLAYER become 'self' and can manage 'moa' & 'qo-op' channels" && sleep 1
|
ln -s ~/.zen/game/players/$PLAYER/ipfs ~/.zen/ipfs && echo "$PLAYER become 'self' and can manage 'moa' & 'qo-op' channels" && sleep 1
|
||||||
ln -s ~/.zen/game/players/$PLAYER/secret.dunikey ~/.zen/secret.dunikey && echo "Linking your ~/.zen/secret.dunikey with Station" && sleep 1
|
ln -s ~/.zen/game/players/$PLAYER/secret.dunikey ~/.zen/secret.dunikey && echo "Linking your ~/.zen/secret.dunikey with Station" && sleep 1
|
||||||
|
|
||||||
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 "#-----------------------------------"
|
|
||||||
|
|
||||||
echo "##################################################### OK"
|
echo "##################################################### OK"
|
||||||
echo "Nouvelle Identité 'self' Balise IPFS"; sleep 1
|
echo "Nouvelle Identité 'self' Balise IPFS"; sleep 1
|
||||||
ipfs id -f='<id>\n'
|
ipfs id -f='<id>\n'
|
||||||
|
@ -113,7 +112,7 @@ else
|
||||||
##############################
|
##############################
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "=== Replacing ~/.ipfs/config ==="; sleep 2
|
echo "=== Switching ~/.ipfs/config ==="; sleep 2
|
||||||
|
|
||||||
[[ ! -f ~/.ipfs/config.astrXbian ]] && mv ~/.ipfs/config ~/.ipfs/config.astrXbian && echo "BACKUP OLD ipfs config" || rm ~/.ipfs/config
|
[[ ! -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
|
ln -s ~/.zen/game/players/$PLAYER/ipfs.config ~/.ipfs/config && echo "Installing $PLAYER 'G1' ipfs config"; sleep 2
|
||||||
|
@ -125,42 +124,56 @@ echo "==== Astronaute keystore activated ===="; sleep 2
|
||||||
[[ ! -d ~/.ipfs/keystore.astrXbian ]] && mv ~/.ipfs/keystore ~/.ipfs/keystore.astrXbian || rm ~/.ipfs/keystore
|
[[ ! -d ~/.ipfs/keystore.astrXbian ]] && mv ~/.ipfs/keystore ~/.ipfs/keystore.astrXbian || rm ~/.ipfs/keystore
|
||||||
ln -s ~/.zen/game/players/$PLAYER/keystore ~/.ipfs/keystore
|
ln -s ~/.zen/game/players/$PLAYER/keystore ~/.ipfs/keystore
|
||||||
|
|
||||||
|
|
||||||
|
echo "==== linking G1 Libre ID to Station ===="; 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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 "#-----------------------------------"
|
||||||
|
|
||||||
if [[ $CAPTAIN == "$PLAYER" ]]; then
|
if [[ $CAPTAIN == "$PLAYER" ]]; then
|
||||||
## THE CAPTAIN IS LOGGED IN
|
## THE CAPTAIN IS LOGGED IN
|
||||||
echo "Bienvenue CAPITAINE !"; sleep 2
|
echo "Bienvenue CAPITAINE !"; sleep 2
|
||||||
echo "Ouverture des journaux 'moa' et 'qo-op' de votre Station Astroport";
|
echo "Ouverture des journaux 'moa' et 'qo-op' de votre Station Astroport";
|
||||||
else
|
|
||||||
# ASTRONAUT PLAYER IS LOGGED IN
|
|
||||||
echo "Joueur $PLAYER, $CAPTAIN est Capitaine de cet Astroport"; sleep 1
|
|
||||||
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
|
|
||||||
|
|
||||||
fi
|
|
||||||
# OPEN 'moa' channel
|
# OPEN 'moa' channel
|
||||||
moans=$(ipfs key list -l | grep -w moa | cut -d ' ' -f 1)
|
moans=$(ipfs key list -l | grep -w moa | cut -d ' ' -f 1) || moans=$(cat ~/.zen/game/players/$CAPTAIN/ipfs/.12D*/.moans | tail -n 1)
|
||||||
xdg-open "http://127.0.0.1:8080/ipns/$moans"
|
[[ $moans != "" ]] && xdg-open "http://127.0.0.1:8080/ipns/$moans"
|
||||||
|
|
||||||
# OPEN 'qo-op' channel
|
# OPEN 'qo-op' channel
|
||||||
qoopns=$(ipfs key list -l | grep -w qo-op | cut -d ' ' -f 1)
|
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)
|
||||||
xdg-open "http://127.0.0.1:8080/ipns/$qoopns"
|
[[ $qoopns != "" ]] && 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
|
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
|
# OPEN PLAYER HOME (contains 'moa_player' + 'qo-op_player' vertical iframes
|
||||||
|
echo "OUVERTURE DE VOTRE INTERFACE JOUEUR"; sleep 1
|
||||||
player=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f 1)
|
player=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f 1)
|
||||||
xdg-open "http://127.0.0.1:8080/ipns/$player"
|
xdg-open "http://127.0.0.1:8080/ipns/$player"
|
||||||
|
|
||||||
|
|
||||||
[[ $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 ZIP DANS UN FICHIER CHIFFRE AVEC PASS = BACKUP SUR CLEF USB"
|
|
||||||
# ${MY_PATH}/tools/SAVE.astronaut.sh # tar.gzip PLAYER DATA TO USB KEY TODO
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -90,7 +90,8 @@ else
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
qrencode -s 6 -o ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/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
|
||||||
echo "$G1PUB" > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB/_g1.pubkey # G1SSB NOTATION (astrXbian compatible)
|
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)
|
secFromDunikey=$(cat ~/.zen/game/players/$PLAYER/secret.dunikey | grep "sec" | cut -d ' ' -f2)
|
||||||
|
@ -123,24 +124,34 @@ else
|
||||||
|
|
||||||
#echo "## PUBLISHING ${PLAYER} /ipns/$PLAYERNS"
|
#echo "## PUBLISHING ${PLAYER} /ipns/$PLAYERNS"
|
||||||
IPUSH=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/index.html | tail -n 1)
|
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
|
ipfs name publish --key=${PLAYER} /ipfs/$IPUSH 2>/dev/null
|
||||||
|
|
||||||
# Moa WIKI ~/.zen/game/players/$PLAYER/moa/index.html
|
# Moa WIKI ~/.zen/game/players/$PLAYER/moa/index.html
|
||||||
mkdir -p ~/.zen/game/players/$PLAYER/moa
|
mkdir -p ~/.zen/game/players/$PLAYER/moa
|
||||||
cp ${MY_PATH}/../templates/moawiki.html ~/.zen/game/players/$PLAYER/moa/index.html
|
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.html
|
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.html
|
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.html
|
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.html
|
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)
|
STATION=$(ipfs key list -l | grep -w 'moa' | cut -d ' ' -f 1)
|
||||||
sed -i "s~_QOOP_~${STATION}~g" ~/.zen/game/players/$PLAYER/moa/index.html
|
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.html
|
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.html
|
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.html
|
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.html
|
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
|
||||||
|
|
||||||
|
|
||||||
#echo "## PUBLISHING moa_${PLAYER} /ipns/$MOANS"
|
#echo "## PUBLISHING moa_${PLAYER} /ipns/$MOANS"
|
||||||
IPUSH=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/moa/index.html | tail -n 1)
|
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
|
ipfs name publish --key=moa_${PLAYER} /ipfs/$IPUSH 2>/dev/null
|
||||||
|
|
||||||
# qo-op WIKI ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html (TODO ENHANCE TW TEMPLATE WITH EXTRA PARMETERS, EXTRA TIDDLERS)
|
# qo-op WIKI ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html (TODO ENHANCE TW TEMPLATE WITH EXTRA PARMETERS, EXTRA TIDDLERS)
|
||||||
|
@ -159,6 +170,9 @@ else
|
||||||
|
|
||||||
#echo "## PUBLISHING qo-op_${PLAYER} /ipns/$QOOPNS"
|
#echo "## PUBLISHING qo-op_${PLAYER} /ipns/$QOOPNS"
|
||||||
IPUSH=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/index.html | tail -n 1)
|
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
|
ipfs name publish --key=qo-op_${PLAYER} /ipfs/$IPUSH 2>/dev/null
|
||||||
|
|
||||||
## MEMORISE PLAYER
|
## MEMORISE PLAYER
|
||||||
|
|
|
@ -11,11 +11,20 @@ MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
ME="${0##*/}"
|
ME="${0##*/}"
|
||||||
|
|
||||||
[[ ! -f ~/.zen/game/players/.current/QR.png ]] && echo "ERROR. Cannot find current connected player" && exit 1
|
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||||
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo)
|
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
|
||||||
PLAYER=$(cat ~/.zen/game/players/.current/.player)
|
|
||||||
|
[[ ! -f ~/.zen/game/players/.current/QR.png ]] &&\
|
||||||
|
echo "ERREUR. Aucun PLAYER Astronaute connecté .ERREUR ~/.zen/game/players/.current/" && exit 1
|
||||||
|
|
||||||
|
# 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 )
|
||||||
|
|
||||||
PASS=$(cat ~/.zen/game/players/.current/.pass)
|
PASS=$(cat ~/.zen/game/players/.current/.pass)
|
||||||
|
|
||||||
SALT=$(cat ~/.zen/game/players/.current/login.june | head -n 1)
|
SALT=$(cat ~/.zen/game/players/.current/login.june | head -n 1)
|
||||||
PEPPER=$(cat ~/.zen/game/players/.current/login.june | tail -n 1)
|
PEPPER=$(cat ~/.zen/game/players/.current/login.june | tail -n 1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue