From c9d16af39c813ce6f1b76add0f4f06befa41023b Mon Sep 17 00:00:00 2001 From: fred Date: Sat, 4 Mar 2023 16:42:01 +0100 Subject: [PATCH] All derivative keys comes from PLAYER credentials. So, every TW (salt/pepper) will make the same Wishes Keys --- API/QRCODE.sh | 30 ++++++- API/SALT.sh | 2 +- ASTROBOT/G1Voeu.sh | 3 +- command.sh | 2 +- templates/index_gif4.html | 212 ---------------------------------------------- tools/VISA.new.sh | 14 ++- tools/cron_VRFY.sh | 7 ++ tools/ipfs_config.sh | 2 +- 8 files changed, 51 insertions(+), 221 deletions(-) delete mode 100644 templates/index_gif4.html diff --git a/API/QRCODE.sh b/API/QRCODE.sh index 746cf135..7d9a5f18 100755 --- a/API/QRCODE.sh +++ b/API/QRCODE.sh @@ -24,7 +24,6 @@ start=`date +%s` PORT=$1 THAT=$2 AND=$3 THIS=$4 APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 MOATS=$9 ### transfer variables according to script QRCODE=$THAT -URL=$THIS TYPE=$WHAT ## GET TW @@ -61,13 +60,39 @@ $MY_PATH/../tools/jaklis/jaklis.py -n $myGCHANGE -k $MYPLAYERKEY send -d "${QRCO $MY_PATH/../tools/jaklis/jaklis.py -n $myCESIUM -k $MYPLAYERKEY send -d "${QRCODE}" -t "COUCOU" -m "Rendez vous sur https://astroport.copylaradio.com/" ################################################################################################### +# THAT=$2 AND=$3 THIS=$4 APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 ### amzqr "$myASTROPORT/?qrcode=$G1PUB&sslpassdunikeysec=$PASsec&askpass=$HPass&tw=$ASTRONAUTENS" \ ### amzqr "$myASTROPORT/?qrcode=$WISHKEY&sslpassdunikeysec=$PASsec&asksalt=$HPass&flux=$VOEUNS&tw=$ASTRONAUTENS" \ +### +if [[ $AND == "sslpassdunikeysec" ]]; 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 ## TODO MAGIC QRCODE RX / TX ################################################################################################### # API TWO : ?qrcode=G1PUB&url=____&type=____ +if [[ $AND == "url" ]]; then + URL=$THIS + + if [[ $URL ]]; then ## Astroport.ONE local use QRCODE Contains ${WHAT} G1PUB g1pubpath=$(grep $QRCODE ~/.zen/game/players/*/.g1pub | cut -d ':' -f 1 2>/dev/null) @@ -80,7 +105,6 @@ $MY_PATH/../tools/jaklis/jaklis.py -n $myCESIUM -k $MYPLAYERKEY send -d "${QRCOD && exit 1 ## Demande de copie d'une URL reçue. - if [[ $URL ]]; then [[ ${TYPE} ]] && CHOICE="${TYPE}" || CHOICE="Youtube" ## CREATION TIDDLER "G1Voeu" G1CopierYoutube @@ -107,4 +131,4 @@ $MY_PATH/../tools/jaklis/jaklis.py -n $myCESIUM -k $MYPLAYERKEY send -d "${QRCOD (echo "$HTTPCORS ERROR - ${AND} - ${THIS} UNKNOWN" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1 fi - +fi diff --git a/API/SALT.sh b/API/SALT.sh index 12d87672..3ff4bd75 100755 --- a/API/SALT.sh +++ b/API/SALT.sh @@ -167,7 +167,7 @@ PEPPER=$THIS # CREATE PLAYER : ?salt=PHRASE%20UNE&pepper=PHRASE%20DEUX&g1pub=on&email=EMAIL&pseudo=PROFILENAME # WHAT can contain urlencoded FullURL - EMAIL="${VAL}" + EMAIL="${VAL,,}" # lowercase [[ ! ${EMAIL} ]] && (echo "$HTTPCORS ERROR - MISSING ${EMAIL} FOR ${WHAT} CONTACT" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && echo "(☓‿‿☓) Execution time was "`expr $(date +%s) - $start` seconds. && exit 0 diff --git a/ASTROBOT/G1Voeu.sh b/ASTROBOT/G1Voeu.sh index 818977b3..ef5130b4 100755 --- a/ASTROBOT/G1Voeu.sh +++ b/ASTROBOT/G1Voeu.sh @@ -23,6 +23,7 @@ PSEUDO=$(cat ~/.zen/game/players/$PLAYER/.pseudo 2>/dev/null) [[ $G1PUB == "" ]] && echo "Troisième paramètre G1PUB manquant" && exit 1 [[ ! $INDEX ]] && INDEX="$HOME/.zen/game/players/$PLAYER/ipfs/moa/index.html" +echo $INDEX [[ ! -s $INDEX ]] && echo "TW $PLAYER manquant" && exit 1 echo "Working on $INDEX" @@ -51,7 +52,7 @@ mkdir -p ~/.zen/tmp/$MOATS PEPPER=$(echo "$TITRE" | sed -r 's/\<./\U&/g' | sed 's/ //g') # CapitalGluedWords echo "$PEPPER" && [[ ! $PEPPER ]] && echo "EMPTY PEPPER - ERROR" && exit 1 - echo "## keygen CLEF DE VOEUX" + echo "## keygen CLEF DE VOEUX from PLAYER : pepper + G1Voeu derivation" ${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/qrtw.dunikey "$SALT" "$PEPPER" WISHKEY=$(cat ~/.zen/tmp/qrtw.dunikey | grep "pub:" | cut -d ' ' -f 2) echo "WISHKEY (G1PUB) = $WISHKEY" diff --git a/command.sh b/command.sh index c46be362..1fce8a86 100755 --- a/command.sh +++ b/command.sh @@ -156,7 +156,7 @@ select fav in "${choices[@]}"; do "CREER UN VOEU") echo "QRCode à coller sur les lieux ou objets portant une Gvaleur" cp ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/tmp/$PLAYER.html - ${MY_PATH}/ASTROBOT/G1Voeu.sh "" "$PLAYER" "~/.zen/tmp/$PLAYER.html" + ${MY_PATH}/ASTROBOT/G1Voeu.sh "" "$PLAYER" "$HOME/.zen/tmp/$PLAYER.html" DIFF=$(diff ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/tmp/$PLAYER.html) if [[ $DIFF ]]; then MOATS=$(date -u +"%Y%m%d%H%M%S%4N") diff --git a/templates/index_gif4.html b/templates/index_gif4.html deleted file mode 100644 index d0c33c17..00000000 --- a/templates/index_gif4.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - _PLAYER_ : TW : _G1VOEU_ - - - - - - - - - - - - - - - - - - - - - - - -
-

G1_G1VOEU_

-
- -
-
- - -
-
- - - - - Entrez par le Le Claude - -

Astroport Ŋ1

- -
Une Planète à Vous
Un Internet entre Nous !
-
-
-

Un DON ? Flashez le QRCode !

- - Visitez TW "_PLAYER_" -

-

- -

Installez Cesium. Indiquez en commentaire vos "G1Talents" et les emails de vos amis qui partage(ront) votre dons.

-

/ LaSTI / G1Services by U + La♥BOX

-
-
- -
-
-

ONE WORLD

- -
- -
-
- -

La♥BOX, sauvegarde, diffuse et partage vos DATA 👍 à l'abris dans "Le Claude"

-

Powered by Astroport.ONE

- -
- Choose example: -
- - -
- - - diff --git a/tools/VISA.new.sh b/tools/VISA.new.sh index 132aa14f..3a209916 100755 --- a/tools/VISA.new.sh +++ b/tools/VISA.new.sh @@ -202,7 +202,7 @@ DISCO="https://astroport.$(myHostName)/?salt=${SALT}&pepper=${PEPPER}&logout=${P rm -f ~/.zen/tmp/${MOATS}/${PSEUDO}.sec - ASTROQR=$(ipfs add -q $HOME/.zen/game/players/${PLAYER}/logoastro_qrcode.png | tail -n 1) + ASTROQR=$(ipfs add -q $HOME/.zen/game/players/${PLAYER}/G1WorldMap_qrcode.png | tail -n 1) ### INITALISATION WIKI dans leurs répertoires de publication IPFS @@ -260,6 +260,7 @@ DISCO="https://astroport.$(myHostName)/?salt=${SALT}&pepper=${PEPPER}&logout=${P tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'MadeInZion.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion' cat ~/.zen/tmp/${MOATS}/MadeInZion.json | jq -r ".[].secret" | base16 -d > ~/.zen/tmp/${MOATS}/crypto.$G1PUB.enc.2 $MY_PATH/natools.py decrypt -f pubsec -k $HOME/.zen/game/players/${PLAYER}/secret.dunikey -i $HOME/.zen/tmp/${MOATS}/crypto.$G1PUB.enc.2 -o $HOME/.zen/tmp/${MOATS}/crypto.2 + echo "DEBUG : $(cat $HOME/.zen/tmp/${MOATS}/crypto.2)" ########### ## CRYPTO PROCESS VALIDATED [[ -s ~/.zen/tmp/${MOATS}/crypto.2 ]] && echo "NATOOLS LOADED" \ @@ -272,13 +273,22 @@ DISCO="https://astroport.$(myHostName)/?salt=${SALT}&pepper=${PEPPER}&logout=${P cat ~/.zen/Astroport.ONE/templates/data/local.gw.json | sed "s~_NID_~${NID}~g" > ~/.zen/tmp/${MOATS}/local.gw.json # Create"${PLAYER}_feed" Key - FEEDNS=$(ipfs key gen "${PLAYER}_feed") + ${MY_PATH}/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/feed.ipfskey "$SALT" "$G1PUB" + ipfs key import "${PLAYER}_feed" -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/feed.ipfskey + FEEDNS=$(ipfs key list -l | grep -w "${PLAYER}_feed" | cut -d ' ' -f 1 ) ## MAKE LightBeam Plugin Tiddler ${PLAYER}_feed # $:/plugins/astroport/lightbeams/saver/ipns/lightbeam-key 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 feed.ipfskey " + $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 "TW IPFS GATEWAY : $NID" # cat ~/.zen/tmp/${MOATS}/local.gw.json | jq -r echo "TW IPFS API : $WID" diff --git a/tools/cron_VRFY.sh b/tools/cron_VRFY.sh index a495eb3f..24054e09 100755 --- a/tools/cron_VRFY.sh +++ b/tools/cron_VRFY.sh @@ -28,6 +28,9 @@ awk -i inplace -v rmv="PATH" '!index($0,rmv)' /tmp/mycron crontest=$(cat /tmp/mycron | grep -F '20h12.process.sh') +## TODO check for Station geoposition in ~/.zen/GPS and calibrate 20H12 +cat ~/.zen/GPS 2>/dev/null && echo " TODO calibrate 20H12 with GPS" + if [[ ! $crontest ]]; then ## HEADER [[ $1 == "OFF" ]] && exit 0 @@ -38,7 +41,9 @@ if [[ ! $crontest ]]; then echo "12 20 * * * /bin/bash $MY_PATH/../20h12.process.sh > /tmp/20h12.log 2>&1" >> /tmp/newcron crontab /tmp/newcron sudo systemctl enable ipfs + sudo systemctl enable astroport sudo systemctl start ipfs + sudo systemctl start astroport echo "ASTROPORT is ON" else @@ -51,6 +56,8 @@ else crontab /tmp/newcron sudo systemctl stop ipfs sudo systemctl disable ipfs + sudo systemctl stop astroport + sudo systemctl disable astroport echo "ASTROPORT is OFF" fi diff --git a/tools/ipfs_config.sh b/tools/ipfs_config.sh index a495d4e6..2ffba0cc 100755 --- a/tools/ipfs_config.sh +++ b/tools/ipfs_config.sh @@ -40,7 +40,7 @@ ipfs config --json Swarm.ConnMgr.LowWater 20 ipfs config --json Swarm.ConnMgr.HighWater 40 [[ ! $isLAN ]] && ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://'$myIP':8080", "http://ipfs.localhost:8080", "http://127.0.0.1:8080", "http://127.0.1.1:8080", "https://ipfs.'$(hostname)'.copylaradio.com" ]' \ - || ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://'$(hostname)'.local:8080","http://'$(hostname)':8080", "http://127.0.0.1:8080", "http://ipfs.localhost:8080", "http://127.0.1.1:8080" ]' + || ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://'$myIP':8080", "http://'$(hostname)'.local:8080","http://'$(hostname)':8080", "http://127.0.0.1:8080", "http://ipfs.localhost:8080", "http://127.0.1.1:8080" ]' ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]' ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'