PLAYER TW! tid "voeu" tag => creation "g1voeu" TW
This commit is contained in:
parent
0b7469cc44
commit
2418770b86
|
@ -8,64 +8,86 @@ MY_PATH="`dirname \"$0\"`" # relative
|
|||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
################################################################################
|
||||
# Inspect game wishes, refresh latest IPNS version
|
||||
# Backup and chain
|
||||
|
||||
[[ $PLAYER == "" ]] && PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
|
||||
|
||||
## Publish All PLAYER TW,
|
||||
# Run TAG subprocess: tube, voeu
|
||||
############################################
|
||||
echo "## PLAYER TW"
|
||||
echo "## RUNNING PLAYER.refresh"
|
||||
|
||||
## RUNING FOR ALL LOCAL PLAYERS
|
||||
for PLAYER in $(ls ~/.zen/game/players/); do
|
||||
echo "PLAYER : $PLAYER"
|
||||
|
||||
echo "##################################################################"
|
||||
echo ">>>>> PLAYER : $PLAYER"
|
||||
echo "##################################################################"
|
||||
PSEUDO=$(cat ~/.zen/game/players/$PLAYER/.pseudo 2>/dev/null)
|
||||
## REFRESH ASTRONAUTE TW
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep $PLAYER | cut -d ' ' -f1)
|
||||
[[ ! $ASTRONAUTENS ]] && echo "Missing $PLAYER IPNS KEY -- EXIT --" && exit 1
|
||||
[[ ! $ASTRONAUTENS ]] && echo "Missing $PLAYER IPNS KEY -- CONTINUE --" && continue
|
||||
|
||||
rm -Rf ~/.zen/tmp/astro
|
||||
mkdir -p ~/.zen/tmp/astro
|
||||
|
||||
# Get PLAYER wallet amount
|
||||
BAL=$($MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey balance)
|
||||
echo "+++ WALLET BALANCE _ $BAL (G1) _"
|
||||
|
||||
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
|
||||
|
||||
echo "Getting latest online TW..."
|
||||
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
||||
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
||||
echo "$LIBRA/ipns/$voeuns"
|
||||
echo "$LIBRA/ipns/$ASTRONAUTENS"
|
||||
echo "http://$myIP:8080/ipns/$ASTRONAUTENS"
|
||||
[[ $YOU ]] && ipfs --timeout 12s cat /ipns/$ASTRONAUTENS > ~/.zen/tmp/astro/index.html \
|
||||
|| curl -so ~/.zen/tmp/astro/index.html "$LIBRA/ipns/$ASTRONAUTENS"
|
||||
|
||||
|| curl -m 12 -so ~/.zen/tmp/astro/index.html "$LIBRA/ipns/$ASTRONAUTENS"
|
||||
|
||||
## PLAYER TW IS ONLINE ?
|
||||
if [ ! -s ~/.zen/tmp/astro/index.html ]; then
|
||||
echo "ERROR IPNS TIMEOUT. Unchanged local backup..."
|
||||
|
||||
echo "ERROR_PLAYERTW_TIMEOUT : /ipns/$ASTRONAUTENS"
|
||||
echo "------------------------------------------------"
|
||||
echo "MANUAL PROCEDURE NEEDED"
|
||||
echo "------------------------------------------------"
|
||||
echo "TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)"
|
||||
echo "ipfs name publish -t 72h --key=$PLAYER /ipfs/\$TW"
|
||||
continue
|
||||
|
||||
else
|
||||
|
||||
## CHECK IF myIP IS LAST GATEWAY
|
||||
tiddlywiki --load ~/.zen/tmp/astro/index.html --output ~/.zen/tmp --render '.' 'miz.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
|
||||
OLDIP=$(cat ~/.zen/tmp/miz.json | jq -r .[].secret)
|
||||
[[ $OLDIP != $myIP ]] && echo "ASTRONAUTE GATEWAY IS http://$OLDIP:8080/ipns/$ASTRONAUTENS - BYPASSING" && continue
|
||||
|
||||
## Replace tube links with downloaded video ## TODO create LOG tiddler
|
||||
[[ $OLDIP != $myIP ]] && echo "ASTRONAUTE GATEWAY IS http://$OLDIP:8080/ipns/$ASTRONAUTENS - BYPASSING -" && continue
|
||||
|
||||
## RUN ASTROBOT SUBPROCESS
|
||||
##############################################################
|
||||
## TAG="tube" tiddler => Dowload youtube video links (playlist accepted) ## WISHKEY=PLAYER or G1PUB !
|
||||
$MY_PATH/TUBE.copy.sh ~/.zen/tmp/astro/index.html $PLAYER
|
||||
##############################################################
|
||||
##############################################################
|
||||
## TAG="voeu" => Creation G1Voeu "TW"
|
||||
$MY_PATH/VOEU.create.sh ~/.zen/tmp/astro/index.html $PLAYER
|
||||
##############################################################
|
||||
|
||||
## LAN TO WAN MIGRATION
|
||||
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
|
||||
sed -i "s~192.168.199.191~${myIP}~g" ~/.zen/tmp/astro/index.html
|
||||
echo "Setting new IP : $myIP"
|
||||
|
||||
echo "DIFFERENCE ?"
|
||||
## ANY CHANGES ?
|
||||
##############################################################
|
||||
DIFF=$(diff ~/.zen/tmp/astro/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html)
|
||||
if [[ $DIFF ]]; then
|
||||
echo "DIFFERENCE DETECTED !! "
|
||||
echo "Backup & Upgrade TW local copy..."
|
||||
cp -f ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.backup.html # UNNECESSARY .chain
|
||||
cp ~/.zen/tmp/astro/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
else
|
||||
echo "No change since last Refresh"
|
||||
echo "No change since last Refresh..."
|
||||
fi
|
||||
##############################################################
|
||||
|
||||
fi
|
||||
|
||||
# Get PLAYER wallet amount
|
||||
BAL=$($MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey balance)
|
||||
echo "PLAYER : (G1) $BAL"
|
||||
#
|
||||
|
||||
##############################################################
|
||||
##############################################################
|
||||
|
||||
##########################
|
||||
# Generate G1BARRE for each wish
|
||||
|
@ -106,14 +128,13 @@ for g1wish in $(ls ~/.zen/game/players/$PLAYER/voeux/); do
|
|||
|
||||
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
||||
echo "ipfs name publish --key=$PLAYER /ipfs/$TW"
|
||||
ipfs name publish --key=$PLAYER /ipfs/$TW
|
||||
ipfs name publish --allow-offline --key=$PLAYER /ipfs/$TW
|
||||
|
||||
# MAJ CACHE TW $PLAYER
|
||||
echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain
|
||||
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
|
||||
echo
|
||||
##################################################################"
|
||||
##################################################################"
|
||||
echo "##################################################################"
|
||||
##################################################################
|
||||
|
||||
fi
|
||||
|
||||
|
@ -155,6 +176,8 @@ for g1wish in $(ls ~/.zen/game/players/$PLAYER/voeux/); do
|
|||
fi
|
||||
|
||||
done
|
||||
##############################################################
|
||||
##############################################################
|
||||
|
||||
|
||||
############################
|
||||
|
@ -167,13 +190,13 @@ done
|
|||
[[ $DIFF ]] && cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.$MOATS
|
||||
|
||||
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
||||
ipfs name publish -t 72h --key=$PLAYER /ipfs/$TW
|
||||
ipfs name publish --allow-offline -t 72h --key=$PLAYER /ipfs/$TW
|
||||
|
||||
[[ $DIFF ]] && echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain
|
||||
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
|
||||
|
||||
echo "================================================"
|
||||
echo "$PLAYER : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
||||
echo "$PLAYER : http://$myIP:8080/ipns/$ASTRONAUTENS"
|
||||
echo "================================================"
|
||||
|
||||
done
|
||||
|
|
|
@ -92,7 +92,7 @@ for YURL in $(cat ~/.zen/tmp/tube.json | jq -r '.[].text' | grep 'http'); do
|
|||
"text": "'$TEXT'",
|
||||
"ipfs": "'${ILINK}'",
|
||||
"youtubeid": "'${YID}'",
|
||||
"tags": "'ipfs youtube ${EXTRATAG} ${MIME}'"
|
||||
"tags": "'ipfs youtube g1tube ${EXTRATAG} ${MIME}'"
|
||||
}
|
||||
]
|
||||
' > "$HOME/.zen/tmp/tube/$YID.TW.json"
|
||||
|
|
|
@ -34,7 +34,7 @@ do
|
|||
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
||||
echo "$LIBRA/ipns/$voeuns"
|
||||
[[ $YOU ]] && ipfs --timeout 12s cat /ipns/$voeuns > ~/.zen/tmp/work/index.html \
|
||||
|| curl -so ~/.zen/tmp/work/index.html "$LIBRA/ipns/$voeuns"
|
||||
|| curl -m 12 -so ~/.zen/tmp/work/index.html "$LIBRA/ipns/$voeuns"
|
||||
|
||||
if [[ ! -s ~/.zen/tmp/work/index.html ]]; then
|
||||
echo "UNAVAILABLE WISH! If you want to remove $W $voeu"
|
||||
|
|
156
G1VOEUX.sh
156
G1VOEUX.sh
|
@ -8,23 +8,21 @@ MY_PATH="`dirname \"$0\"`" # relative
|
|||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
################################################################################
|
||||
# Create and print VOEUX.
|
||||
# Attributed to a place shared through Astroport Ŋ1 confidence network IPFS layer
|
||||
# PARAMETRES
|
||||
# Promesse de virement du MONTANT, le nom du joueur PLAYER et sa G1PUB.
|
||||
# Create G1VOEU TW for PLAYER
|
||||
# TITRE => G1TITRE => PEPPER
|
||||
## PARAM : "TITRE DU VOEU" "PLAYER"
|
||||
################################################################################
|
||||
MONTANT="$1"
|
||||
TITRE="$1"
|
||||
PLAYER="$2"
|
||||
G1PUB="$3"
|
||||
QRTW="$4" # Nombre de QR + TW5 à créer
|
||||
INDEX="$3" ## When called from VOEUX.create.sh (Not provided in CLI start.sh )
|
||||
|
||||
[[ $MONTANT == "" ]] && MONTANT="_?_"
|
||||
[[ $PLAYER == "" ]] && PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
|
||||
[[ $PLAYER == "" ]] && echo "Second paramètre 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 "Troisième paramètre G1PUB manquant" && exit 1
|
||||
[[ $QRTW == "" ]] && QRTW=1
|
||||
|
||||
[[ ! $INDEX ]] && INDEX="~/.zen/game/players/$PLAYER/ipfs/moa/index.html"
|
||||
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
|
||||
[[ $ASTRONAUTENS == "" ]] && echo "ASTRONAUTE manquant" && exit 1
|
||||
|
@ -32,52 +30,40 @@ ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
|
|||
echo "Bienvenue $PSEUDO ($PLAYER) : $G1PUB"
|
||||
echo
|
||||
|
||||
########################################################
|
||||
# BACKING UP Astronaute TW IPNS
|
||||
mkdir -p ~/.zen/tmp/TW
|
||||
rm -f ~/.zen/tmp/TW/index.html
|
||||
ipfs --timeout 6s cat /ipns/$ASTRONAUTENS > ~/.zen/tmp/TW/index.html
|
||||
|
||||
if [ ! -s ~/.zen/tmp/TW/index.html ]; then
|
||||
echo "ERROR IPNS TIMEOUT. Restoring local backup..."
|
||||
TW=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
||||
ipfs name publish --key=$PLAYER /ipfs/$TW
|
||||
else
|
||||
# Backup
|
||||
## TODO index.html are different => Add signaling tiddler
|
||||
cp ~/.zen/tmp/TW/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
fi
|
||||
########################################################
|
||||
######################################################################
|
||||
|
||||
|
||||
# CREATION DU VOEU (TODO: REMOVE OR ACTIVATE LOOP ?)
|
||||
boucle=0;
|
||||
while [ $boucle -lt $QRTW ]
|
||||
do
|
||||
boucle=$((boucle+1))
|
||||
#####################################################
|
||||
# CREATION DU TW G1VOEU
|
||||
#####################################################
|
||||
SALT=$(${MY_PATH}/tools/diceware.sh 3 | xargs)
|
||||
PEPPER=$(${MY_PATH}/tools/diceware.sh 1 | xargs)
|
||||
echo "$SALT"
|
||||
|
||||
echo "Entrez un Titre pour ce Voeu"
|
||||
read TITRE
|
||||
echo "## TITRE POUR CE VOEU ? "
|
||||
[[ ! $TITRE ]] && read TITRE
|
||||
PEPPER=$(echo "$TITRE" | sed -r 's/\<./\U&/g' | sed 's/ //g') # CapitalGluedWords
|
||||
echo "$PEPPER"
|
||||
|
||||
echo "# CREATION CLEF DE VOEUX"
|
||||
echo "## keygen CLEF DE VOEUX"
|
||||
${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"
|
||||
|
||||
echo "# NOUVEAU VOEU ASTRONAUTE"
|
||||
echo "# NOUVEAU VOEU"
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/
|
||||
${MY_PATH}/tools/keygen -t ipfs -o ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/qrtw.ipfskey "$SALT" "$PEPPER"
|
||||
VOEUXNS=$(ipfs key import $WISHKEY -f pem-pkcs8-cleartext ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/qrtw.ipfskey)
|
||||
echo "/ipns/$VOEUNS"
|
||||
|
||||
# CRYPTO BUG. TODO use natools to protect and share key with Ŋ1 only ;)
|
||||
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
|
||||
echo " QR code fonctionnel sur réseau IP local (qo-op) : $myIP"
|
||||
echo " Passerelle : $myIP"
|
||||
|
||||
echo "# UPGRADING WORLD WHISHKEY DATABASE"
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
mkdir -p ~/.zen/game/world/$WISHKEY/
|
||||
## A la fois Titre du tag et Pepper construction de clef
|
||||
echo $PEPPER > ~/.zen/game/world/$WISHKEY/.pepper
|
||||
|
||||
echo "# CREATION TW"
|
||||
|
@ -89,6 +75,7 @@ do
|
|||
# ipfs cat /ipfs/bafybeidkur2tfbmqwscgmkfh76vmbcqay2m4gznxv5emkenxeffmrgywky > ~/.zen/Astroport.ONE/templates/twdefault.html
|
||||
##########################################################################################
|
||||
cp ~/.zen/Astroport.ONE/templates/twdefault.html ~/.zen/game/world/$WISHKEY/index.html
|
||||
# TODO : CREATE ONE TEMPLATE / REMOVE USELESS TID
|
||||
|
||||
# PERSONNALISATION
|
||||
sed -i "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/game/world/$WISHKEY/index.html
|
||||
|
@ -101,10 +88,10 @@ do
|
|||
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
|
||||
sed -i "s~k2k4r8kxfnknsdf7tpyc46ks2jb3s9uvd3lqtcv9xlq9rsoem7jajd75~${VOEUXNS}~g" ~/.zen/game/world/$WISHKEY/index.html
|
||||
|
||||
# ASTROPORT LOCAL IP RELAY == Smartphone doesn't resolve LAN DNS. So using Astroport Station IP
|
||||
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/world/$WISHKEY/index.html
|
||||
sed -i "s~127.0.0.1~$myIP~g" ~/.zen/game/world/$WISHKEY/index.html
|
||||
|
@ -114,20 +101,23 @@ do
|
|||
# [{"title":"$:/ipfs/saver/api/http/local/5001","tags":"$:/ipfs/core $:/ipfs/saver/api","text":"http://127.0.0.1:5001"}]
|
||||
# [{"title":"$:/ipfs/saver/gateway/local/myip","tags":"$:/ipfs/core $:/ipfs/saver/gateway","text":"http://127.0.0.1:8080"}]
|
||||
##########################################################################################
|
||||
tiddlywiki --verbose --load ~/.zen/game/world/$WISHKEY/index.html \
|
||||
tiddlywiki --load ~/.zen/game/world/$WISHKEY/index.html \
|
||||
--import ~/.zen/Astroport.ONE/templates/data/local.api.json "application/json" \
|
||||
--import ~/.zen/Astroport.ONE/templates/data/local.gw.json "application/json" \
|
||||
--deletetiddlers '"Dessin de Moa"' \
|
||||
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
[[ -s ~/.zen/tmp/newindex.html ]] && cp ~/.zen/tmp/newindex.html ~/.zen/game/world/$WISHKEY/index.html
|
||||
|
||||
## EXTEND ipfs daemon accreditation
|
||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://'$myIP':8080", "http://127.0.0.1:8080", "http://astroport", "https://astroport.com", "https://qo-op.com", "https://tube.copylaradio.com", "http://'$(hostname)'.local:8080" ]'
|
||||
## RESTART IPFS !?
|
||||
|
||||
echo "# CREATION QR CODE"
|
||||
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.WISHLINK.png" "http://$myIP:8080/ipns/$VOEUXNS"
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.ASTROLINK.png" "http://$myIP:8080/ipns/$ASTRONAUTENS"
|
||||
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
||||
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.WISHLINK.png" "$LIBRA/ipns/$VOEUXNS"
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.ASTROLINK.png" "$LIBRA/ipns/$ASTRONAUTENS"
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.G1ASTRO.png" "$G1PUB"
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.G1WISH.png" "$WISHKEY"
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.IPNS.png" "/ipns/$VOEUXNS"
|
||||
|
@ -139,33 +129,33 @@ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://'$myIP'
|
|||
# cd -
|
||||
|
||||
#################################
|
||||
# PREMIER TYPE /tmp/player.png
|
||||
convert $HOME/.zen/game/world/$WISHKEY/QR.WISHLINK.png -resize 300 /tmp/QRWISHLINK.png
|
||||
convert ${MY_PATH}/images/logoastro.png -resize 220 /tmp/ASTROLOGO.png
|
||||
# PREMIER TYPE ~/.zen/tmp/player.png
|
||||
convert $HOME/.zen/game/world/$WISHKEY/QR.WISHLINK.png -resize 300 ~/.zen/tmp/QRWISHLINK.png
|
||||
convert ${MY_PATH}/images/logoastro.png -resize 220 ~/.zen/tmp/ASTROLOGO.png
|
||||
|
||||
composite -compose Over -gravity NorthWest -geometry +350+10 /tmp/ASTROLOGO.png ${MY_PATH}/images/Brother_600x400.png /tmp/astroport.png
|
||||
composite -compose Over -gravity NorthWest -geometry +0+0 /tmp/QRWISHLINK.png /tmp/astroport.png /tmp/one.png
|
||||
convert -gravity northwest -pointsize 35 -fill black -draw "text 320,250 \"$PLAYER\"" /tmp/one.png /tmp/hop.png
|
||||
convert -gravity northwest -pointsize 30 -fill black -draw "text 20,320 \"$PEPPER\"" /tmp/hop.png /tmp/pseudo.png
|
||||
convert -gravity northwest -pointsize 30 -fill black -draw "text 320,300 \"$SALT\"" /tmp/pseudo.png /tmp/salt.png
|
||||
convert -gravity northwest -pointsize 33 -fill black -draw "text 320,350 \"$PEPPER\"" /tmp/salt.png /tmp/player.png
|
||||
composite -compose Over -gravity NorthWest -geometry +350+10 ~/.zen/tmp/ASTROLOGO.png ${MY_PATH}/images/Brother_600x400.png ~/.zen/tmp/astroport.png
|
||||
composite -compose Over -gravity NorthWest -geometry +0+0 ~/.zen/tmp/QRWISHLINK.png ~/.zen/tmp/astroport.png ~/.zen/tmp/one.png
|
||||
convert -gravity northwest -pointsize 35 -fill black -draw "text 320,250 \"$PLAYER\"" ~/.zen/tmp/one.png ~/.zen/tmp/hop.png
|
||||
convert -gravity northwest -pointsize 30 -fill black -draw "text 20,320 \"$PEPPER\"" ~/.zen/tmp/hop.png ~/.zen/tmp/pseudo.png
|
||||
convert -gravity northwest -pointsize 30 -fill black -draw "text 320,300 \"$SALT\"" ~/.zen/tmp/pseudo.png ~/.zen/tmp/salt.png
|
||||
convert -gravity northwest -pointsize 33 -fill black -draw "text 320,350 \"$PEPPER\"" ~/.zen/tmp/salt.png ~/.zen/tmp/player.png
|
||||
|
||||
#################################
|
||||
# SECOND TYPE /tmp/voeu.png
|
||||
convert $HOME/.zen/game/world/$WISHKEY/QR.G1WISH.png -resize 300 /tmp/G1WISH.png
|
||||
convert ${MY_PATH}/images/logojeu.png -resize 260 /tmp/MIZLOGO.png
|
||||
# SECOND TYPE ~/.zen/tmp/voeu.png
|
||||
convert $HOME/.zen/game/world/$WISHKEY/QR.G1WISH.png -resize 300 ~/.zen/tmp/G1WISH.png
|
||||
convert ${MY_PATH}/images/logojeu.png -resize 260 ~/.zen/tmp/MIZLOGO.png
|
||||
|
||||
composite -compose Over -gravity NorthWest -geometry +0+0 /tmp/G1WISH.png ${MY_PATH}/images/Brother_600x400.png /tmp/astroport.png
|
||||
composite -compose Over -gravity NorthWest -geometry +300+0 /tmp/QRWISHLINK.png /tmp/astroport.png /tmp/one.png
|
||||
composite -compose Over -gravity NorthWest -geometry +320+280 /tmp/MIZLOGO.png /tmp/one.png /tmp/two.png
|
||||
composite -compose Over -gravity NorthWest -geometry +0+0 ~/.zen/tmp/G1WISH.png ${MY_PATH}/images/Brother_600x400.png ~/.zen/tmp/astroport.png
|
||||
composite -compose Over -gravity NorthWest -geometry +300+0 ~/.zen/tmp/QRWISHLINK.png ~/.zen/tmp/astroport.png ~/.zen/tmp/one.png
|
||||
composite -compose Over -gravity NorthWest -geometry +320+280 ~/.zen/tmp/MIZLOGO.png ~/.zen/tmp/one.png ~/.zen/tmp/two.png
|
||||
|
||||
convert -gravity northwest -pointsize 28 -fill black -draw "text 32,350 \"Ğ1 VOEU\"" /tmp/two.png /tmp/pep.png
|
||||
convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"$PEPPER\"" /tmp/pep.png /tmp/voeu.png
|
||||
convert -gravity northwest -pointsize 28 -fill black -draw "text 32,350 \"Ğ1 VOEU\"" ~/.zen/tmp/two.png ~/.zen/tmp/pep.png
|
||||
convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"$PEPPER\"" ~/.zen/tmp/pep.png ~/.zen/tmp/voeu.png
|
||||
|
||||
# IMAGE DANS IPFS
|
||||
IVOEUPLAY=$(ipfs add -Hq /tmp/player.png | tail -n 1)
|
||||
IVOEUPLAY=$(ipfs add -Hq ~/.zen/tmp/player.png | tail -n 1)
|
||||
|
||||
IVOEU=$(ipfs add -Hq /tmp/voeu.png | tail -n 1)
|
||||
IVOEU=$(ipfs add -Hq ~/.zen/tmp/voeu.png | tail -n 1)
|
||||
## Replace Template G1Voeu image
|
||||
sed -i "s~bafybeidhghlcx3zdzdah2pzddhoicywmydintj4mosgtygr6f2dlfwmg7a~${IVOEU}~g" ~/.zen/game/world/$WISHKEY/index.html
|
||||
|
||||
|
@ -180,7 +170,7 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"$PEPPE
|
|||
"ipns": "'/ipns/$VOEUXNS'",
|
||||
"ipfs": "'/ipfs/$IVOEUPLAY'",
|
||||
"text": "'$TEXT'",
|
||||
"tags": "'voeu ${PEPPER}'"
|
||||
"tags": "'g1voeu ${PEPPER}'"
|
||||
}
|
||||
]
|
||||
' > ~/.zen/game/world/$WISHKEY/${PEPPER}.voeu.json
|
||||
|
@ -190,45 +180,37 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"$PEPPE
|
|||
rm -f ~/.zen/tmp/newindex.html
|
||||
|
||||
echo "Nouveau Qr$PEPPER dans MOA $PSEUDO : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
||||
tiddlywiki --verbose --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html \
|
||||
--import ~/.zen/game/world/$WISHKEY/${PEPPER}.voeu.json "application/json" \
|
||||
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
tiddlywiki --verbose --load $INDEX \
|
||||
--deletetiddlers '[tag[voeu]]' \
|
||||
--import ~/.zen/game/world/$WISHKEY/${PEPPER}.voeu.json "application/json" \
|
||||
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
|
||||
echo "PLAYER TW Update..."
|
||||
if [[ -s ~/.zen/tmp/newindex.html ]]; then
|
||||
echo "Mise à jour ~/.zen/game/players/$PLAYER/ipfs/moa/index.html"
|
||||
cp -f ~/.zen/tmp/newindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
echo "Avancement blockchain TW $PLAYER : $MOATS"
|
||||
cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.$MOATS
|
||||
|
||||
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
||||
echo "ipfs name publish --key=$PLAYER /ipfs/$TW"
|
||||
ipfs name publish --key=$PLAYER /ipfs/$TW
|
||||
|
||||
# MAJ CACHE TW $PLAYER
|
||||
echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain
|
||||
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
|
||||
echo
|
||||
echo "Mise à jour $INDEX"
|
||||
cp -f ~/.zen/tmp/newindex.html $INDEX
|
||||
fi
|
||||
|
||||
# PRINTING
|
||||
LP=$(ls /dev/usb/lp* | head -n1)
|
||||
[[ ! $LP ]] && echo "NO PRINTER FOUND - Brother QL700 validated"
|
||||
echo "IMPRESSION VOEU"
|
||||
brother_ql_create --model QL-700 --label-size 62 /tmp/player.png > /tmp/toprint.bin 2>/dev/null
|
||||
sudo brother_ql_print /tmp/toprint.bin $LP
|
||||
brother_ql_create --model QL-700 --label-size 62 /tmp/voeu.png > /tmp/toprint.bin 2>/dev/null
|
||||
sudo brother_ql_print /tmp/toprint.bin $LP
|
||||
if [[ ! $LP ]]; then
|
||||
echo "NO PRINTER FOUND - Plug a Brother QL700 or Add your printer"
|
||||
else
|
||||
echo "IMPRESSION VOEU"
|
||||
brother_ql_create --model QL-700 --label-size 62 ~/.zen/tmp/player.png > ~/.zen/tmp/toprint.bin 2>/dev/null
|
||||
sudo brother_ql_print ~/.zen/tmp/toprint.bin $LP
|
||||
brother_ql_create --model QL-700 --label-size 62 ~/.zen/tmp/voeu.png > ~/.zen/tmp/toprint.bin 2>/dev/null
|
||||
sudo brother_ql_print ~/.zen/tmp/toprint.bin $LP
|
||||
fi
|
||||
|
||||
# COPY QR CODE TO PLAYER ZONE
|
||||
cp /tmp/player.png /tmp/voeu.png ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/
|
||||
cp ~/.zen/tmp/player.png ~/.zen/tmp/voeu.png ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/
|
||||
echo "$PEPPER" > ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/.title
|
||||
echo "http://$myIP:8080/ipns/$VOEUXNS" > ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/.link
|
||||
cp ~/.zen/game/world/$WISHKEY/QR.WISHLINK.png ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/
|
||||
|
||||
# PUBLISHING
|
||||
echo "## ${PLAYER} RECORDING YOU WISH INTO BLOCKCHAIN"
|
||||
echo "## ${PLAYER} RECORDING YOU WISH INTO IPFS"
|
||||
echo "ipfs add -Hq ~/.zen/game/world/$WISHKEY/index.html
|
||||
ipfs name publish --key=${WISHKEY} /ipfs/\$IPUSH"
|
||||
IPUSH=$(ipfs add -Hq ~/.zen/game/world/$WISHKEY/index.html | tail -n 1)
|
||||
|
@ -254,8 +236,4 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"$PEPPE
|
|||
$MY_PATH/tools/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey pay -a 1 -p $WISHKEY -c "$VOEUXNS G1Voeu $PEPPER" -m
|
||||
echo "************************************************************"
|
||||
|
||||
|
||||
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue