diff --git a/API/QRCODE.sh b/API/QRCODE.sh index 1d813ba1..3441a22d 100755 --- a/API/QRCODE.sh +++ b/API/QRCODE.sh @@ -120,15 +120,15 @@ fi ## QRCODE can be ASTRONAUTENS or G1PUB format ################################################################################ ## QRCODE IS IPNS FORMAT : CHANGE .current AND MAKE G1BILLETS -ASTROPATH=$(grep $QRCODE ~/.zen/game/players/*/.playerns | cut -d ':' -f 1 | rev | cut -d '/' -f 2- | rev 2>/dev/null) +ASTROPATH=$(grep -r $QRCODE ~/.zen/game/players/*/ipfs/moa | tail -n 1 | cut -d ':' -f 1 | rev | cut -d '/' -f 2- | rev 2>/dev/null) if [[ $ASTROPATH != "" && $APPNAME == "" ]]; then - PLAYER=$(echo $ASTROPATH | rev | cut -d '/' -f 1 | rev) + PLAYER=$(echo $ASTROPATH | rev | cut -d '/' -f 3 | rev) rm ~/.zen/game/players/.current - ln -s $ASTROPATH ~/.zen/game/players/.current - echo "LINKING $ASTROPATH to .current" - #### SELECT PARRAIN "G1PalPé" + ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current + echo "LINKING $PLAYER to .current" + #### SELECT PARRAIN "G1PalPay" echo "#>>>>>>>>>>>> # REDIRECT TO CREATE G1BILLETS" sed "s~_TWLINK_~${myG1BILLET}?montant=0\&style=$PLAYER~g" ~/.zen/Astroport.ONE/templates/index.302 > ~/.zen/tmp/${MOATS}/index.redirect @@ -221,16 +221,19 @@ else && ~/.zen/Astroport.ONE/tools/timeout.sh -t 20 curl -s ${myDATA}/user/profile/${QRCODE} > ~/.zen/tmp/coucou/${QRCODE}.gchange.json & GFOUND=$(cat ~/.zen/tmp/coucou/${QRCODE}.gchange.json | jq -r '.found') + echo "GFOUND=$GFOUND" [[ $GFOUND == "false" ]] \ - && echo "G1BILLET. NO GCHANGE YET. REDIRECT" \ + && echo "NO GCHANGE YET. REDIRECT" \ && sed "s~_TWLINK_~${myGCHANGE}~g" ~/.zen/Astroport.ONE/templates/index.302 > ~/.zen/tmp/${MOATS}/index.redirect \ && echo "url='"${myGCHANGE}"'" >> ~/.zen/tmp/${MOATS}/index.redirect \ && ( cat ~/.zen/tmp/${MOATS}/index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1) & + ## SCAN CESIUM + [[ ! -s ~/.zen/tmp/coucou/${QRCODE}.gplus.json ]] \ && ~/.zen/Astroport.ONE/tools/timeout.sh -t 10 curl -s ${myCESIUM}/user/profile/${QRCODE} > ~/.zen/tmp/coucou/${QRCODE}.gplus.json 2>/dev/null & GCFOUND=$(cat ~/.zen/tmp/coucou/${QRCODE}.gplus.json | jq -r '.found') + echo "GCFOUND=$GCFOUND" [[ $GCFOUND == "false" ]] \ && echo "AUCUN GCPLUS : PAS DE CESIUM POUR CLEF GCHANGE" \ && sed "s~_TWLINK_~https://demo.cesium.app/#/app/wot/$QRCODE/~g" ~/.zen/Astroport.ONE/templates/index.302 > ~/.zen/tmp/${MOATS}/index.redirect \ @@ -239,6 +242,7 @@ else ## CHECK IF GCHANGE IS LINKED TO "A DECLARED CESIUM" CPUB=$(cat ~/.zen/tmp/coucou/${QRCODE}.gchange.json | jq -r '._source.pubkey' 2>/dev/null) + echo "CPUB=$CPUB" ## SCAN GPUB CESIUM + ##### DO WE HAVE A MEMBER LINKED ?? @@ -296,45 +300,6 @@ else ## -fi -################################################################################################### -# THAT=$2 AND=$3 THIS=$4 APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 -### amzqr "$myASTROPORT/?qrcode=$G1PUB&junesec=$PASsec&askpass=$HPass&tw=$ASTRONAUTENS" \ -### amzqr "$myASTROPORT/?qrcode=$WISHKEY&junesec=$PASsec&asksalt=$HPass&flux=$VOEUNS&tw=$ASTRONAUTENS" \ -### -if [[ $AND == "junesec" ]]; then -echo "♥BOX♥BOX♥BOX♥BOX♥BOX" -echo "MAGIC WORLD ASTRONAUT & WISHES" - - - if [[ $APPNAME == "askpass" ]]; then - echo ">> ASTRONAUT QRCODE $APPNAME" - ENDCODED="$THIS" - HPASS="$WHAT" - TW="/ipns/$VAL" - - - fi - - if [[ $APPNAME == "asksalt" ]]; then - echo ">> WISH QRCODE $APPNAME" - ENDCODED="$THIS" - HSALT="$WHAT" - FLUX="/ipns/$VAL" - - fi - -fi - -### amzqr "$myASTROPORT/?qrcode=$G1FRIEND&star=1" \ -### -if [[ $AND == "star" ]]; then - - STAR=$THIS - echo "WebClient ask to send $STAR star to $QRCODE" - ## RETURN PAGE with "salt / pepper" API to activate - - fi ## TODO MAGIC QRCODE RX / TX diff --git a/API/SALT.sh b/API/SALT.sh index 6f992021..ba7be012 100755 --- a/API/SALT.sh +++ b/API/SALT.sh @@ -25,7 +25,7 @@ Content-Type: text/html; charset=UTF-8 " - [[ ! $APPNAME || $SALT == "pepper" ]] && echo "NO APPNAME - BAD APP - CONTINUE" && exit 1 + [[ ! $APPNAME || $SALT == "pepper" ]] && echo "NO APPNAME - BAD APP - CONTINUE" && (echo "$HTTPCORS ERROR - BAD CREDENTIALS" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1 ############################################################################ # WRITING API # SALT # PEPPER # MAKING THE KEY EXIST ######### ################### KEY GEN ################################### @@ -438,22 +438,15 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh ## REMOVE PLAYER IPNS KEY FROM STATION PLAYER=${WHAT} - - if [[ -d ~/.zen/game/players/${PLAYER}/ipfs ]]; then - - ipfs key import ${PLAYER} -f pem-pkcs8-cleartext ~/.zen/tmp/coucou/${MOATS}.${G1PUB}.ipns.key - REP="LOGIN OK" - - else - - - REP="ERROR UNKNOW ${PLAYER}" - - fi - - echo ${REP} + ipfs key import ${PLAYER} -f pem-pkcs8-cleartext ~/.zen/tmp/coucou/${MOATS}.${G1PUB}.ipns.key ASTRONAUTENS=$(ipfs key list -l | grep $PLAYER | cut -d ' ' -f1) - REPLACE=${myASTROPORT}/ipns/${ASTRONAUTENS} + + WSTATION=$(cat ~/.zen/tmp/WSTATION 2>/dev/null) + + [[ $WSTATION != "" ]] \ + && REPLACE=${myIPFS}${WSTATION} \ + || REPLACE=${myIPFS}/ipns/${ASTRONAUTENS} + ## SET COOKIE sed "s~_TWLINK_~${REPLACE}~g" ~/.zen/Astroport.ONE/templates/index.302 > ~/.zen/tmp/coucou/${MOATS}.index.redirect sed -i "s~_G1PUB_~${G1PUB}~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect @@ -475,20 +468,10 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh ## REMOVE PLAYER IPNS KEY FROM STATION PLAYER=${WHAT} + ipfs key rm ${G1PUB} + ipfs key rm ${PLAYER} + REP="$PLAYER LOGOUT OK" - if [[ -d ~/.zen/game/players/${PLAYER}/ipfs ]]; then - - ipfs key rm ${G1PUB} > /dev/null 2>&1 - ipfs key rm ${PLAYER} > /dev/null 2>&1 - REP="LOGOUT OK" - - else - - REP="ERROR UNKNOW ${PLAYER}" - - fi - - echo ${REP} echo "$HTTPCORS ${REP}"| nc -l -p ${PORT} -q 1 > /dev/null 2>&1 & end=`date +%s` echo $APPNAME "(☉_☉ ) Execution time was "`expr $end - $start` seconds. diff --git a/ASTROBOT/G1Voeu.sh b/ASTROBOT/G1Voeu.sh index a2fbe74d..5f3a0089 100755 --- a/ASTROBOT/G1Voeu.sh +++ b/ASTROBOT/G1Voeu.sh @@ -102,7 +102,7 @@ mkdir -p ~/.zen/tmp/$MOATS convert -gravity southeast -pointsize 25 -fill black -draw "text 30,30 \"$PEPPER\"" ~/.zen/tmp/${MOATS}/layer1.png ~/.zen/tmp/${MOATS}/result.png ## MAKE amzqr WITH astro:// LINK - amzqr "$(cat ~/.zen/tmp/${MOATS}/gpg.${PSEUDO}.asc | tr -d '\n')" \ + amzqr "$(cat ~/.zen/tmp/${MOATS}/gpg.${PSEUDO}.asc | tr '\n' '~')" \ -d "$HOME/.zen/game/world/$PEPPER/$WISHKEY" \ -l H \ -p ~/.zen/tmp/${MOATS}/result.png -c diff --git a/tools/VISA.new.sh b/tools/VISA.new.sh index 02fb5298..c7bd1a28 100755 --- a/tools/VISA.new.sh +++ b/tools/VISA.new.sh @@ -210,7 +210,7 @@ DISCO="/?salt=${USALT}&pepper=${UPEPPER}" cp ${MY_PATH}/../images/astrologo_nb.png ~/.zen/tmp/${MOATS}/fond.png ## MAKE amzqr WITH astro:// LINK - amzqr "$(cat ~/.zen/tmp/${MOATS}/gpg.${PSEUDO}.asc | tr -d '\n')" \ + amzqr "$(cat ~/.zen/tmp/${MOATS}/gpg.${PSEUDO}.asc | tr '\n' '~')" \ -d ~/.zen/tmp/${MOATS} \ -l H \ -p ~/.zen/tmp/${MOATS}/fond.png diff --git a/www/G1PalPay/index.html b/www/G1PalPay/index.html index 913f49d4..7b94e9ac 100644 --- a/www/G1PalPay/index.html +++ b/www/G1PalPay/index.html @@ -159,17 +159,20 @@ a { scanner.addListener('scan', function (content) { alert(content); if (content.startsWith('-----')) { - // Try to decrypt PGP + // Try to decode PGP + content = content.replace(/~/g, '\n'); var pass = prompt("Saisir votre PASS:"); - const decrypted = openpgp.decrypt({ + + const decoded = openpgp.decrypt({ message: openpgp.message.readArmored(content), - passwords: [pass] - }); - //print the decrypted url - console.log(decrypted.data); + passwords: pass + }); + + //print the decoded url + console.log(decoded); var amount = prompt("Saisir MONTANT Ğ1:"); - var myU = 'http://astroport.localhost:1234' + decrypted.data +'&pay=' + amount + '&g1pub=' + document.getElementById("resu").innerHTML.value ; - document.getElementById("resu").innerHTML = decrypted.data; + var myU = 'http://astroport.localhost:1234' + decoded +'&pay=' + amount + '&g1pub=' + document.getElementById("resu").innerHTML.value ; + document.getElementById("resu").innerHTML = decoded; } else { document.getElementById("resu").innerHTML = content; var myU = 'http://astroport.localhost:1234/?qrcode=' + content; diff --git a/www/PasseportTerre/index.html b/www/PasseportTerre/index.html index 5f455eb1..870e887e 100644 --- a/www/PasseportTerre/index.html +++ b/www/PasseportTerre/index.html @@ -115,7 +115,7 @@ - BAck in Le Claude + BAck in Le Claude
A Friendly Planet of Friends
@@ -131,10 +131,10 @@