ASTROBOT IPFS / TW Ŋ2 CONTROL

This commit is contained in:
fred 2022-09-06 17:32:50 +02:00
parent 12f35fd3aa
commit 7ae8f7fb0e
10 changed files with 69 additions and 6 deletions

View File

@ -9,5 +9,5 @@ ME="${0##*/}"
## PROCESS TW BACKOFFICE TREATMENT
~/.zen/Astroport.ONE/tools/VOEUX.refresh.sh
~/.zen/Astroport.ONE/tools/PLAYER.refresh.sh
~/.zen/Astroport.ONE/ASTROBOT/VOEUX.refresh.sh
~/.zen/Astroport.ONE/ASTROBOT/PLAYER.refresh.sh

View File

@ -98,6 +98,9 @@ do
sed -i "s~_WISHKEY_~${WISHKEY}~g" ~/.zen/game/world/$WISHKEY/index.html
sed -i "s~_NUMBER_~${SALT}~g" ~/.zen/game/world/$WISHKEY/index.html
sed -i "s~_SECRET_~${PEPPER}~g" ~/.zen/game/world/$WISHKEY/index.html
sed -i "s~_ASTROPORT_~${ASTRONAUTENS}~g" ~/.zen/game/world/$WISHKEY/index.html
sed -i "s~_QRSEC_~${myIP}~g" ~/.zen/game/world/$WISHKEY/index.html
# IPNS KEY is WISHKEY / VOEUXNS
sed -i "s~_MEDIAKEY_~${WISHKEY}~g" ~/.zen/game/world/$WISHKEY/index.html

63
tools/TW.export.sh Normal file
View File

@ -0,0 +1,63 @@
#!/bin/bash
########################################################################
# Version: 0.3
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
[[ $PLAYER == "" ]] && PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
[[ $PLAYER == "" ]] && echo "PLAYER manquant" && exit 1
PSEUDO=$(cat ~/.zen/game/players/$PLAYER/.pseudo 2>/dev/null)
[[ $G1PUB == "" ]] && G1PUB=$(cat ~/.zen/game/players/$PLAYER/.g1pub 2>/dev/null)
[[ $G1PUB == "" ]] && echo "G1PUB manquant" && exit 1
ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
[[ $ASTRONAUTENS == "" ]] && echo "ASTRONAUTE manquant" && exit 1
for v in $(cat ~/.zen/game/players/*/voeux/*/.title); do
g1pub=$(grep -r $v ~/.zen/game/players/*/voeux/ $v 2>/dev/null | rev | cut -d '/' -f 2 | rev )
echo "$v : $g1pub"
echo '------------------------------------------------------------------'
vlist=($v:$g1pub ${vlist[@]})
done
echo "${vlist[@]}"
PS3='Choisissez le voeux ___ '
voeux=($(ls ~/.zen/game/players/$PLAYER/voeux 2>/dev/null) "QUITTER")
select voeu in "${vlist[@]}"; do
case $voeu in
"QUITTER")
exit 0
;;
*) echo "IMPRESSION $voeu"
voeu=$(echo $voeu | cut -d ':' -f2) ## Get G1PUB part
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
VOEUXNS=$(ipfs key list -l | grep $voeu | cut -d ' ' -f1)
qrencode -s 12 -o "$HOME/.zen/game/world/$voeu/QR.WISHLINK.png" "http://$myIP:8080/ipns/$VOEUXNS"
convert $HOME/.zen/game/world/$voeu/QR.WISHLINK.png -resize 600 ~/.zen/tmp/QRWISHLINK.png
TITLE=$(cat ~/.zen/game/world/$voeu/.pepper) ## Get Voeu title (pepper) = simple GUI form + Name collision => Voeu fusion
convert -gravity northwest -pointsize 40 -fill black -draw "text 50,2 \"$TITLE\"" ~/.zen/tmp/QRWISHLINK.png ~/.zen/tmp/g1voeu1.png
convert -gravity southeast -pointsize 40 -fill black -draw "text 50,2 \"$TITLE\"" ~/.zen/tmp/g1voeu1.png ~/.zen/tmp/g1voeu.png
echo " QR code $TITLE : http://$myIP:8080/ipns/$VOEUXNS"
LP=$(ls /dev/usb/lp* | head -n1)
[[ ! $LP ]] && echo "NO PRINTER FOUND - Brother QL700 validated" && continue
echo "IMPRESSION LIEN TW VOEU"
brother_ql_create --model QL-700 --label-size 62 ~/.zen/tmp/g1voeu.png > ~/.zen/tmp/toprint.bin 2>/dev/null
sudo brother_ql_print ~/.zen/tmp/toprint.bin $LP
;;
esac
done
## TODO EXPORT TW (LIGHT / HEAVY)

View File

@ -16,12 +16,9 @@ PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null) || ( echo "nopseu
G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
PLAYERNS=$(cat ~/.zen/game/players/.current/.playerns 2>/dev/null) || ( echo "noplayerns" && exit 1 )
MOANS=$(cat ~/.zen/game/players/.current/.moans 2>/dev/null) || ( echo "noplayermoans" && exit 1 )
QOOPNS=$(cat ~/.zen/game/players/.current/.qoopns 2>/dev/null) || ( echo "noplayerqoopns" && exit 1 )
# Check if Astroport Station already has a "captain"
source ~/.zen/ipfs.sync; echo "Le capitaine de cet Astroport est actuellement $CAPTAIN"
echo "Astronaute $PLAYER ($PSEUDO) "
echo "Connected Astronaute $PLAYER ($PSEUDO) "
xdg-open "file://$HOME/.zen/Astroport.ONE/templates/instascan.html" 2>/dev/null