keeping TW chain updated in TW

This commit is contained in:
fred 2023-04-08 12:18:27 +02:00
parent 09f4b78a06
commit fbe2d97ad3
5 changed files with 37 additions and 23 deletions

View File

@ -78,15 +78,16 @@ if [[ ${QRCODE:0:5} == "~~~~~" ]]; then
if [[ $PASS != "" ]]; then
echo ${WHAT} ${VAL}
## Recreate GPG aes file
urldecode ${QRCODE} | tr '_' '+' | tr '-' '\n' | tr '~' '-' > ~/.zen/tmp/${MOATS}/disco.aes
sed -i '$ d' ~/.zen/tmp/${MOATS}/disco.aes
# Decoding
echo "cat ~/.zen/tmp/${MOATS}/disco.aes | gpg -d --passphrase "$PASS" --batch"
cat ~/.zen/tmp/${MOATS}/disco.aes | gpg -d --passphrase "$PASS" --batch > ~/.zen/tmp/${MOATS}/disco
cat ~/.zen/tmp/${MOATS}/disco.aes | gpg -d --passphrase "$PASS" --batch > ~/.zen/tmp/${MOATS}/decoded
# cat ~/.zen/tmp/${MOATS}/disco
## FORMAT SHOULD BE "/?salt=${USALT}&pepper=${UPEPPER}"
DISCO=$(cat ~/.zen/tmp/${MOATS}/disco | cut -d '?' -f2)
## FORMAT IS "/?salt=${USALT}&pepper=${UPEPPER}"
DISCO=$(cat ~/.zen/tmp/${MOATS}/decoded | cut -d '?' -f2)
arr=(${DISCO//[=&]/ })
salt=$(urldecode ${arr[1]} | xargs)
pepper=$(urldecode ${arr[3]} | xargs)

View File

@ -109,6 +109,7 @@ for PLAYER in ${PLAYERONE[@]}; do
--output ~/.zen/tmp/${MOATS} \
--render '.' 'Astroport.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Astroport'
ASTROPORT=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].astroport)
CURCHAIN=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].chain | rev | cut -f 1 -d '/' | rev) # Remove "/ipfs/" part
IPNSTAIL=$(echo ${ASTROPORT} | rev | cut -f 1 -d '/' | rev) # Remove "/ipns/" part
echo "TW ASTROPORT GATEWAY : ${ASTROPORT}"
@ -188,6 +189,11 @@ for PLAYER in ${PLAYERONE[@]}; do
echo "DIFFERENCE DETECTED !! "
echo "Backup & Upgrade TW local copy..."
cp ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
[[ -s ~/.zen/game/players/$PLAYER/ipfs/moa/.chain ]] \
&& ZCHAIN=$(cat ~/.zen/game/players/$PLAYER/ipfs/moa/.chain) \
&& echo "# CHAIN : $CURCHAIN -> $ZCHAIN" \
&& sed -i "s~$CURCHAIN~$ZCHAIN~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
fi
##############################################################

View File

@ -18,6 +18,7 @@ MOATS="$2"
PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null)
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub 2>/dev/null)
COINS=$(cat $HOME/.zen/tmp/coucou/${G1PUB}.COINS)
ASTRONS=$(cat ~/.zen/game/players/${PLAYER}/.playerns 2>/dev/null)
## REFRESH ASTRONAUTE TW
@ -31,7 +32,7 @@ INDEX="$3"
mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
echo "%% $COINS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
###############################
## EXTRACT G1Voeu from PLAYER TW
echo "Exporting ${PLAYER} TW [tag[G1Voeu]]"
@ -212,7 +213,7 @@ do
WISHFLUX=$(ipfs add -qHwr ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/* | tail -n 1) # ADDING JSONS TO IPFS
ipfs name publish -k $VOEUKEY /ipfs/$WISHFLUX # PUBLISH $VOEUKEY
echo "## ASK ${myASTROTUBE} GATEASTRONAUTENSWAY TO REFRESH"
echo "## ASK ${myASTROTUBE} $ASTRONAUTENS TO REFRESH"
curl -m 120 -so ~/.zen/tmp/${WISHNAME}.astroindex.html "${myASTROTUBE}${VOEUNS}" &
## MOVE INTO PLAYER AREA

View File

@ -79,10 +79,9 @@ header {
</div>
<span id="typed"></span>
</h2>
<span><a target="youtube" href="https://youtube.com">📺 (&#128077;)</a> : </span><input name=g1pub value=''></br>
<span><a target="youtube" href="https://youtube.com">📺 (&#128077;)</a> : </span><input name=g1pub value='favorite video link'></br>
<span>Email : </span><input name=email value=''></br></br>
<input type='submit' value='[(♥‿‿♥)]'>
<p>Renseignez votre lien Youtube préféré et votre Email<br>Validez</p>
</form>

View File

@ -41,14 +41,20 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
ASTRONAUTENS=$(ipfs key import ${MOATS} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/player.key 2>/dev/null)
# echo "/ipns/${ASTRONAUTENS}"
echo "SCANNING /ipns/${ASTRONAUTENS} for 30s"
echo "SCANNING /ipns/${ASTRONAUTENS} for 180s"
## GETTING LAST TW via IPFS or HTTP GW
[[ $YOU ]] \
&& ipfs --timeout 30s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/${MOATS}/TW/index.html
&& ipfs --timeout 180s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/${MOATS}/TW/index.html
[[ ! -s ~/.zen/tmp/${MOATS}/TW/index.html ]] \
&& echo "Trying curl on $LIBRA" \
&& curl -m 30 -so ~/.zen/tmp/${MOATS}/TW/index.html "$LIBRA/ipns/${ASTRONAUTENS}"
[[ $XDG_SESSION_TYPE == 'x11' ]] \
&& [[ -s ~/.zen/tmp/${MOATS}/TW/index.html ]] \
&& echo "TYPE 'yes' TO RESET TW. HIT ENTER TO KEEP IT." \
&& read ENTER \
&& [[ $ENTER != "" ]] && rm ~/.zen/tmp/${MOATS}/TW/index.html
#~ [[ ! -s ~/.zen/tmp/${MOATS}/TW/index.html ]] \
#~ && echo "Trying curl on $LIBRA" \
#~ && curl -m 30 -so ~/.zen/tmp/${MOATS}/TW/index.html "$LIBRA/ipns/${ASTRONAUTENS}"
#############################################
## AUCUN RESULTAT
@ -66,14 +72,15 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
rm -f ~/.zen/tmp/${MOATS}/Astroport.json
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'Astroport.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Astroport'
ASTROPORT=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].astroport)
echo "ASTROPORT=$ASTROPORT"
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'Astroport.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'AstroID'
AstroID=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[]._canonical_uri)
echo "AstroID=$AstroID"
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'Astroport.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'G1Visa'
G1Visa=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[]._canonical_uri)
echo "G1Visa=$G1Visa"
if [[ $ASTROPORT ]]; then
if [[ $ASTROPORT != "" ]]; then
IPNSTAIL=$(echo $ASTROPORT | rev | cut -f 1 -d '/' | rev) # Remove "/ipns/" part
echo "TW ASTROPORT GATEWAY : ${ASTROPORT}"
@ -81,7 +88,7 @@ if [[ $SALT != "" && PEPPER != "" ]]; then
else
echo ">> NO GOOD TW - CREATING FRESH NEW ONE"
echo ">> NO ACTIVE TW - CREATING FRESH NEW ONE"
cp ~/.zen/Astroport.ONE/templates/twdefault.html ~/.zen/tmp/${MOATS}/TW/index.html
fi
@ -367,16 +374,16 @@ DISCO="/?salt=${USALT}&pepper=${UPEPPER}"
convert ${MY_PATH}/../images/astroport.jpg -resize 240 ~/.zen/tmp/${MOATS}/ASTROPORT.png
composite -compose Over -gravity SouthWest -geometry +280+20 ~/.zen/tmp/${MOATS}/ASTROPORT.png ${MY_PATH}/../images/Brother_600x400.png ~/.zen/tmp/${MOATS}/astroport.png
composite -compose Over -gravity East -geometry +0+0 ~/.zen/tmp/${MOATS}/TW.png ~/.zen/tmp/${MOATS}/astroport.png ~/.zen/tmp/${MOATS}/astroport2.png
composite -compose Over -gravity SouthWest -geometry +5+5 ~/.zen/tmp/${MOATS}/ASTROPORT.png ${MY_PATH}/../images/Brother_600x400.png ~/.zen/tmp/${MOATS}/astroport.png
composite -compose Over -gravity East -geometry +5+5 ~/.zen/tmp/${MOATS}/TW.png ~/.zen/tmp/${MOATS}/astroport.png ~/.zen/tmp/${MOATS}/astroport2.png
composite -compose Over -gravity NorthWest -geometry +0+0 ~/.zen/tmp/${MOATS}/QR.png ~/.zen/tmp/${MOATS}/astroport2.png ~/.zen/tmp/${MOATS}/one.png
# composite -compose Over -gravity NorthWest -geometry +280+280 ~/.zen/game/players/.current/QRsec.png ~/.zen/tmp/${MOATS}/one.png ~/.zen/tmp/${MOATS}/image.png
convert -gravity northwest -pointsize 35 -fill black -draw "text 50,300 \"$PSEUDO\"" ~/.zen/tmp/${MOATS}/one.png ~/.zen/tmp/${MOATS}/image.png
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,40 \"${PLAYER}\"" ~/.zen/tmp/${MOATS}/image.png ~/.zen/tmp/${MOATS}/pseudo.png
convert -gravity northwest -pointsize 25 -fill black -draw "text 50,300 \"$PSEUDO\"" ~/.zen/tmp/${MOATS}/one.png ~/.zen/tmp/${MOATS}/image.png
convert -gravity northwest -pointsize 20 -fill black -draw "text 300,40 \"${PLAYER}\"" ~/.zen/tmp/${MOATS}/image.png ~/.zen/tmp/${MOATS}/pseudo.png
## WITH CONFIDENTIAL (LOCAL PRINT)
convert -gravity northeast -pointsize 25 -fill black -draw "text 20,180 \"$PASS\"" ~/.zen/tmp/${MOATS}/pseudo.png ~/.zen/tmp/${MOATS}/pass.png
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,100 \"$SALT\"" ~/.zen/tmp/${MOATS}/pass.png ~/.zen/tmp/${MOATS}/salt.png
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,140 \"$PEPPER\"" ~/.zen/tmp/${MOATS}/salt.png ~/.zen/game/players/${PLAYER}/ID.png
@ -416,7 +423,7 @@ echo; echo "Création Clefs et QR codes pour accès au niveau Astroport Ŋ1"; sl
echo "--- PLAYER : ${PLAYER} - FILE SYSTEM LOADED";
# ls ~/.zen/game/players/${PLAYER}
[[ $XDG_SESSION_TYPE == 'x11' ]] && xdg-open "${myIPFS}/ipns/${ASTRONAUTENS}" && espeak "YOUR PASS IS $PASS REPEAT $PASS REPEAT $PASS"
[[ $XDG_SESSION_TYPE == 'x11' ]] && xdg-open "${myIPFS}/ipns/${ASTRONAUTENS}" && espeak "YOUR PASS IS $PASS"
################# PREPARE DOCKERIZATION
rm ~/.zen/game/players/.current