forked from qo-op/G1BILLET
This commit is contained in:
parent
2e45cc9a21
commit
57712ecb9b
93
G1BILLETS.sh
93
G1BILLETS.sh
@ -10,7 +10,7 @@ ME="${0##*/}"
|
|||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Create different king of G1BILLET(s) with $MONTANT DU or TW IPNS
|
# Create different king of G1BILLET(s) with $MONTANT DU or TW IPNS
|
||||||
# ${MY_PATH}/G1BILLETS.sh 5 986397643 ticket # MONTANT # UNIQID # STYLE #
|
# ${MY_PATH}/G1BILLETS.sh 5 986397643 ticket # MONTANT # STYLE #
|
||||||
################################################################################
|
################################################################################
|
||||||
MONTANT="$1"
|
MONTANT="$1"
|
||||||
[[ $MONTANT == "0" ]] && MONTANT=""
|
[[ $MONTANT == "0" ]] && MONTANT=""
|
||||||
@ -20,27 +20,28 @@ if [[ $MONTANT != "daemon" ]]; then
|
|||||||
|
|
||||||
[[ $MONTANT == "" ]] && MONTANT="___"
|
[[ $MONTANT == "" ]] && MONTANT="___"
|
||||||
|
|
||||||
UNIQID="$2"
|
STYLE="$2"
|
||||||
[[ $UNIQID == "0" ]] && UNIQID=""
|
|
||||||
[[ $UNIQID == "" ]] && UNIQID=$(${MY_PATH}/diceware.sh 1 | xargs)${RANDOM:0:2}$(${MY_PATH}/diceware.sh 1 | xargs)
|
|
||||||
|
|
||||||
STYLE="$3"
|
## CHECK IF STYLE IS EMAIL => astro IPFS G1BILLET
|
||||||
|
|
||||||
## CHECK STYLE IS EMAIL
|
|
||||||
if [[ "${STYLE}" =~ ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$ ]]; then
|
if [[ "${STYLE}" =~ ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$ ]]; then
|
||||||
# echo "PLAYER : $STYLE"
|
# echo "PLAYER : $STYLE"
|
||||||
EMAIL=${STYLE}
|
EMAIL=${STYLE}
|
||||||
STYLE="astro"
|
STYLE="astro"
|
||||||
|
CAPTURE="$3" ## TIDDLER CopierYouTube
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## PLANCHE PDF DE 6 BILLETS PAR DEFAUT
|
## PLANCHE PDF DE 6 BILLETS PAR DEFAUT
|
||||||
NBbillets=6
|
NBbillets=6
|
||||||
[[ "${STYLE}" == "ticket" || "${STYLE}" == "xbian" || "${STYLE}" == "astro" ]] && NBbillets=1
|
[[ "${STYLE}" != "" ]] && NBbillets=1
|
||||||
|
|
||||||
|
echo "CREATION $NBbillets x G1BILLET - $STYLE -"
|
||||||
|
|
||||||
# CHECK IF $STYLE IMAGES EXIST
|
# CHECK IF $STYLE IMAGES EXIST
|
||||||
[[ ! -f ${MY_PATH}/images/fond${STYLE}.jpg ]] && echo "missing fond${STYLE}.jpg" && exit 1
|
[[ ! -f ${MY_PATH}/images/g1${STYLE}.png ]] && echo "AJOUTER : ./images/g1${STYLE}.jpg" && exit 1
|
||||||
[[ ! -f ${MY_PATH}/images/g1${STYLE}.png ]] && echo "missing g1${STYLE}.jpg" && exit 1
|
[[ ! -f ${MY_PATH}/images/fond${STYLE}.jpg ]] && echo "STYLE INCONNU ? ./images/fond${STYLE}.jpg" && exit 1
|
||||||
[[ ! -f ${MY_PATH}/images/logo${STYLE}.png ]] && echo "missing logo${STYLE}.jpg" && exit 1
|
[[ ! -f ${MY_PATH}/images/logo${STYLE}.png ]] && echo "AJOUTER : ./images/logo${STYLE}.jpg" && exit 1
|
||||||
|
|
||||||
|
UNIQID=$(${MY_PATH}/diceware.sh 1 | xargs)${RANDOM:0:2}$(${MY_PATH}/diceware.sh 1 | xargs)
|
||||||
|
|
||||||
# CREATION DE $NBbillets BILLETS DE $MONTANT DU
|
# CREATION DE $NBbillets BILLETS DE $MONTANT DU
|
||||||
boucle=0;
|
boucle=0;
|
||||||
@ -48,29 +49,32 @@ while [ $boucle -lt $NBbillets ]
|
|||||||
do
|
do
|
||||||
boucle=$((boucle+1))
|
boucle=$((boucle+1))
|
||||||
mkdir -p "${MY_PATH}/tmp/g1billet/${UNIQID}"
|
mkdir -p "${MY_PATH}/tmp/g1billet/${UNIQID}"
|
||||||
NUMBER=$(${MY_PATH}/diceware.sh 4 | xargs)
|
|
||||||
UN=$(echo ${NUMBER} | jq -Rr @uri)
|
SALT=$(${MY_PATH}/diceware.sh 4 | xargs)
|
||||||
|
UN=$(echo ${SALT} | jq -Rr @uri)
|
||||||
SECRET=$(${MY_PATH}/diceware.sh 4 | xargs)
|
SECRET=$(${MY_PATH}/diceware.sh 4 | xargs)
|
||||||
DE=$(echo ${SECRET} | jq -Rr @uri)
|
DE=$(echo ${SECRET} | jq -Rr @uri)
|
||||||
|
|
||||||
|
|
||||||
# CREATION CLEF BILLET
|
# CREATION CLEF BILLET
|
||||||
BILLETPUBKEY=$(python3 ${MY_PATH}/key_create_dunikey.py "$NUMBER" "$SECRET")
|
BILLETPUBKEY=$(python3 ${MY_PATH}/key_create_dunikey.py "$SALT" "$SECRET")
|
||||||
rm -f /tmp/secret.dunikey
|
rm -f /tmp/secret.dunikey
|
||||||
|
echo "$boucle : $BILLETPUBKEY"
|
||||||
|
|
||||||
## ASTRO : FIND TW ADDRESS + EMAIL = CREATE PLAYER on 1234 API
|
## ASTRO : FIND TW ADDRESS + EMAIL = CREATE PLAYER on 1234 API
|
||||||
[[ "$STYLE" == "astro" ]] \
|
[[ "$STYLE" == "astro" ]] \
|
||||||
&& ${MY_PATH}/keygen -t ipfs -o ${MY_PATH}/tmp/g1billet.${UNIQID}.ipns.key "$NUMBER" "$SECRET" \
|
&& ${MY_PATH}/keygen -t ipfs -o ${MY_PATH}/tmp/g1billet.${UNIQID}.ipns.key "$SALT" "$SECRET" \
|
||||||
&& ASTRONAUTENS=$(ipfs key import ${UNIQID} -f pem-pkcs8-cleartext ${MY_PATH}/tmp/g1billet.${UNIQID}.ipns.key) \
|
&& ASTRONAUTENS=$(ipfs key import ${UNIQID} -f pem-pkcs8-cleartext ${MY_PATH}/tmp/g1billet.${UNIQID}.ipns.key) \
|
||||||
&& rm -f ${MY_PATH}/tmp/g1billet.${UNIQID}.ipns.key \
|
&& rm -f ${MY_PATH}/tmp/g1billet.${UNIQID}.ipns.key \
|
||||||
&& ipfs key rm ${UNIQID} && echo "/ipns/$ASTRONAUTENS" \
|
&& ipfs key rm ${UNIQID} && echo "/ipns/$ASTRONAUTENS" \
|
||||||
&& [[ ${EMAIL} ]] && echo 'curl -s "https://astroport.copylaradio.com/?salt='$UN'&pepper='$DE'&g1pub=on&email='$EMAIL'"'
|
&& [[ ${EMAIL} ]] && echo 'curl -s "https://astroport.copylaradio.com/?salt='$UN'&pepper='$DE'&g1pub=on&email='$EMAIL'"'
|
||||||
|
|
||||||
# CREATION FICHIER IMAGE BILLET dans ${MY_PATH}/tmp/g1billet/${UNIQID}
|
# CREATION FICHIER IMAGE BILLET dans ${MY_PATH}/tmp/g1billet/${UNIQID}
|
||||||
$(${MY_PATH}/MAKE_G1BILLET.sh "${NUMBER}" "${SECRET}" "${MONTANT}" "${BILLETPUBKEY}" "${UNIQID}" "${STYLE}" "${ASTRONAUTENS}" "${EMAIL}")
|
$(${MY_PATH}/MAKE_G1BILLET.sh "${SALT}" "${SECRET}" "${MONTANT}" "${BILLETPUBKEY}" "${UNIQID}" "${STYLE}" "${ASTRONAUTENS}" "${EMAIL}")
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ "${STYLE}" == "ticket" || "${STYLE}" == "xbian" || "${STYLE}" == "astro" ]]
|
if [[ "${STYLE}" != "" ]]
|
||||||
then
|
then
|
||||||
|
|
||||||
# ONE FILE ONLY
|
# ONE FILE ONLY
|
||||||
@ -96,8 +100,10 @@ else
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### LAST LINE INFORM DAEMON
|
[[ $XDG_SESSION_TYPE == 'x11' ]] && xdg-open "$ZFILE"
|
||||||
echo "$ZFILE"
|
|
||||||
|
echo "$ZFILE" ### LAST LINE : INFORM DAEMON
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -157,8 +163,11 @@ function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
|||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
echo "=================================================="
|
echo "=================================================="
|
||||||
echo "$ME DAEMON RUNNING $HNAME:33101"
|
echo "$ME DAEMON READY"
|
||||||
echo "TW : $HNAME:33101/?m=0&u=0&type=astro${RANDOM}@yopmail.com"
|
echo "PLANCHE : $HNAME:33101"
|
||||||
|
echo "TICKET : $HNAME:33101/?montant=10&style=ticket"
|
||||||
|
echo "ASTRO TW : $HNAME:33101/?montant=0&style=astro${RANDOM}@yopmail.com"
|
||||||
|
echo "=================================================="
|
||||||
REQ=$(echo "$HTTPWELLCOME" | nc -l -p 33101 -q 1) ## # WAIT FOR 33101 PORT CONTACT
|
REQ=$(echo "$HTTPWELLCOME" | nc -l -p 33101 -q 1) ## # WAIT FOR 33101 PORT CONTACT
|
||||||
|
|
||||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||||
@ -168,33 +177,40 @@ while true; do
|
|||||||
HOST=$(echo "$HOSTP" | cut -d ':' -f 1)
|
HOST=$(echo "$HOSTP" | cut -d ':' -f 1)
|
||||||
|
|
||||||
echo "=================================================="
|
echo "=================================================="
|
||||||
echo "$MOATS : $HOSTP "
|
echo "$MOATS"
|
||||||
|
echo "=================================================="
|
||||||
|
# echo "$REQ"
|
||||||
echo "=================================================="
|
echo "=================================================="
|
||||||
echo "$URL"
|
echo "$URL"
|
||||||
arr=(${URL//[=&]/ })
|
arr=(${URL//[=&]/ })
|
||||||
# PARAM (x 3) EXTRACT "¶m=value"
|
# PARAM (x 3) EXTRACT "¶m=value"
|
||||||
ONE=$(urldecode ${arr[0]} | xargs); TWO=$(urldecode ${arr[2]} | xargs); THREE=$(urldecode ${arr[4]} | xargs);
|
ONE=$(urldecode ${arr[0]} | xargs); TWO=$(urldecode ${arr[2]} | xargs);
|
||||||
MONTANT=$(urldecode ${arr[1]} | xargs); UNIQID=$(urldecode ${arr[3]} | xargs); STYLE=$(urldecode ${arr[5]} | xargs);
|
MONTANT=$(urldecode ${arr[1]} | xargs); STYLE=$(urldecode ${arr[3]} | xargs);
|
||||||
#~ echo "DECODED : $ONE=$MONTANT & $TWO=$UNIQID & $THREE=$STYLE"
|
# echo "DECODED : $ONE=$MONTANT & $TWO=$STYLE"
|
||||||
|
|
||||||
echo ${MY_PATH}/${ME} '"'$MONTANT'"' '"'$UNIQID'"' '"'$STYLE'"'
|
echo ${MY_PATH}/${ME} '"'$MONTANT'"' '"'$STYLE'"'
|
||||||
# EXECUTE COMMAND
|
# EXECUTE COMMAND
|
||||||
LOG=$(${MY_PATH}/${ME} "$MONTANT" "$UNIQID" "$STYLE")
|
LOG=$(${MY_PATH}/${ME} "$MONTANT" "$STYLE")
|
||||||
IPNS=$(echo "$LOG" | grep '/ipns/')
|
|
||||||
echo "IPNS : $IPNS"
|
|
||||||
CURL=$(echo "$LOG" | grep -w curl)
|
|
||||||
echo "CURL : $CURL"
|
|
||||||
ZFILE=$(echo "$LOG" | tail -n 1)
|
|
||||||
|
|
||||||
# FIND JPG or PDF
|
# echo $LOG
|
||||||
|
# EXTRACT VALUES FROM SELF LOG
|
||||||
|
IPNS=$(echo "$LOG" | grep '/ipns/')
|
||||||
|
[[ $IPNS ]] && echo "TW IPNS : $IPNS"
|
||||||
|
CURL=$(echo "$LOG" | grep -w curl)
|
||||||
|
[[ $IPNS ]] && echo "LIEN ACTIVATION : $CURL"
|
||||||
|
|
||||||
|
ZFILE=$(echo "$LOG" | tail -n 1) ### LAST LINE : INFORM DAEMON
|
||||||
|
|
||||||
|
# PREPARE FILE SENDING
|
||||||
FILE_NAME="$(basename "${ZFILE}")"
|
FILE_NAME="$(basename "${ZFILE}")"
|
||||||
EXT="${FILE_NAME##*.}"
|
EXT="${FILE_NAME##*.}"
|
||||||
BSIZE=$(du -b "${ZFILE}" | awk '{print $1}' | tail -n 1)
|
BSIZE=$(du -b "${ZFILE}" | awk '{print $1}' | tail -n 1)
|
||||||
|
|
||||||
|
# KILL OLD 33102 - USE IT IF YOU ( publishing )&
|
||||||
pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p 33102" | grep -v -E 'color=auto|grep' | awk '{gsub(/^ +| +$/,"")} {print $0}' | tail -n 1 | cut -d " " -f 1)
|
pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p 33102" | grep -v -E 'color=auto|grep' | awk '{gsub(/^ +| +$/,"")} {print $0}' | tail -n 1 | cut -d " " -f 1)
|
||||||
[[ $pidportinuse ]] && kill -9 $pidportinuse && echo "KILLING NOT COLLECTED THREAD $pidportinuse"
|
[[ $pidportinuse ]] && kill -9 $pidportinuse && echo "KILLING NOT COLLECTED THREAD $pidportinuse"
|
||||||
|
|
||||||
# SEND BACK TO HTTP 33102
|
# HTTP/1.1 200 OK
|
||||||
echo 'HTTP/1.1 200 OK
|
echo 'HTTP/1.1 200 OK
|
||||||
Access-Control-Allow-Origin: *
|
Access-Control-Allow-Origin: *
|
||||||
Access-Control-Allow-Credentials: true
|
Access-Control-Allow-Credentials: true
|
||||||
@ -208,11 +224,14 @@ Content-Disposition: attachment; filename='${FILE_NAME}'
|
|||||||
|
|
||||||
cat ${ZFILE} >> ${MY_PATH}/tmp/http.${MOATS}
|
cat ${ZFILE} >> ${MY_PATH}/tmp/http.${MOATS}
|
||||||
|
|
||||||
cat ${MY_PATH}/tmp/http.${MOATS} | nc -l -p 33102 -q 1 > /dev/null 2>&1
|
# NETCAT PUBLISH port=33102
|
||||||
echo "DELIVERED ${MOATS} : http://g1billet.localhost:33102"
|
[[ $XDG_SESSION_TYPE != 'x11' ]] \
|
||||||
rm -f "${ZFILE}"
|
&& cat ${MY_PATH}/tmp/http.${MOATS} | nc -l -p 33102 -q 1 > /dev/null 2>&1 \
|
||||||
|
&& echo "DELIVERED ${MOATS} : http://g1billet.localhost:33102"
|
||||||
rm -f "${MY_PATH}/tmp/http.${MOATS}"
|
rm -f "${MY_PATH}/tmp/http.${MOATS}"
|
||||||
|
|
||||||
|
rm -f "${ZFILE}"
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
161
G1VOEUX.sh
161
G1VOEUX.sh
@ -1,161 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
################################################################################
|
|
||||||
# Author: Fred (support@qo-op.com)
|
|
||||||
# Version: 0.1
|
|
||||||
# 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##*/}"
|
|
||||||
################################################################################
|
|
||||||
# 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.
|
|
||||||
################################################################################
|
|
||||||
MONTANT="$1"
|
|
||||||
PLAYER="$2"
|
|
||||||
G1PUB="$3"
|
|
||||||
QRTW="$4" # Nombre de QR + TW5 à créer
|
|
||||||
|
|
||||||
[[ $MONTANT == "" ]] && MONTANT="_?_"
|
|
||||||
[[ $PLAYER == "" ]] && PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
|
|
||||||
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null)
|
|
||||||
[[ $PLAYER == "" ]] && echo "Second paramètre PLAYER manquant" && exit 1
|
|
||||||
[[ $G1PUB == "" ]] && G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null)
|
|
||||||
[[ $G1PUB == "" ]] && echo "Troisième paramètre G1PUB manquant" && exit 1
|
|
||||||
[[ $QRTW == "" ]] && QRTW=1
|
|
||||||
|
|
||||||
ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
|
|
||||||
[[ $ASTRONAUTENS == "" ]] && echo "ASTRONAUTE manquant" && exit 1
|
|
||||||
|
|
||||||
echo "Bienvenue $PSEUDO ($PLAYER) : $G1PUB"
|
|
||||||
echo "Astronaute Ŋ1 : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
|
||||||
echo
|
|
||||||
|
|
||||||
# BACKING UP IPNS
|
|
||||||
rm -f ~/.zen/tmp/index.html
|
|
||||||
ipfs --timeout 5s get -o ~/.zen/tmp/index.html /ipns/$ASTRONAUTENS
|
|
||||||
if [ ! -f ~/.zen/tmp/index.html ]; then
|
|
||||||
echo "ERROR IPNS TIMEOUT"
|
|
||||||
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
|
||||||
ipfs name publish --key=$G1PUB /ipfs/$TW
|
|
||||||
else
|
|
||||||
cp ~/.zen/tmp/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
|
||||||
fi
|
|
||||||
|
|
||||||
# CREATION DE $QRTW BILLETS DE $MONTANT DU
|
|
||||||
boucle=0;
|
|
||||||
while [ $boucle -lt $QRTW ]
|
|
||||||
do
|
|
||||||
boucle=$((boucle+1))
|
|
||||||
SALT=$(${MY_PATH}/diceware.sh 3 | xargs)
|
|
||||||
PEPPER=$(${MY_PATH}/diceware.sh 1 | xargs)
|
|
||||||
|
|
||||||
echo "Entrez un Mot titre pour ce Voeu"
|
|
||||||
read PEPPER
|
|
||||||
|
|
||||||
echo "# CREATION CLEF DE VOEUX"
|
|
||||||
${MY_PATH}/keygen -t duniter -o ~/.zen/tmp/qrtw.dunikey "$SALT" "$PEPPER"
|
|
||||||
WISHKEY=$(cat ~/.zen/tmp/qrtw.dunikey | grep "pub:" | cut -d ' ' -f 2)
|
|
||||||
|
|
||||||
echo "# NOUVEAU VOEU ASTRONAUTE"
|
|
||||||
mkdir -p ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/
|
|
||||||
${MY_PATH}/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)
|
|
||||||
# CRYPTO BUG. TODO use natools to protect and share key with Ŋ1 only ;)
|
|
||||||
|
|
||||||
echo "# CREATION WORLD UPGRADE DATABASE"
|
|
||||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
|
||||||
|
|
||||||
mkdir -p ~/.zen/game/world/$WISHKEY/
|
|
||||||
echo $PEPPER > ~/.zen/game/world/$WISHKEY/.pepper
|
|
||||||
|
|
||||||
echo "# CREATION TW"
|
|
||||||
# ipfs cat /ipfs/bafybeigqut7yod32gbu3ykruu2zzegzi4i7zc7tjggxvcwkilw5s44vuqi > ~/.zen/Astroport.ONE/templates/twdefault.html
|
|
||||||
cp ~/.zen/Astroport.ONE/templates/twdefault.html ~/.zen/game/world/$WISHKEY/index.html
|
|
||||||
|
|
||||||
# PERSONNALISATION
|
|
||||||
sed -i "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/game/world/$WISHKEY/index.html
|
|
||||||
sed -i "s~_PSEUDO_~${PSEUDO}~g" ~/.zen/game/world/$WISHKEY/index.html
|
|
||||||
sed -i "s~_PLAYER_~${PLAYER}~g" ~/.zen/game/world/$WISHKEY/index.html
|
|
||||||
sed -i "s~_G1PUB_~${G1PUB}~g" ~/.zen/game/world/$WISHKEY/index.html
|
|
||||||
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
|
|
||||||
|
|
||||||
# IPNS KEY is WISHKEY / VOEUXNS
|
|
||||||
sed -i "s~_MEDIAKEY_~${WISHKEY}~g" ~/.zen/game/world/$WISHKEY/index.html
|
|
||||||
sed -i "s~k2k4r8naeti1ny2hsk3a0ziwz22urwiu633hauluwopf4vwjk4x68qgk~${VOEUXNS}~g" ~/.zen/game/world/$WISHKEY/index.html
|
|
||||||
# ASTROPORT RELAY
|
|
||||||
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/world/$WISHKEY/index.html
|
|
||||||
|
|
||||||
echo "# CREATION QR CODE"
|
|
||||||
HOST="$(hostname).local"
|
|
||||||
|
|
||||||
qrencode -s 6 -o "$HOME/.zen/game/world/$WISHKEY/QR.WISHLINK.png" "http://$HOST:8080/ipns/$VOEUXNS"
|
|
||||||
qrencode -s 6 -o "$HOME/.zen/game/world/$WISHKEY/QR.ASTROLINK.png" "http://$HOST:8080/ipns/$ASTRONAUTENS"
|
|
||||||
qrencode -s 6 -o "$HOME/.zen/game/world/$WISHKEY/QR.G1ASTRO.png" "$G1PUB"
|
|
||||||
qrencode -s 6 -o "$HOME/.zen/game/world/$WISHKEY/QR.G1WISH.png" "$WISHKEY"
|
|
||||||
qrencode -s 6 -o "$HOME/.zen/game/world/$WISHKEY/QR.IPNS.png" "/ipns/$VOEUXNS"
|
|
||||||
|
|
||||||
# Bricolage avec node tiddlywiki (TODO add tiddler with command line)
|
|
||||||
#
|
|
||||||
cd ~/.zen/game/world/$WISHKEY
|
|
||||||
tiddlywiki $WISHKEY --load ~/.zen/game/world/$WISHKEY/index.html --savewikifolder ./tw/
|
|
||||||
cd -
|
|
||||||
|
|
||||||
# PREMIER TYPE
|
|
||||||
convert $HOME/.zen/game/world/$WISHKEY/QR.WISHLINK.png -resize 300 /tmp/QR.png
|
|
||||||
convert ${MY_PATH}/images/logoastro.png -resize 220 /tmp/ASTROLOGO.png
|
|
||||||
convert ${MY_PATH}/images/logojeu.png -resize 260 /tmp/MIZLOGO.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/QR.png /tmp/astroport.png /tmp/one.png
|
|
||||||
convert -gravity northwest -pointsize 35 -fill black -draw "text 320,250 \"$PSEUDO\"" /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 40 -fill black -draw "text 320,350 \"$PEPPER\"" /tmp/salt.png /tmp/player.png
|
|
||||||
|
|
||||||
# SECOND TYPE
|
|
||||||
convert $HOME/.zen/game/world/$WISHKEY/QR.G1WISH.png -resize 300 /tmp/G1.png
|
|
||||||
convert $HOME/.zen/game/world/$WISHKEY/QR.IPNS.png -resize 300 /tmp/IPNS.png
|
|
||||||
|
|
||||||
composite -compose Over -gravity NorthWest -geometry +300+0 /tmp/G1.png ${MY_PATH}/images/Brother_600x400.png /tmp/astroport.png
|
|
||||||
composite -compose Over -gravity NorthWest -geometry +0+0 /tmp/IPNS.png /tmp/astroport.png /tmp/one.png
|
|
||||||
composite -compose Over -gravity NorthWest -geometry +320+280 /tmp/MIZLOGO.png /tmp/one.png /tmp/two.png
|
|
||||||
|
|
||||||
convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"Ğ1 RÊVE\"" /tmp/play.png /tmp/voeu.png
|
|
||||||
convert -gravity northwest -pointsize 28 -fill black -draw "text 32,350 \"$PEPPER\"" /tmp/two.png /tmp/play.png
|
|
||||||
|
|
||||||
|
|
||||||
# IMAGE IPFS
|
|
||||||
IREVE=$(ipfs add -Hq /tmp/voeu.png | tail -n 1)
|
|
||||||
sed -i "s~bafybeidhghlcx3zdzdah2pzddhoicywmydintj4mosgtygr6f2dlfwmg7a~${IREVE}~g" ~/.zen/game/world/$WISHKEY/index.html
|
|
||||||
|
|
||||||
# PRINTING
|
|
||||||
LP=$(ls /dev/usb/lp* | head -n1)
|
|
||||||
[[ ! $LP ]] && echo "NO PRINTER FOUND - Brother QL700 validated" # && exit 1
|
|
||||||
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
|
|
||||||
|
|
||||||
# PUBLISHING
|
|
||||||
echo "## ${PLAYER} RECORDING YOU WISH INTO BLOCKCHAIN"
|
|
||||||
echo "ipfs add -rHq ~/.zen/game/world/$WISHKEY/
|
|
||||||
ipfs name publish --key=${WISHKEY} /ipfs/\$IPUSH"
|
|
||||||
IPUSH=$(ipfs add -rHq ~/.zen/game/world/$WISHKEY/ | tail -n 1)
|
|
||||||
echo $IPUSH > ~/.zen/game/world/$WISHKEY/.chain # Contains last IPFS backup PLAYER KEY
|
|
||||||
echo $MOATS > ~/.zen/game/world/$WISHKEY/.moats
|
|
||||||
ipfs name publish --key=${WISHKEY} /ipfs/$IPUSH 2>/dev/null
|
|
||||||
|
|
||||||
echo "CAPSULE A REVE $PEPPER : http://127.0.0.1:8080/ipns/$VOEUXNS"
|
|
||||||
|
|
||||||
echo "PRESSEZ ENTRER POUR CONTINUER"
|
|
||||||
read
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
exit 0
|
|
@ -13,7 +13,7 @@ ME="${0##*/}"
|
|||||||
# ${MY_PATH}/G1BILLET_MAKE.sh "nu me ro test" "se cr et" 100 7sn9dKeCNEsHmqm1gMWNREke4YAWtNw8KG1YBSN8CmSh 97968583
|
# ${MY_PATH}/G1BILLET_MAKE.sh "nu me ro test" "se cr et" 100 7sn9dKeCNEsHmqm1gMWNREke4YAWtNw8KG1YBSN8CmSh 97968583
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
NUMERO="$1"
|
SALT="$1"
|
||||||
SECRET="$2"
|
SECRET="$2"
|
||||||
MONTANT="$3"
|
MONTANT="$3"
|
||||||
NOTERIB="$4"
|
NOTERIB="$4"
|
||||||
@ -24,13 +24,13 @@ ASTRONAUTENS="$7"
|
|||||||
EMAIL="$8"
|
EMAIL="$8"
|
||||||
[[ ! $EMAIL ]] && EMAIL="________@____________"
|
[[ ! $EMAIL ]] && EMAIL="________@____________"
|
||||||
|
|
||||||
if [[ "$NUMERO" == "" || "$SECRET" == "" || "$MONTANT" == "" || "$NOTERIB" == "" || "$UNIQID" == "" ]]
|
if [[ "$SALT" == "" || "$SECRET" == "" || "$MONTANT" == "" || "$NOTERIB" == "" || "$UNIQID" == "" ]]
|
||||||
then
|
then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p ${MY_PATH}/tmp/g1billet/$UNIQID
|
mkdir -p ${MY_PATH}/tmp/g1billet/$UNIQID
|
||||||
BILLETNAME=$(echo $NUMERO | sed 's/ /_/g')
|
BILLETNAME=$(echo $SALT | sed 's/ /_/g')
|
||||||
|
|
||||||
# Prepare June logo color
|
# Prepare June logo color
|
||||||
case "$MONTANT" in
|
case "$MONTANT" in
|
||||||
@ -75,7 +75,7 @@ else
|
|||||||
composite -compose Over -gravity SouthEast -geometry +35+50 "${MY_PATH}/tmp/g1billet/${UNIQID}/${BILLETNAME}.QR.png" "${MY_PATH}/tmp/${BILLETNAME}.jpg" "${MY_PATH}/tmp/${BILLETNAME}.jpg"
|
composite -compose Over -gravity SouthEast -geometry +35+50 "${MY_PATH}/tmp/g1billet/${UNIQID}/${BILLETNAME}.QR.png" "${MY_PATH}/tmp/${BILLETNAME}.jpg" "${MY_PATH}/tmp/${BILLETNAME}.jpg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add June LOGO to Billet
|
# Add g1 LOGO to Billet
|
||||||
composite -compose Over -gravity NorthEast -geometry +50+25 -dissolve 90% "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png" "${MY_PATH}/tmp/${BILLETNAME}.jpg" "${MY_PATH}/tmp/${BILLETNAME}.jpg"
|
composite -compose Over -gravity NorthEast -geometry +50+25 -dissolve 90% "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png" "${MY_PATH}/tmp/${BILLETNAME}.jpg" "${MY_PATH}/tmp/${BILLETNAME}.jpg"
|
||||||
|
|
||||||
# xbian style (ASTROPORT/KODI) + JEU
|
# xbian style (ASTROPORT/KODI) + JEU
|
||||||
@ -83,7 +83,7 @@ if [[ "${STYLE}" == "xbian" || "${STYLE}" == "jeu" || "${STYLE}" == "astro" ]]
|
|||||||
then
|
then
|
||||||
# CREATE PSEUDO for Gchange.fr
|
# CREATE PSEUDO for Gchange.fr
|
||||||
XZUID="$EMAIL"
|
XZUID="$EMAIL"
|
||||||
BOTTOM="REBOOT : https://astroport.copylaradio.com"
|
BOTTOM="ASTROPORT - IPFS TW - https://astroport.copylaradio.com"
|
||||||
else
|
else
|
||||||
XZUID="G1 BILLET"
|
XZUID="G1 BILLET"
|
||||||
BOTTOM="Porte Monnaie Libre!! https://gchange.fr https://cesium.app"
|
BOTTOM="Porte Monnaie Libre!! https://gchange.fr https://cesium.app"
|
||||||
@ -95,17 +95,17 @@ convert -font 'Liberation-Sans' \
|
|||||||
-pointsize 40 -fill black -draw 'text 70,50 "'"$XZUID"'"' \
|
-pointsize 40 -fill black -draw 'text 70,50 "'"$XZUID"'"' \
|
||||||
-pointsize 120 -fill black -draw 'text 325,250 "'"$MONTANT DU"'"' \
|
-pointsize 120 -fill black -draw 'text 325,250 "'"$MONTANT DU"'"' \
|
||||||
-pointsize 20 -fill black -draw 'text 380,20 "'"${NOTERIB}"'"' \
|
-pointsize 20 -fill black -draw 'text 380,20 "'"${NOTERIB}"'"' \
|
||||||
-pointsize 30 -draw 'text 50,100 "'"Identifiant: $NUMERO"'"' \
|
-pointsize 30 -draw 'text 50,100 "'"Identifiant: $SALT"'"' \
|
||||||
-pointsize 22 -fill black -draw 'text 50,130 "'"Code Secret: $SECRET"'"' \
|
-pointsize 22 -fill black -draw 'text 50,130 "'"Code Secret: $SECRET"'"' \
|
||||||
-pointsize 25 -fill black -draw 'text 150,440 "'"$BOTTOM"'"' \
|
-pointsize 25 -fill black -draw 'text 150,440 "'"$BOTTOM"'"' \
|
||||||
"${MY_PATH}/tmp/${BILLETNAME}.jpg" "${MY_PATH}/tmp/g1billet/${UNIQID}/${BILLETNAME}.BILLET.jpg"
|
"${MY_PATH}/tmp/${BILLETNAME}.jpg" "${MY_PATH}/tmp/g1billet/${UNIQID}/${BILLETNAME}.BILLET.jpg"
|
||||||
else
|
else
|
||||||
convert -font 'Liberation-Sans' \
|
convert -font 'Liberation-Sans' \
|
||||||
-pointsize 40 -fill black -draw 'text 70,60 "'"$XZUID"'"' \
|
-pointsize 40 -fill black -draw 'text 50,60 "'"$XZUID"'"' \
|
||||||
-pointsize 20 -fill black -draw 'text 380,30 "'"${NOTERIB}"'"' \
|
-pointsize 20 -fill black -draw 'text 380,26 "'"${NOTERIB}"'"' \
|
||||||
-pointsize 30 -draw 'text 50,100 "'"Secret 1: $NUMERO"'"' \
|
-pointsize 30 -draw 'text 50,100 "'"Secret 1: $SALT"'"' \
|
||||||
-pointsize 30 -fill black -draw 'text 50,130 "'"Secret 2: $SECRET"'"' \
|
-pointsize 30 -fill black -draw 'text 50,130 "'"Secret 2: $SECRET"'"' \
|
||||||
-pointsize 25 -fill black -draw 'text 150,440 "'"$BOTTOM"'"' \
|
-pointsize 25 -fill black -draw 'text 50,440 "'"$BOTTOM"'"' \
|
||||||
"${MY_PATH}/tmp/${BILLETNAME}.jpg" "${MY_PATH}/tmp/g1billet/${UNIQID}/${BILLETNAME}.BILLET.jpg"
|
"${MY_PATH}/tmp/${BILLETNAME}.jpg" "${MY_PATH}/tmp/g1billet/${UNIQID}/${BILLETNAME}.BILLET.jpg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user