Astroport.ONE/RUNTIME/VISA.new.sh

654 lines
32 KiB
Bash
Raw Normal View History

#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
################################################################################
################################################################################
2022-08-23 14:41:15 +02:00
MY_PATH="`dirname \"$0\"`" # relative
2023-04-16 18:34:43 +02:00
MY_PATH="`( cd \"${MY_PATH}\" && pwd )`" # absolutized and normalized
2023-10-07 17:06:56 +02:00
. "${MY_PATH}/../tools/my.sh"
2022-08-23 14:41:15 +02:00
! ipfs swarm peers >/dev/null 2>&1 && echo "Lancez 'ipfs daemon' SVP" && exit 1
################################################################################
2023-12-12 14:08:35 +01:00
[[ ! ${MOATS} ]] && MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
mkdir -p ~/.zen/tmp/${MOATS}
2022-08-20 17:12:15 +02:00
SALT="$1"
PEPPER="$2"
2022-10-10 18:06:37 +02:00
PLAYER="$3"
PSEUDO="$4"
2023-10-09 10:52:18 +02:00
## Fill UP TW with VIDEO URL or UMAP NS
URL="$5"
2023-10-09 10:52:18 +02:00
## UPLANET SECTOR
LAT="$6"
LON="$7"
################################################################################
2022-12-29 14:51:05 +01:00
YOU=$(myIpfsApi);
2023-04-16 18:34:43 +02:00
LIBRA=$(head -n 2 ${MY_PATH}/../A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
################################################################################
2023-10-09 10:52:18 +02:00
## LIST TW MODELS
################################################################################
2024-03-06 02:36:14 +01:00
TWMODEL="/ipfs/bafybeid7xwuqkgyiffehs77x3wky3dghjncxepr5ln6dewapgvbwrqi7n4"
2023-10-09 10:52:18 +02:00
# ipfs cat $TWMODEL > templates/twdefault.html
2024-03-10 16:01:16 +01:00
TWUPLANET="/ipfs/bafybeib4cl7ud7nih4bkr4cnrdiajhutreamgmrly46x45ldqfkrr2xpne"
# ipfs cat $TWUPLANET > templates/twuplanet.html
################################################################################
2022-08-20 17:12:15 +02:00
2023-01-13 18:06:14 +01:00
mkdir -p ~/.zen/tmp/${MOATS}/TW
2022-08-22 17:38:25 +02:00
## Chargement TW !!!
if [[ $SALT != "" && PEPPER != "" ]]; then
2023-10-09 10:52:18 +02:00
## Creating SALT/PEPPER IPNS KEY
2023-10-07 17:03:01 +02:00
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/player.key "$SALT" "$PEPPER" 2>/dev/null
ASTRONAUTENS=$(ipfs key import ${MOATS} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/player.key 2>/dev/null)
2022-12-08 23:19:09 +01:00
# echo "/ipns/${ASTRONAUTENS}"
2022-08-22 17:38:25 +02:00
2023-04-08 12:18:27 +02:00
echo "SCANNING /ipns/${ASTRONAUTENS} for 180s"
## GETTING LAST TW via IPFS or HTTP GW
[[ $YOU ]] \
2023-04-08 12:18:27 +02:00
&& ipfs --timeout 180s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/${MOATS}/TW/index.html
2024-01-11 16:59:16 +01:00
[[ $XDG_SESSION_TYPE == 'x11' || $XDG_SESSION_TYPE == 'wayland' ]] \
2023-04-08 12:18:27 +02:00
&& [[ -s ~/.zen/tmp/${MOATS}/TW/index.html ]] \
&& echo "TW FOUND ENTER 'yes' TO RESET TW. HIT ENTER TO KEEP IT." \
2023-04-08 12:18:27 +02:00
&& read ENTER \
&& [[ $ENTER != "" ]] && rm ~/.zen/tmp/${MOATS}/TW/index.html
2023-10-09 10:52:18 +02:00
# EXTEND SEARCH IN WEB2.0
2023-04-08 12:18:27 +02:00
#~ [[ ! -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
if [ ! -s ~/.zen/tmp/${MOATS}/TW/index.html ]; then
2022-08-22 17:38:25 +02:00
2023-10-09 10:52:18 +02:00
# COPY TW TEMPLATE
2023-10-07 15:58:55 +02:00
[[ ${LON} && ${LAT} ]] \
2024-01-14 19:05:53 +01:00
&& cp ${MY_PATH}/../templates/twuplanet.html ~/.zen/tmp/${MOATS}/TW/index.html \
2023-10-07 15:58:55 +02:00
|| cp ${MY_PATH}/../templates/twdefault.html ~/.zen/tmp/${MOATS}/TW/index.html
2022-10-10 18:06:37 +02:00
else
#############################################
2023-01-12 16:20:47 +01:00
# EXISTING TW : DATA TESTING & CACHE
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)
HPass=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].HPASS)
echo "ASTROPORT=${ASTROPORT}"
2023-04-16 18:34:43 +02:00
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)
2024-03-06 20:16:55 +01:00
[[ -z $HPass ]] && HPass=$(cat ~/.zen/tmp/${MOATS}/AstroID.json | jq -r .[].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)
echo "ZenCard=$ZenCard"
if [[ ${ASTROPORT} != "" && ${ASTROPORT} != "null" ]]; then
IPNSTAIL=$(echo ${ASTROPORT} | rev | cut -f 1 -d '/' | rev) # Remove "/ipns/" part
2022-12-09 15:55:27 +01:00
echo "TW ASTROPORT GATEWAY : ${ASTROPORT}"
2023-02-27 02:42:02 +01:00
echo "---> CONNECTING PLAYER $(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].pseudo) TW NOW with $IPFSNODEID"
2022-12-25 22:52:32 +01:00
else
2022-10-10 18:06:37 +02:00
2023-04-08 12:18:27 +02:00
echo ">> NO ACTIVE TW - CREATING FRESH NEW ONE"
2023-04-16 18:34:43 +02:00
cp ${MY_PATH}/../templates/twdefault.html ~/.zen/tmp/${MOATS}/TW/index.html
fi
fi
2022-08-22 17:38:25 +02:00
2023-10-09 10:52:18 +02:00
ipfs key rm ${MOATS} 2>/dev/null ## CLEANING MOATS KEY
2022-08-22 17:38:25 +02:00
fi
2023-01-13 18:06:14 +01:00
##################################################### # NEW PLAYER ###############
################################################################################
2023-10-03 22:50:59 +02:00
#~ echo "=============================================
#~ ASTROPORT DIPLOMATIC PASSPORT - MadeInZion VISA -
#~ =============================================
#~ A Cryptographic Key to control your INTERNET
#~ Adventure & Exploration P2P Terraforming Game.
#~ =============================================
#~ WELCOME 'Astronaute'"; # sleep 1
2023-09-08 14:36:47 +02:00
#~ echo "Inscription..."
2023-11-18 00:40:18 +01:00
[[ $SALT == "" ]] && SALT=$(${MY_PATH}/../tools/diceware.sh 4 | xargs)
2023-10-03 22:50:59 +02:00
#~ echo "-> ID : $SALT"
2023-11-18 00:40:18 +01:00
[[ $PEPPER == "" ]] && PEPPER=$(${MY_PATH}/../tools/diceware.sh 2 | xargs)
2023-10-03 22:50:59 +02:00
#~ echo "-> PASS : $PEPPER"
2023-11-26 17:44:03 +01:00
[[ ! $PSEUDO ]] && PSEUDO=${PLAYER%%[0-9]*}
[[ ! $PSEUDO ]] && PSEUDO="Anonymous"
2023-01-12 16:20:47 +01:00
[[ $(ls ~/.zen/game/players/$PSEUDO 2>/dev/null) ]] && echo "$PSEUDO EST DEJA UN PLAYER. EXIT" && exit 1
2022-10-10 18:06:37 +02:00
2022-04-26 14:16:57 +02:00
# PSEUDO=${PSEUDO,,} #lowercase
2023-11-18 00:40:18 +01:00
[[ ! ${PLAYER} ]] && PLAYER=${PSEUDO}${RANDOM:0:3}@$(${MY_PATH}/../tools/diceware.sh 1 | xargs).${RANDOM:0:3} \
2022-12-13 16:20:58 +01:00
&& echo "ADRESSE EMAIL ?" && read OPLAYER && [[ $OPLAYER ]] && PLAYER=$OPLAYER
2022-12-13 16:24:13 +01:00
2023-01-12 16:20:47 +01:00
PLAYER=${PLAYER,,}
2023-10-09 10:52:18 +02:00
# 4 DIGIT PASS CODE TO PROTECT QRSEC
PASS=$(echo "${RANDOM}${RANDOM}${RANDOM}${RANDOM}" | tail -c-5)
2022-04-26 14:16:57 +02:00
############################################################
2022-08-15 19:07:39 +02:00
######### TODO Ajouter d'autres clefs IPNS, GPG ?
2023-01-03 18:42:41 +01:00
# MOANS=$(ipfs key gen moa_${PLAYER})
# MOAKEYFILE=$(${MY_PATH}/give_me_keystore_filename.py "moa_${PLAYER}")
# echo "Coffre personnel multimedia journalisé dans votre 'Astroport' (amis de niveau 3)"
2023-01-03 18:42:41 +01:00
# echo "Votre clef moa_${PLAYER} <=> $MOANS ($MOAKEYFILE)"; sleep 2
2022-08-15 19:07:39 +02:00
############################################################
2022-04-26 14:16:57 +02:00
2023-10-07 17:03:01 +02:00
${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/${MOATS}/secret.dunikey "$SALT" "$PEPPER"
2022-07-07 13:44:45 +02:00
2022-12-09 15:55:27 +01:00
G1PUB=$(cat ~/.zen/tmp/${MOATS}/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
2022-04-26 14:16:57 +02:00
2023-05-02 01:29:35 +02:00
[[ ! $G1PUB ]] && echo "Désolé. clef Cesium absente. ERROR" && exit 1
2022-08-15 19:07:39 +02:00
## CREATE Player personnal files storage and IPFS publish directory
2023-11-28 14:54:27 +01:00
mkdir -p ~/.zen/game/players/${PLAYER}/.ipfs # Prepare PLAYER datastructure
echo "/ip4/127.0.0.1/tcp/5001" > ~/.zen/game/players/${PLAYER}/.ipfs/api
2022-04-26 14:16:57 +02:00
# PLAYER=geg-la_debrouille@super.chez-moi.com
2023-01-03 18:42:41 +01:00
YUSER=$(echo ${PLAYER} | cut -d '@' -f1) # YUSER=geg-la_debrouille
LYUSER=($(echo "$YUSER" | sed 's/[^a-zA-Z0-9]/\ /g')) # LYUSER=(geg la debrouille)
CLYUSER=$(printf '%s\n' "${LYUSER[@]}" | tac | tr '\n' '.' ) # CLYUSER=debrouille.la.geg.
2023-01-03 18:42:41 +01:00
YOMAIN=$(echo ${PLAYER} | cut -d '@' -f 2) # YOMAIN=super.chez-moi.com
2022-12-30 23:46:13 +01:00
# echo "NEXT STYLE GW : https://ipfs.$CLYUSER$YOMAIN.$(myHostName)"
2022-12-30 22:55:10 +01:00
# echo "MY PLAYER API GW : $(myPlayerApiGw)"
2022-12-29 14:51:05 +01:00
NID="${myIPFS}"
2024-03-06 22:35:35 +01:00
#~ WID="https://ipfs.$CLYUSER$YOMAIN.$(myHostName)/api" ## Next Generation API # TODO PLAYER IPFS Docker entrance
#~ WID="https://ipfs.$(myHostName)/api"
#~ WID="https://ipfs.$(myHostName)/api"
2023-09-03 00:29:00 +02:00
WID="${myAPI}" ## https://ipfs.libra.copylaradio.com
USALT=$(echo "$SALT" | jq -Rr @uri)
UPEPPER=$(echo "$PEPPER" | jq -Rr @uri)
DISCO="/?salt=${USALT}&pepper=${UPEPPER}"
2022-12-30 22:55:10 +01:00
2023-01-20 15:17:02 +01:00
[[ $isLAN ]] && NID="http://ipfs.localhost:8080" \
2024-03-06 22:35:35 +01:00
&& WID="http://ipfs.localhost:5001"
2022-12-12 22:17:55 +01:00
####
2024-03-06 20:16:55 +01:00
## MOVE secret.dunikey IN PLAYER DIRECTORY
2023-01-03 18:42:41 +01:00
mv ~/.zen/tmp/${MOATS}/secret.dunikey ~/.zen/game/players/${PLAYER}/
2022-08-15 19:07:39 +02:00
# Create Player "IPNS Key" (key import)
2024-03-06 20:16:55 +01:00
ipfs key rm ${PLAYER} 2>/dev/null
2023-10-07 17:03:01 +02:00
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/game/players/${PLAYER}/secret.player "$SALT" "$PEPPER"
2023-09-08 02:14:10 +02:00
TWNS=$(ipfs key import ${PLAYER} -f pem-pkcs8-cleartext ~/.zen/game/players/${PLAYER}/secret.player)
2023-01-03 18:42:41 +01:00
ASTRONAUTENS=$(ipfs key import $G1PUB -f pem-pkcs8-cleartext ~/.zen/game/players/${PLAYER}/secret.player)
2022-08-15 19:07:39 +02:00
mkdir -p ~/.zen/game/players/${PLAYER}/ipfs/G1SSB # Prepare astrXbian sub-datastructure "old scarf code"
qrencode -s 12 -o ~/.zen/game/players/${PLAYER}/QR.png "$G1PUB" ## Check by VISA.print.sh
cp ~/.zen/game/players/${PLAYER}/QR.png ~/.zen/game/players/${PLAYER}/ipfs/QR.png
echo "$G1PUB" > ~/.zen/game/players/${PLAYER}/ipfs/G1SSB/_g1.pubkey # G1SSB NOTATION (astrXbian compatible)
2022-04-26 14:16:57 +02:00
2023-11-23 19:38:50 +01:00
qrencode -s 12 -o ~/.zen/game/players/${PLAYER}/QR.ASTRONAUTENS.png "$myLIBRA/ipns/${ASTRONAUTENS}"
2022-12-25 22:20:50 +01:00
2023-03-25 19:49:45 +01:00
############################################################################
## SEC PASS PROTECTED QRCODE : base58 secret.june / openssl(pass)
#~ secFromDunikey=$(cat ~/.zen/game/players/${PLAYER}/secret.dunikey | grep "sec" | cut -d ' ' -f2)
#~ echo "$secFromDunikey" > ~/.zen/tmp/${MOATS}/${PSEUDO}.sec
2023-03-25 19:49:45 +01:00
## PGP ENCODING SALT/PEPPER API ACCESS
echo "${DISCO}" > ~/.zen/tmp/${MOATS}/topgp
cat ~/.zen/tmp/${MOATS}/topgp | gpg --symmetric --armor --batch --passphrase "$PASS" -o ~/.zen/tmp/${MOATS}/gpg.${PSEUDO}.asc
rm ~/.zen/tmp/${MOATS}/topgp
2023-03-25 19:49:45 +01:00
#~ openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 100000 -salt -in ~/.zen/game/players/${PLAYER}/secret.june -out "$HOME/.zen/tmp/${MOATS}/enc.${PSEUDO}.sec" -k "$PASS"
#~ PASsec=$(cat ~/.zen/tmp/${MOATS}/enc.${PSEUDO}.sec | base64 -w 0 | jq -sRr '@uri' )
#~ HPass=$(echo "$PASS" | sha512sum | cut -d ' ' -f 1)
#~ qrencode -s 12 -o $HOME/.zen/game/players/${PLAYER}/QRsec.png $PASsec
## Add logo to QRCode
2023-03-06 19:22:13 +01:00
cp ${MY_PATH}/../images/astrologo_nb.png ~/.zen/tmp/${MOATS}/fond.png
2024-03-06 20:16:55 +01:00
## ASTROID ~~~~~
ASTROIDQR="$(cat ~/.zen/tmp/${MOATS}/gpg.${PSEUDO}.asc | tr '-' '~' | tr '\n' '-' | tr '+' '_' | jq -Rr @uri )"
## MAKE amzqr ASTROID PGP QRCODE
amzqr "${ASTROIDQR}" \
2023-03-16 21:14:45 +01:00
-d ~/.zen/tmp/${MOATS} \
2023-03-02 23:48:10 +01:00
-l H \
2023-04-24 21:42:32 +02:00
-p ~/.zen/tmp/${MOATS}/fond.png 1>/dev/null
2023-02-27 20:10:31 +01:00
2023-03-16 21:14:45 +01:00
## ADD PLAYER EMAIL
convert -gravity northwest -pointsize 28 -fill black -draw "text 5,5 \"$PLAYER\"" ~/.zen/tmp/${MOATS}/fond_qrcode.png ~/.zen/game/players/${PLAYER}/result_qrcode.png
2023-04-24 19:20:43 +02:00
convert ~/.zen/game/players/${PLAYER}/result_qrcode.png -resize 480 ~/.zen/game/players/${PLAYER}/AstroID.png
2023-03-16 21:14:45 +01:00
2023-04-24 19:20:43 +02:00
ASTROQR="/ipfs/$(ipfs add -q $HOME/.zen/game/players/${PLAYER}/AstroID.png | tail -n 1)"
2023-03-04 18:34:16 +01:00
############################################################################ TW
### INITALISATION WIKI dans leurs répertoires de publication IPFS
mkdir -p ~/.zen/game/players/${PLAYER}/ipfs/moa/
2023-04-16 18:34:43 +02:00
[[ ! -s ~/.zen/tmp/${MOATS}/TW/index.html ]] && cp ${MY_PATH}/../templates/twdefault.html ~/.zen/tmp/${MOATS}/TW/index.html
2023-01-12 16:20:47 +01:00
sed "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/tmp/${MOATS}/TW/index.html > ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
# INSERT ASTROPORT ADDRESS
2023-01-03 18:42:41 +01:00
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'
2022-12-09 15:55:27 +01:00
ASTROPORT=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].astroport)
sed -i "s~${ASTROPORT}~/ipns/${IPFSNODEID}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
# TW CHAIN INIT WITH TWMODEL
2023-01-03 18:42:41 +01:00
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~_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
HPASS=$(echo $PASS | sha512sum | cut -d ' ' -f 1)
2023-04-16 18:34:43 +02:00
[[ ${HPass} != "" ]] && SRCPASS=${HPass} || SRCPASS="_HPASS_"
sed -i "s~${SRCPASS}~${HPASS}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
2022-12-09 15:55:27 +01:00
## RESET WISHES TO DEPLOY DERIVATED KEYS ON HOST AGAIN ( DONE IN PLAYER_REFRESH )
#~ sed -i "s~G1Voeu~voeu~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
2024-02-22 23:17:07 +01:00
## Fill LNK - Tiddler - escape \&
sed -i "s~_URL_~$(echo "${URL}" | sed 's/[&/]/\\&/g')~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
2022-12-08 19:43:30 +01:00
# INSERT PLAYER DATA
2023-01-03 18:42:41 +01:00
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
2022-08-18 18:32:01 +02:00
2023-01-03 18:42:41 +01:00
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
2022-09-07 16:32:05 +02:00
2022-08-18 03:47:49 +02:00
ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
2023-01-12 16:20:47 +01:00
# La Clef IPNS porte comme nom G1PUB et ${PLAYER}
2023-01-03 18:42:41 +01:00
sed -i "s~_MEDIAKEY_~${PLAYER}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
sed -i "s~k2k4r8kxfnknsdf7tpyc46ks2jb3s9uvd3lqtcv9xlq9rsoem7jajd75~${ASTRONAUTENS}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
sed -i "s~_ASTRONAUTENS_~/ipns/${ASTRONAUTENS}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
2024-03-06 01:55:54 +01:00
## POPULATE CESIUM TID
sed -i "s~_CESIUMIPFS_~${CESIUMIPFS}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
2023-12-02 22:26:31 +01:00
## AstroID Tiddler UPGRADE
cat ${MY_PATH}/../templates/data/AstroID.json \
| sed -e "s~/ipfs/bafybeifbebc3ewnzrzbm44arddedbralegnxklhua5d5ymzaqtf2kaub7i~${ASTROQR}~g" \
-e "s~_PLAYER_~${PLAYER}~g" \
-e "s~_G1PUB_~${G1PUB}~g" \
-e "s~_ASTRONAUTENS_~${ASTRONAUTENS}~g" \
-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
2023-01-03 18:42:41 +01:00
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
2022-08-23 14:24:18 +02:00
## PREPARE UMAP LAT LON replacement
[[ ! ${LAT} ]] && LAT="0.00"
[[ ! ${LON} ]] && LON="0.00"
2023-10-23 15:06:58 +02:00
SECTOR="_${LAT::-1}_${LON::-1}" ### SECTOR = 0.1° Planet Slice in MadeInZion Tiddler
echo "UPlanet 0.1° SECTOR : ${SECTOR}"
2023-10-23 15:06:58 +02:00
sed -i "s~_SECTOR_~${SECTOR}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
2022-10-10 14:49:47 +02:00
UMAPNS=$(${MY_PATH}/../tools/keygen -t ipfs "${TODATE}${UPLANETNAME}${LAT}" "${TODATE}${UPLANETNAME}${LON}")
UMAP="/ipns/${UMAPNS}"
# GET ACTUAL GPS VALUES
tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
--output ~/.zen/tmp/${MOATS} \
--render '.' 'GPS.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'GPS'
2024-02-11 13:38:33 +01:00
OLAT=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].lat)
OLON=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].lon)
OUMAP=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].umap)
# REPLACE WITH NEW LAT LON UMAP
sed -i "s~${OLAT}~${LAT}~g" ~/.zen/tmp/${MOATS}/GPS.json
sed -i "s~${OLON}~${LON}~g" ~/.zen/tmp/${MOATS}/GPS.json
sed -i "s~${OUMAP}~${UMAP}~g" ~/.zen/tmp/${MOATS}/GPS.json
## Add _SECTORTW_
cat ~/.zen/tmp/${MOATS}/GPS.json | jq '.[0] + {"sectortw": "_SECTORTW_"}' \
> ~/.zen/tmp/${MOATS}/GPStw.json \
&& mv ~/.zen/tmp/${MOATS}/GPStw.json ~/.zen/tmp/${MOATS}/GPS.json
## INSERT TODATESECTORNS #########################################
TODATESECTORNS=$(${MY_PATH}/../tools/keygen -t ipfs "${TODATE}${UPLANETNAME}${SECTOR}" "${TODATE}${UPLANETNAME}${SECTOR}")
sed -i "s~_SECTORTW_~/ipns/${TODATESECTORNS}/TW~g" ~/.zen/tmp/${MOATS}/GPS.json
2024-02-08 15:58:36 +01:00
2022-12-09 15:55:27 +01:00
###########
## GET OLD16
2024-03-06 20:16:55 +01:00
tiddlywiki \
--load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
--output ~/.zen/tmp/${MOATS} \
--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_"
2024-03-06 20:16:55 +01:00
# TODO : NODE COULD FORGET PASS THEN DECODE ${PLAYER}/secret.dunikey FROM TW # PROD #
2023-05-02 01:17:22 +02:00
MACHINEPUB=$(cat $HOME/.zen/game/myswarm_secret.dunikey | grep pub | cut -d ' ' -f 2)
2023-01-12 16:20:47 +01:00
2024-03-06 20:16:55 +01:00
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 \
-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
# IN CASE ORIGINAL STATION NEEDS ACCESS # COULD BE REMOVED ?
###########
#~ echo "# CRYPTO DECODING TESTING..."
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}/../tools/natools.py decrypt \
-f pubsec \
-k $HOME/.zen/game/myswarm_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 STATION TW KEY " \
|| echo "NATOOLS ERRORS - CHECK STATION" # MACHINEPUB CRYPTO ERROR
else
echo " - WARNING - NATOOLS BYPASS - WARNING -"
fi
########### SECTOR = 0.1° UPLANET SLICE
OSECTOR=$(cat ~/.zen/tmp/${MOATS}/MadeInZion.json | jq -r .[].sector)
[[ ${OSECTOR} != "null" ]] && sed -i "s~${OSECTOR}~${SECTOR}~g" ~/.zen/tmp/${MOATS}/MadeInZion.json
2022-11-17 17:16:01 +01:00
2023-04-24 22:41:43 +02:00
### CREATE ${NID} ADDRESS FOR API & ROUND ROBIN FOR GW
2023-04-16 18:34:43 +02:00
cat ${MY_PATH}/../templates/data/local.api.json | sed "s~_NID_~${WID}~g" > ~/.zen/tmp/${MOATS}/local.api.json
cat ${MY_PATH}/../templates/data/local.gw.json | sed "s~_NID_~${NID}~g" > ~/.zen/tmp/${MOATS}/local.gw.json
2023-01-01 19:55:15 +01:00
2023-11-24 02:41:09 +01:00
# Create"${PLAYER}_feed" Key ! DERIVATED ! "$SALT" "$PEPPER $G1PUB"
2024-03-06 02:36:14 +01:00
ipfs key rm "${PLAYER}_feed" 2>/dev/null
2023-11-24 02:41:09 +01:00
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/feed.ipfskey "$SALT" "$PEPPER $G1PUB"
2023-09-08 02:14:10 +02:00
FEEDNS=$(ipfs key import "${PLAYER}_feed" -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/feed.ipfskey)
2023-09-08 14:36:47 +02:00
2023-01-03 18:42:41 +01:00
## MAKE LightBeam Plugin Tiddler ${PLAYER}_feed
2022-12-11 18:51:48 +01:00
# $:/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
2023-09-03 02:26:43 +02:00
#~ echo "# NATOOLS ENCODING MYSELF feed.ipfskey (TODO: could be decoded to compare with G1lib.js) "
2023-04-16 18:34:43 +02:00
${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)
2023-04-24 22:41:43 +02:00
#~ echo ${ENCODING}
echo '[{"title":"$:/plugins/astroport/lightbeams/saver/g1/lightbeam-natools-feed","text":"'${ENCODING}'","tags":""}]' > ~/.zen/tmp/${MOATS}/lightbeam-natools.json
2023-10-03 22:50:59 +02:00
#~ 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
2023-01-01 19:06:24 +01:00
2022-09-06 03:53:10 +02:00
## ADD SYSTEM TW
2023-01-03 18:42:41 +01:00
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" \
2023-12-02 22:26:31 +01:00
--import ~/.zen/tmp/${MOATS}/AstroID.json "application/json" \
--import ~/.zen/tmp/${MOATS}/MadeInZion.json "application/json" \
2023-04-16 18:34:43 +02:00
--import "${MY_PATH}/../templates/tw/\$ _ipfs_saver_api.json" "application/json" \
--import "${MY_PATH}/../templates/tw/\$ _ipfs_saver_gateway.json" "application/json" \
2023-01-12 16:20:47 +01:00
--output ~/.zen/tmp/${MOATS} --render "$:/core/save/all" "tw.html" "text/plain"
2023-01-01 19:06:24 +01:00
## COPY TO LOCAL & 12345 IPFSNODEID MAP
2023-01-12 16:20:47 +01:00
[[ -s ~/.zen/tmp/${MOATS}/tw.html ]] \
&& cp -f ~/.zen/tmp/${MOATS}/tw.html ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
&& mkdir -p ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER} \
&& cp ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/ \
2023-01-12 16:20:47 +01:00
|| ( echo "Problem with TW - EXIT" && exit 1 )
2022-08-15 19:07:39 +02:00
2023-05-02 01:17:22 +02:00
############################################################################ G1TW
#### MAKE G1TW
[[ -s ~/.zen/G1BILLET/MAKE_G1BILLET.sh ]] && \
2023-11-24 02:41:09 +01:00
~/.zen/G1BILLET/MAKE_G1BILLET.sh "$SALT" "$PEPPER" "___" "$G1PUB" "${PASS}" "${PSEUDO-xastro}" "$ASTRONAUTENS" "$PLAYER"
2023-05-02 01:17:22 +02:00
#### MADE # BILLETNAME=$(echo "$SALT" | sed 's/ /_/g') ##
# IMAGE ~/.zen/G1BILLET/tmp/g1billet/${PASS}/${BILLETNAME}.BILLET.jpg
############################################################################
2023-03-04 18:34:16 +01:00
## MAKE IMAGE AVATAR WITH G1PUB QRCODE
if [[ $(which amzqr) ]]; then
2023-04-16 18:34:43 +02:00
GIMG="${MY_PATH}/../images/moa_net.png"
2023-11-24 02:41:09 +01:00
CIMG="${MY_PATH}/../images/zenticket.png"
2023-03-04 18:34:16 +01:00
# QRG1avatar.png
2024-02-02 19:32:36 +01:00
[[ ! -s ~/.zen/game/players/${PLAYER}/QRG1avatar.png ]] && amzqr "${G1PUB}" -l H -p "$CIMG" -c -n QRG1avatar.png -d ~/.zen/game/players/${PLAYER}/ 1>/dev/null
2023-03-04 18:34:16 +01:00
# QRTWavatar.png
2023-11-24 02:41:09 +01:00
[[ ! -s ~/.zen/game/players/${PLAYER}/QRTWavatar.png ]] && amzqr "${myIPFSGW}/ipns/${ASTRONAUTENS}" -l H -p "$GIMG" -c -n QRTWavatar.png -d ~/.zen/game/players/${PLAYER}/ 1>/dev/null
2023-03-04 18:34:16 +01:00
else
[[ ! -s ~/.zen/game/players/${PLAYER}/QRG1avatar.png ]] \
&& cp ~/.zen/game/players/${PLAYER}/QR.png ~/.zen/game/players/${PLAYER}/QRG1avatar.png
[[ ! -s ~/.zen/game/players/${PLAYER}/QRTWavatar.png ]] \
&& cp ~/.zen/game/players/${PLAYER}/QR.ASTRONAUTENS.png ~/.zen/game/players/${PLAYER}/QRTWavatar.png
fi
2022-12-09 15:55:27 +01:00
## ID CARD & QRCODE
2023-05-02 01:34:49 +02:00
convert ~/.zen/game/players/${PLAYER}/QRG1avatar.png -resize 300 ~/.zen/tmp/${MOATS}/QR.png 2>/dev/null
convert ~/.zen/game/players/${PLAYER}/QRTWavatar.png -resize 240 ~/.zen/tmp/${MOATS}/TW.png 2>/dev/null
convert ${MY_PATH}/../images/astroport.jpg -resize 240 ~/.zen/tmp/${MOATS}/ASTROPORT.png 2>/dev/null
2022-12-25 22:20:50 +01:00
2022-08-22 17:38:25 +02:00
2023-05-02 01:34:49 +02:00
composite -compose Over -gravity SouthEast -geometry +5+5 ~/.zen/tmp/${MOATS}/ASTROPORT.png ${MY_PATH}/../images/Brother_600x400.png ~/.zen/tmp/${MOATS}/astroport.png 2>/dev/null
composite -compose Over -gravity NorthEast -geometry +10+55 ~/.zen/tmp/${MOATS}/TW.png ~/.zen/tmp/${MOATS}/astroport.png ~/.zen/tmp/${MOATS}/astroport2.png 2>/dev/null
composite -compose Over -gravity NorthWest -geometry +0+0 ~/.zen/tmp/${MOATS}/QR.png ~/.zen/tmp/${MOATS}/astroport2.png ~/.zen/tmp/${MOATS}/one.png 2>/dev/null
2023-04-20 04:52:07 +02:00
convert -gravity SouthWest -pointsize 12 -fill black -draw "text 5,3 \"$G1PUB\"" ~/.zen/tmp/${MOATS}/one.png ~/.zen/tmp/${MOATS}/txt.png
2022-12-09 15:55:27 +01:00
# composite -compose Over -gravity NorthWest -geometry +280+280 ~/.zen/game/players/.current/QRsec.png ~/.zen/tmp/${MOATS}/one.png ~/.zen/tmp/${MOATS}/image.png
2022-08-22 17:38:25 +02:00
2023-04-20 04:52:07 +02:00
convert -gravity northwest -pointsize 25 -fill black -draw "text 50,300 \"$PSEUDO\"" ~/.zen/tmp/${MOATS}/txt.png ~/.zen/tmp/${MOATS}/image.png
2023-04-08 12:18:27 +02:00
convert -gravity northwest -pointsize 20 -fill black -draw "text 300,40 \"${PLAYER}\"" ~/.zen/tmp/${MOATS}/image.png ~/.zen/tmp/${MOATS}/pseudo.png
2022-12-25 22:20:50 +01:00
2023-04-08 12:18:27 +02:00
## WITH CONFIDENTIAL (LOCAL PRINT)
2022-12-09 15:55:27 +01:00
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
2023-01-03 18:42:41 +01:00
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,140 \"$PEPPER\"" ~/.zen/tmp/${MOATS}/salt.png ~/.zen/game/players/${PLAYER}/ID.png
2022-08-22 17:38:25 +02:00
# INSERTED IMAGE IPFS
# IASTRO=$(ipfs add -Hq ~/.zen/game/players/${PLAYER}/ID.png | tail -n 1) ## ZENCARD PUBLIC / PRIVATE
IASTRO="/ipfs/$(ipfs add -Hq ~/.zen/tmp/${MOATS}/pseudo.png | tail -n 1)" ## ZENCARD PUBLIC ONLY
## Update ZenCard
[[ ! $ZenCard ]] && ZenCard="/ipfs/bafybeidhghlcx3zdzdah2pzddhoicywmydintj4mosgtygr6f2dlfwmg7a"
sed -i "s~${ZenCard}~${IASTRO}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
2022-08-18 18:32:01 +02:00
2022-11-21 18:58:03 +01:00
echo
2023-10-03 22:50:59 +02:00
echo "♥ IPFS Ŋ1 TW INIT ♥"
2023-04-24 22:41:43 +02:00
echo "TW ${NID}/ipns/${ASTRONAUTENS}/"
2023-01-03 18:42:41 +01:00
IPUSH=$(ipfs add -Hq ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html | tail -n 1)
echo $IPUSH > ~/.zen/game/players/${PLAYER}/ipfs/moa/.chain # Contains last IPFS backup PLAYER KEY
echo $MOATS > ~/.zen/game/players/${PLAYER}/ipfs/moa/.moats
2022-11-21 18:58:03 +01:00
(
2023-04-24 21:42:32 +02:00
#~ echo "$MOATS :: /ipfs/$IPUSH"
2023-04-16 18:34:43 +02:00
ipfs name publish --key=${PLAYER} /ipfs/$IPUSH
2023-04-24 21:42:32 +02:00
#~ echo "TW PUBLISHING DONE"
2022-11-21 18:58:03 +01:00
) &
2022-08-15 19:07:39 +02:00
## MEMORISE PLAYER Ŋ1 ZONE
2023-01-03 18:42:41 +01:00
echo "${PLAYER}" > ~/.zen/game/players/${PLAYER}/.player
echo "$PSEUDO" > ~/.zen/game/players/${PLAYER}/.pseudo
echo "$G1PUB" > ~/.zen/game/players/${PLAYER}/.g1pub
2022-05-07 18:53:11 +02:00
2023-01-03 18:42:41 +01:00
echo "${ASTRONAUTENS}" > ~/.zen/game/players/${PLAYER}/.playerns
2022-05-05 04:12:07 +02:00
2023-02-09 13:04:15 +01:00
echo "SALT=\"$SALT\"" > ~/.zen/game/players/${PLAYER}/secret.june
echo "PEPPER=\"$PEPPER\"" >> ~/.zen/game/players/${PLAYER}/secret.june
2023-04-24 22:41:43 +02:00
#~ echo; echo "Création Clefs et QR codes pour accès au niveau Astroport Ŋ1"; sleep 1
2023-10-03 22:50:59 +02:00
echo "--- PLAYER : ${PLAYER} - DATA PROTOCOL LAYER LOADED";
2023-01-13 18:36:02 +01:00
# ls ~/.zen/game/players/${PLAYER}
2024-01-11 16:59:16 +01:00
[[ $XDG_SESSION_TYPE == 'x11' || $XDG_SESSION_TYPE == 'wayland' ]] && xdg-open "${myIPFS}/ipns/${ASTRONAUTENS}" && espeak "YOUR PASS IS $PASS"
2022-12-13 16:51:00 +01:00
2024-03-08 14:43:30 +01:00
####### NO CURRENT ? PLAYER = .current
[[ ! -e ~/.zen/game/players/.current ]] \
&& rm ~/.zen/game/players/.current 2>/dev/null \
2024-03-08 14:43:30 +01:00
&& ln -s ~/.zen/game/players/${PLAYER} ~/.zen/game/players/.current
2023-10-07 17:21:16 +02:00
. "${MY_PATH}/../tools/my.sh"
2022-12-30 23:46:13 +01:00
2023-01-01 20:19:12 +01:00
#################################################################
2023-01-11 15:47:56 +01:00
#### make player ipfs docker ## TODO
# [[ $USER == 'zen' ]] && make player MAIL=$(myPlayer) USER_HOST=$(myPlayerHost) > /dev/null 2>&1
## 1ST RELEASE BASED ON DIRECT NODE IPFSNODEID KEY "ADD / DEL" API
2023-01-01 20:19:12 +01:00
#################################################################
#################################################
2022-10-21 13:43:52 +02:00
# !! TODO !! # DEMO MODE. REMOVE FOR PRODUCTION - RECALCULATE AND RENEW AFTER EACH NEW KEY DELEGATION
2023-01-03 18:42:41 +01:00
echo "$PASS" > ~/.zen/game/players/${PLAYER}/.pass
# ~/.zen/game/players/${PLAYER}/secret.june SECURITY TODO
2022-05-07 18:53:11 +02:00
# Astronaut QRCode + PASS = LOGIN (=> DECRYPTING CRYPTO IPFS INDEX)
2022-08-15 19:07:39 +02:00
# TODO : Allow Astronaut PASS change ;)
2022-05-07 18:53:11 +02:00
#####################################################
2022-05-07 18:53:11 +02:00
## DISCONNECT AND CONNECT CURRENT PLAYER
2022-12-09 15:55:27 +01:00
#~ rm -f ~/.zen/game/players/.current
2023-01-03 18:42:41 +01:00
#~ ln -s ~/.zen/game/players/${PLAYER} ~/.zen/game/players/.current
2022-10-24 14:59:14 +02:00
## MANAGE GCHANGE+ & Ŋ1 EXPLORATION
2023-10-07 17:21:16 +02:00
${MY_PATH}/../tools/Connect_PLAYER_To_Gchange.sh "${PLAYER}" 1>/dev/null
2022-08-18 03:47:49 +02:00
2022-11-21 18:58:03 +01:00
### IF PRINTER -> PRINT VISA
2022-12-09 15:55:27 +01:00
LP=$(ls /dev/usb/lp* 2>/dev/null)
2023-10-07 17:21:16 +02:00
[[ $LP ]] && ${MY_PATH}/../tools/VISA.print.sh "${PLAYER}" &
2022-11-21 18:58:03 +01:00
2022-08-15 19:07:39 +02:00
## INIT FRIENDSHIP CAPTAIN/ASTRONAUTS (LATER THROUGH GCHANGE)
2022-06-23 16:30:56 +02:00
## ${MY_PATH}/FRIENDS.init.sh
## NO. GCHANGE+ IS THE MAIN INTERFACE, astrXbian manage
2023-01-21 18:33:04 +01:00
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
2023-10-07 17:21:16 +02:00
echo "$(${MY_PATH}/../tools/face.sh cool)"
2024-02-10 14:35:57 +01:00
echo " 'Astronaut' $PSEUDO"
2022-12-13 16:51:00 +01:00
echo
echo "* ZenCard : Public Key and Wallet
${NID}/ipns/${ASTRONAUTENS}#ZenCard"
2023-10-03 22:50:59 +02:00
echo " "
2024-02-10 14:35:57 +01:00
echo "* AstroID : with PASS : $PASS"
echo "${NID}/ipns/${ASTRONAUTENS}#AstroID"
2023-10-03 22:50:59 +02:00
echo
2023-10-10 13:52:01 +02:00
echo "* UMap : registration at ${LAT}, ${LON}
${myIPFS}${URL}"
echo
2023-01-21 18:33:04 +01:00
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
2023-10-10 13:52:01 +02:00
echo ""
2023-01-11 15:47:56 +01:00
2024-02-10 14:35:57 +01:00
#####################################################################"
#####################################################################"
#####################################################################"
2022-11-17 19:37:35 +01:00
### SEND AstroID and ZenCard to EMAIL
2023-10-09 16:03:23 +02:00
(
2024-02-10 14:35:57 +01:00
echo "<html><head>
<style>
body {
font-family: 'Courier New', monospace;
}
pre {
white-space: pre-wrap;
}
</style></head>
<body>
2024-02-12 22:30:59 +01:00
<h1>UPlanet : ZenCard + <a href='${myIPFS}/ipns/${ASTRONAUTENS}'>TW</a></h1>" > ~/.zen/tmp/${MOATS}/ZenCard.html
2024-02-11 13:38:33 +01:00
asciiart="${MY_PATH}/../images/astroport.art"
2024-02-10 14:35:57 +01:00
while IFS= read -r line
do
echo "$line" | sed "s~ ~\&nbsp;~g" >> ~/.zen/tmp/${MOATS}/ZenCard.html
echo "<br>" >> ~/.zen/tmp/${MOATS}/ZenCard.html
done <"$asciiart"
2024-02-28 01:45:32 +01:00
echo "<h2>PRINT & SHARE <a href='${myIPFS}/ipns/${ASTRONAUTENS}#ZenCard' title='${G1PUB}'>ZenCard</a></h2>
<img src='${myIPFSGW}${IASTRO}'\><br>
</body></html>" >> ~/.zen/tmp/${MOATS}/ZenCard.html
2023-12-18 21:18:31 +01:00
2024-02-12 21:54:00 +01:00
$MY_PATH/../tools/mailjet.sh "${PLAYER}" ~/.zen/tmp/${MOATS}/ZenCard.html "ZenCard (${PLAYER}) "
2023-12-18 21:18:31 +01:00
#~ mpack -a -s "✅ UPlanet : ZenCard" -d ~/.zen/tmp/${MOATS}/intro.txt \
#~ ~/.zen/tmp/${MOATS}/pseudo.png ${PLAYER}
2024-02-10 14:35:57 +01:00
#####################################################################"
#####################################################################"
#####################################################################"
echo "<html><head>
<style>
body {
font-family: 'Courier New', monospace;
}
pre {
white-space: pre-wrap;
}
</style></head>
<body>
<h1>UPlanet : AstroID ($PASS)</h1>" > ~/.zen/tmp/${MOATS}/AstroID.html
2024-02-11 13:38:33 +01:00
asciiart="${MY_PATH}/../images/logoastro.art"
2024-02-10 14:35:57 +01:00
while IFS= read -r line
do
echo "$line" | sed "s~ ~\&nbsp;~g" >> ~/.zen/tmp/${MOATS}/AstroID.html
echo "<br>" >> ~/.zen/tmp/${MOATS}/AstroID.html
done <"$asciiart"
echo "
2024-02-28 01:45:32 +01:00
<h2> <--> 0.1 SECTOR : <a href='${EARTHCID}/map_render.html?southWestLat=${LAT::-1}&southWestLon=${LON::-1}&deg=0.1'>${SECTOR}</a> <--> </h2>
<br>PRINT & KEEP SAFE <a href='${myIPFS}/ipns/${ASTRONAUTENS}#AstroID'>AstroID<br><img width=120px src='${myIPFSGW}${ASTROQR}'\></a>
<br>SECRET1=$SALT<br>SECRET2=$PEPPER<br>($PASS)<br>
2024-02-12 22:30:59 +01:00
<h3>ASTROPORT : <a href='${myIPFS}/ipns/${IPFSNODEID}'>/ipns/${IPFSNODEID}</a></h3>
2024-02-11 13:43:21 +01:00
<a href='https://qo-op.com'>Uplanet</a>
2024-02-10 14:35:57 +01:00
</body></html>" >> ~/.zen/tmp/${MOATS}/AstroID.html
2023-12-18 21:18:31 +01:00
2024-02-12 21:54:00 +01:00
$MY_PATH/../tools/mailjet.sh "${PLAYER}" ~/.zen/tmp/${MOATS}/AstroID.html "AstroID (${PLAYER}) "
2023-12-18 21:18:31 +01:00
#~ mpack -a -s "✅ UPlanet : AstroID ($PASS)" -d ~/.zen/tmp/${MOATS}/intro.txt \
#~ $HOME/.zen/game/players/${PLAYER}/AstroID.png ${PLAYER}
2023-10-09 16:03:23 +02:00
2024-02-10 14:35:57 +01:00
#####################################################################"
#####################################################################"
#####################################################################"
2022-12-09 15:55:27 +01:00
## CLEANING CACHE
rm -Rf ~/.zen/tmp/${MOATS}
2023-10-09 16:03:23 +02:00
) &
2022-11-17 19:37:35 +01:00
2024-02-26 04:25:03 +01:00
## CHECK .current
[[ ! -d $(readlink ~/.zen/game/players/.current) ]] \
&& rm ~/.zen/game/players/.current 2>/dev/null \
&& ln -s ~/.zen/game/players/${PLAYER} ~/.zen/game/players/.current
echo $PSEUDO > ~/.zen/tmp/PSEUDO ## Return data to command.sh # KEEP IT
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
################################################ LAST LINE REPORT VALUES TO CALLING SCRIPT | tail -n 1
echo "export ASTROTW=/ipns/$ASTRONAUTENS ASTROG1=$G1PUB ASTROMAIL=$PLAYER ASTROFEED=$FEEDNS PASS=$PASS"
exit 0