diff
This commit is contained in:
parent
80b395d74e
commit
3e51735bce
|
@ -41,7 +41,7 @@ TWUPLANET="/ipfs/bafybeib4cl7ud7nih4bkr4cnrdiajhutreamgmrly46x45ldqfkrr2xpne"
|
|||
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/TW
|
||||
|
||||
## Chargement TW !!!
|
||||
## TEST chargement ONLINE TW !!!
|
||||
if [[ $SALT != "" && PEPPER != "" ]]; then
|
||||
|
||||
## Creating SALT/PEPPER IPNS KEY
|
||||
|
@ -83,8 +83,8 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
|
|||
HPass=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].HPASS)
|
||||
echo "ASTROPORT=${ASTROPORT}"
|
||||
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'AstroID.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'AstroID'
|
||||
AstroID=$(cat ~/.zen/tmp/${MOATS}/AstroID.json | jq -r .[]._canonical_uri)
|
||||
[[ -z $HPass ]] && HPass=$(cat ~/.zen/tmp/${MOATS}/AstroID.json | jq -r .[].HPASS)
|
||||
AstroID=$(cat ~/.zen/tmp/${MOATS}/AstroID.json | jq -r .[]._canonical_uri) ## Can be deleted
|
||||
[[ -z $HPass ]] && HPass=$(cat ~/.zen/tmp/${MOATS}/AstroID.json | jq -r .[].HPASS) ## Double HPASS
|
||||
echo "AstroID=$AstroID ($HPass)"
|
||||
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'ZenCard.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'ZenCard'
|
||||
ZenCard=$(cat ~/.zen/tmp/${MOATS}/ZenCard.json | jq -r .[]._canonical_uri)
|
||||
|
@ -125,7 +125,7 @@ fi
|
|||
[[ $SALT == "" ]] && SALT=$(${MY_PATH}/../tools/diceware.sh 4 | xargs)
|
||||
#~ echo "-> ID : $SALT"
|
||||
|
||||
[[ $PEPPER == "" ]] && PEPPER=$(${MY_PATH}/../tools/diceware.sh 2 | xargs)
|
||||
[[ $PEPPER == "" ]] && PEPPER=$(${MY_PATH}/../tools/diceware.sh 4 | xargs)
|
||||
#~ echo "-> PASS : $PEPPER"
|
||||
|
||||
[[ ! $PSEUDO ]] && PSEUDO=${PLAYER%%[0-9]*}
|
||||
|
@ -133,8 +133,9 @@ fi
|
|||
[[ $(ls ~/.zen/game/players/$PSEUDO 2>/dev/null) ]] && echo "$PSEUDO EST DEJA UN PLAYER. EXIT" && exit 1
|
||||
|
||||
# PSEUDO=${PSEUDO,,} #lowercase
|
||||
[[ ! ${PLAYER} ]] && PLAYER=${PSEUDO}${RANDOM:0:3}@$(${MY_PATH}/../tools/diceware.sh 1 | xargs).${RANDOM:0:3} \
|
||||
&& echo "ADRESSE EMAIL ?" && read OPLAYER && [[ $OPLAYER ]] && PLAYER=$OPLAYER
|
||||
[[ ! ${PLAYER} ]] \
|
||||
&& PLAYER=${PSEUDO}${RANDOM:0:3}@$(${MY_PATH}/../tools/diceware.sh 1 | xargs).${RANDOM:0:3} \
|
||||
&& echo "ADRESSE EMAIL ?" && read OPLAYER && [[ $OPLAYER ]] && PLAYER=$OPLAYER ## CLI MODE
|
||||
|
||||
PLAYER=${PLAYER,,}
|
||||
|
||||
|
@ -159,6 +160,13 @@ G1PUB=$(cat ~/.zen/tmp/${MOATS}/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
|||
mkdir -p ~/.zen/game/players/${PLAYER}/.ipfs # Prepare PLAYER datastructure
|
||||
echo "/ip4/127.0.0.1/tcp/5001" > ~/.zen/game/players/${PLAYER}/.ipfs/api
|
||||
|
||||
## secret.june = SALT PEPPRER CREDENTIALS
|
||||
echo "SALT=\"$SALT\"" > ~/.zen/game/players/${PLAYER}/secret.june
|
||||
echo "PEPPER=\"$PEPPER\"" >> ~/.zen/game/players/${PLAYER}/secret.june
|
||||
####
|
||||
## MOVE ${MOATS} secret.dunikey IN PLAYER DIRECTORY
|
||||
mv ~/.zen/tmp/${MOATS}/secret.dunikey ~/.zen/game/players/${PLAYER}/
|
||||
|
||||
# PLAYER=geg-la_debrouille@super.chez-moi.com
|
||||
YUSER=$(echo ${PLAYER} | cut -d '@' -f1) # YUSER=geg-la_debrouille
|
||||
LYUSER=($(echo "$YUSER" | sed 's/[^a-zA-Z0-9]/\ /g')) # LYUSER=(geg la debrouille)
|
||||
|
@ -180,13 +188,9 @@ DISCO="/?salt=${USALT}&pepper=${UPEPPER}"
|
|||
[[ $isLAN ]] && NID="http://ipfs.localhost:8080" \
|
||||
&& WID="http://ipfs.localhost:5001"
|
||||
|
||||
####
|
||||
## MOVE secret.dunikey IN PLAYER DIRECTORY
|
||||
mv ~/.zen/tmp/${MOATS}/secret.dunikey ~/.zen/game/players/${PLAYER}/
|
||||
|
||||
# Create Player "IPNS Key" (key import)
|
||||
|
||||
ipfs key rm ${PLAYER} 2>/dev/null
|
||||
# Create ${PLAYER} "IPNS Key"
|
||||
ipfs key rm ${PLAYER} >/dev/null 2>&1
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/game/players/${PLAYER}/secret.player "$SALT" "$PEPPER"
|
||||
TWNS=$(ipfs key import ${PLAYER} -f pem-pkcs8-cleartext ~/.zen/game/players/${PLAYER}/secret.player)
|
||||
ASTRONAUTENS=$(ipfs key import $G1PUB -f pem-pkcs8-cleartext ~/.zen/game/players/${PLAYER}/secret.player)
|
||||
|
@ -233,8 +237,11 @@ DISCO="/?salt=${USALT}&pepper=${UPEPPER}"
|
|||
### INITALISATION WIKI dans leurs répertoires de publication IPFS
|
||||
mkdir -p ~/.zen/game/players/${PLAYER}/ipfs/moa/
|
||||
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/TW/index.html ]] && cp ${MY_PATH}/../templates/twuplanet.html ~/.zen/tmp/${MOATS}/TW/index.html
|
||||
sed "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/tmp/${MOATS}/TW/index.html > ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/TW/index.html ]] \
|
||||
&& cp ${MY_PATH}/../templates/twuplanet.html ~/.zen/tmp/${MOATS}/TW/index.html
|
||||
|
||||
sed "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/tmp/${MOATS}/TW/index.html \
|
||||
> ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
# INSERT ASTROPORT ADDRESS
|
||||
tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'Astroport.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Astroport'
|
||||
|
@ -243,8 +250,8 @@ DISCO="/?salt=${USALT}&pepper=${UPEPPER}"
|
|||
|
||||
# TW CHAIN INIT WITH TWMODEL
|
||||
sed -i "s~_MOATS_~${MOATS}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~_CHAIN_~${TWMODEL}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~_TWMODEL_~${TWMODEL}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~_CHAIN_~${TWUPLANET}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~_TWMODEL_~${TWUPLANET}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~_TW_~/ipns/${ASTRONAUTENS}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
## AND HACK QRCODE.sh FOR _PGP KEY_ TO VERIFY LAST HASH OF PROVIDED PASS
|
||||
|
@ -261,8 +268,6 @@ DISCO="/?salt=${USALT}&pepper=${UPEPPER}"
|
|||
# INSERT PLAYER DATA
|
||||
sed -i "s~_PLAYER_~${PLAYER}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~_PSEUDO_~${PSEUDO}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~_WISHKEY_~${G1PUB}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
sed -i "s~_G1PUB_~${G1PUB}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
#~ sed -i "s~_QRSEC_~${PASsec}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
|
@ -273,9 +278,6 @@ DISCO="/?salt=${USALT}&pepper=${UPEPPER}"
|
|||
|
||||
sed -i "s~_ASTRONAUTENS_~/ipns/${ASTRONAUTENS}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
## POPULATE CESIUM TID
|
||||
sed -i "s~_CESIUMIPFS_~${CESIUMIPFS}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
## AstroID Tiddler UPGRADE
|
||||
cat ${MY_PATH}/../templates/data/AstroID.json \
|
||||
| sed -e "s~/ipfs/bafybeifbebc3ewnzrzbm44arddedbralegnxklhua5d5ymzaqtf2kaub7i~${ASTROQR}~g" \
|
||||
|
@ -285,8 +287,6 @@ DISCO="/?salt=${USALT}&pepper=${UPEPPER}"
|
|||
-e "s~_HPASS_~${HPASS}~g" \
|
||||
> ~/.zen/tmp/${MOATS}/AstroID.json
|
||||
|
||||
sed -i "s~${AstroID}~${ASTROQR}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ## NOT CYPHERED AstroID
|
||||
|
||||
sed -i "s~tube.copylaradio.com~$myTUBE~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~ipfs.copylaradio.com~$myTUBE~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
|
@ -331,18 +331,20 @@ DISCO="/?salt=${USALT}&pepper=${UPEPPER}"
|
|||
--render '.' 'MIZ.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
|
||||
OLD16=$(cat ~/.zen/tmp/${MOATS}/MIZ.json | jq -r ".[].secret")
|
||||
[[ ${OLD16} == "" || ${OLD16} == "null" ]] && OLD16="_SECRET_"
|
||||
|
||||
echo "${OLD16}"
|
||||
# TODO : NODE COULD FORGET PASS THEN DECODE ${PLAYER}/secret.dunikey FROM TW # PROD #
|
||||
MACHINEPUB=$(cat $HOME/.zen/game/myswarm_secret.dunikey | grep pub | cut -d ' ' -f 2)
|
||||
|
||||
if [[ "${MACHINEPUB}" == "" ]]; then
|
||||
if [[ "${MACHINEPUB}" != "" ]]; then
|
||||
#~ echo "# CRYPTO ENCODING PLAYER KEY WITH MACHINEPUB
|
||||
${MY_PATH}/../tools/natools.py encrypt \
|
||||
-p ${MACHINEPUB} \
|
||||
-i $HOME/.zen/game/players/${PLAYER}/secret.dunikey \
|
||||
-i $HOME/.zen/game/players/${PLAYER}/secret.june \
|
||||
-o $HOME/.zen/tmp/${MOATS}/secret.dunikey.${G1PUB}.enc
|
||||
ENCODING=$(cat ~/.zen/tmp/${MOATS}/bafybeiewwxkmiojbskcqhbj2gbkde3czkeqftn6fgvwoa7ez5n5whido3qsecret.dunikey.$G1PUB.enc | base16)
|
||||
sed -i "s~${OLD16}~${ENCODING}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
echo "ENCODING: ${ENCODING}"
|
||||
|
||||
# IN CASE ORIGINAL STATION NEEDS ACCESS # COULD BE REMOVED ?
|
||||
###########
|
||||
#~ echo "# CRYPTO DECODING TESTING..."
|
||||
|
@ -388,26 +390,10 @@ DISCO="/?salt=${USALT}&pepper=${UPEPPER}"
|
|||
echo '[{"title":"$:/plugins/astroport/lightbeams/saver/ipns/lightbeam-name","text":"'${PLAYER}_feed'","tags":""}]' > ~/.zen/tmp/${MOATS}/lightbeam-name.json
|
||||
echo '[{"title":"$:/plugins/astroport/lightbeams/saver/ipns/lightbeam-key","text":"'${FEEDNS}'","tags":""}]' > ~/.zen/tmp/${MOATS}/lightbeam-key.json
|
||||
|
||||
## NATOOLS ENCRYPT
|
||||
#~ echo "# NATOOLS ENCODING MYSELF feed.ipfskey (TODO: could be decoded to compare with G1lib.js) "
|
||||
${MY_PATH}/../tools/natools.py encrypt -p $G1PUB -i $HOME/.zen/tmp/${MOATS}/feed.ipfskey -o $HOME/.zen/tmp/${MOATS}/feed.ipfskey.$G1PUB.enc
|
||||
ENCODING=$(cat $HOME/.zen/tmp/${MOATS}/feed.ipfskey.$G1PUB.enc | base16)
|
||||
#~ echo ${ENCODING}
|
||||
echo '[{"title":"$:/plugins/astroport/lightbeams/saver/g1/lightbeam-natools-feed","text":"'${ENCODING}'","tags":""}]' > ~/.zen/tmp/${MOATS}/lightbeam-natools.json
|
||||
|
||||
#~ echo
|
||||
#~ echo "IPFS GATEWAY : ${NID}"
|
||||
# cat ~/.zen/tmp/${MOATS}/local.gw.json | jq -r
|
||||
#~ echo "IPFS API : ${WID}"
|
||||
# cat ~/.zen/tmp/${MOATS}/local.api.json | jq -r
|
||||
#~ echo ">>> RSS FEED : ${myIPFS}/ipns/${FEEDNS}"
|
||||
#~ ## CHANGE SELECTED GW & API
|
||||
|
||||
## ADD SYSTEM TW
|
||||
tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-name.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-key.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-natools.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/local.api.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/local.gw.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/GPS.json "application/json" \
|
||||
|
@ -503,9 +489,6 @@ DISCO="/?salt=${USALT}&pepper=${UPEPPER}"
|
|||
|
||||
echo "${ASTRONAUTENS}" > ~/.zen/game/players/${PLAYER}/.playerns
|
||||
|
||||
echo "SALT=\"$SALT\"" > ~/.zen/game/players/${PLAYER}/secret.june
|
||||
echo "PEPPER=\"$PEPPER\"" >> ~/.zen/game/players/${PLAYER}/secret.june
|
||||
|
||||
#~ echo; echo "Création Clefs et QR codes pour accès au niveau Astroport Ŋ1"; sleep 1
|
||||
|
||||
echo "--- PLAYER : ${PLAYER} - DATA PROTOCOL LAYER LOADED";
|
||||
|
|
Loading…
Reference in New Issue