2022-03-02 18:37:42 +01:00
|
|
|
#!/bin/bash
|
|
|
|
################################################################################
|
|
|
|
# Author: Fred (support@qo-op.com)
|
|
|
|
# Version: 0.1
|
|
|
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
|
|
################################################################################
|
|
|
|
################################################################################
|
|
|
|
# PREPARE BROTHER QL STICKERS
|
|
|
|
################################################################################
|
|
|
|
MY_PATH="`dirname \"$0\"`" # relative
|
|
|
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
2022-12-29 14:51:05 +01:00
|
|
|
. "$MY_PATH/my.sh"
|
2022-03-02 18:37:42 +01:00
|
|
|
|
2022-12-09 15:55:27 +01:00
|
|
|
PLAYER="$1"
|
|
|
|
|
|
|
|
[[ ! -f ~/.zen/game/players/${PLAYER}/QR.png ]] &&\
|
|
|
|
echo "ERREUR. Aucun PLAYER Astronaute connecté .ERREUR ~/.zen/game/players/${PLAYER}/" && exit 1
|
2022-05-09 01:41:40 +02:00
|
|
|
|
|
|
|
# Check who is .current PLAYER
|
2022-12-09 15:55:27 +01:00
|
|
|
PLAYER=$(cat ~/.zen/game/players/${PLAYER}/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
|
|
|
|
PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null) || ( echo "nopseudo" && exit 1 )
|
|
|
|
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
|
2023-04-04 20:33:01 +02:00
|
|
|
ASTRONAUTENS=$(cat ~/.zen/game/players/${PLAYER}/.playerns 2>/dev/null) || ( echo "noastronautens" && exit 1 )
|
2022-03-02 18:37:42 +01:00
|
|
|
|
2022-12-09 15:55:27 +01:00
|
|
|
PASS=$(cat ~/.zen/game/players/${PLAYER}/.pass)
|
2022-05-09 01:41:40 +02:00
|
|
|
|
2023-04-04 20:33:01 +02:00
|
|
|
source ~/.zen/game/players/${PLAYER}/secret.june
|
|
|
|
[[ $SALT == "" ]] && echo "BAD ACCOUNT. PLEASE BACKUP. MOVE. RESTORE." && exit 1
|
2022-03-02 18:37:42 +01:00
|
|
|
|
|
|
|
LP=$(ls /dev/usb/lp*)
|
2022-08-18 18:32:01 +02:00
|
|
|
|
2023-04-08 15:48:14 +02:00
|
|
|
PASS=$(echo "${RANDOM}${RANDOM}${RANDOM}${RANDOM}" | tail -c-7)
|
|
|
|
|
2023-04-04 20:33:01 +02:00
|
|
|
# USE G1BILLET GENERATOR
|
|
|
|
[[ -s ~/.zen/G1BILLET/MAKE_G1BILLET.sh ]] \
|
|
|
|
&& echo ~/.zen/G1BILLET/MAKE_G1BILLET.sh "$SALT" "$PEPPER" "___" "$G1PUB" "$PASS" "xbian" "$ASTRONAUTENS" "$PLAYER" \
|
|
|
|
&& ~/.zen/G1BILLET/MAKE_G1BILLET.sh "$SALT" "$PEPPER" "___" "$G1PUB" "$PASS" "xbian" "$ASTRONAUTENS" "$PLAYER"
|
|
|
|
|
2023-04-08 15:48:14 +02:00
|
|
|
s=$(${MY_PATH}/diceware.sh 1 | xargs)
|
|
|
|
p=$(${MY_PATH}/diceware.sh 1 | xargs)
|
2023-04-04 20:33:01 +02:00
|
|
|
BILLETNAME=$(echo "$SALT" | sed 's/ /_/g')
|
2023-04-08 15:48:14 +02:00
|
|
|
|
|
|
|
mv ~/.zen/G1BILLET/tmp/g1billet/$PASS/$BILLETNAME.BILLET.jpg ~/.zen/tmp/$PASS.jpg
|
|
|
|
|
|
|
|
[[ $XDG_SESSION_TYPE == 'x11' ]] && xdg-open ~/.zen/tmp/$PASS.jpg
|
2023-04-04 20:33:01 +02:00
|
|
|
|
|
|
|
USALT=$(echo "$SALT" | jq -Rr @uri)
|
2023-04-14 23:18:04 +02:00
|
|
|
UPEPPER=$(echo "$PEPPER" | jq -Rr @uri)
|
2023-04-14 22:57:12 +02:00
|
|
|
echo "/?${s}=${USALT}&${p}=${UPEPPER}" > ~/.zen/tmp/topgp
|
2023-04-14 23:18:04 +02:00
|
|
|
cat ~/.zen/tmp/topgp | gpg --symmetric --armor --batch --passphrase "$PASS" -o ~/.zen/tmp/gpg.${PASS}.asc
|
2023-04-04 20:33:01 +02:00
|
|
|
|
2023-04-14 23:18:04 +02:00
|
|
|
DISCO="$(cat ~/.zen/tmp/gpg.${PASS}.asc | tr '-' '~' | tr '\n' '-' | tr '+' '_' | jq -Rr @uri )"
|
2023-04-04 20:33:01 +02:00
|
|
|
echo "$DISCO"
|
|
|
|
## Add logo to QRCode
|
|
|
|
cp ${MY_PATH}/../images/g1magicien.png ~/.zen/tmp/fond.png
|
|
|
|
|
|
|
|
## MAKE amzqr WITH astro:// LINK
|
|
|
|
amzqr -d ~/.zen/tmp \
|
|
|
|
-l H \
|
|
|
|
-p ~/.zen/tmp/fond.png \
|
|
|
|
"$DISCO"
|
|
|
|
|
|
|
|
## ADD PLAYER EMAIL
|
2023-04-14 23:18:04 +02:00
|
|
|
convert -gravity southeast -pointsize 28 -fill black -draw "text 5,3 \"$EMAIL\"" ~/.zen/tmp/fond_qrcode.png ~/.zen/tmp/${PASS}.TW.png
|
2023-04-04 20:33:01 +02:00
|
|
|
|
2023-04-14 23:18:04 +02:00
|
|
|
[[ $XDG_SESSION_TYPE == 'x11' ]] && xdg-open ~/.zen/tmp/${PASS}.TW.png
|
2023-04-04 20:33:01 +02:00
|
|
|
|
2023-04-14 23:18:04 +02:00
|
|
|
brother_ql_create --model QL-700 --label-size 62 ~/.zen/tmp/${PASS}.TW.png > ~/.zen/tmp/bill.bin 2>/dev/null
|
2023-04-14 22:57:12 +02:00
|
|
|
sudo brother_ql_print ~/.zen/tmp/bill.bin $LP
|
2023-04-04 20:33:01 +02:00
|
|
|
|
|
|
|
convert ~/.zen/game/players/${PLAYER}/QRG1avatar.png -resize 300 ~/.zen/tmp/QR.png
|
|
|
|
convert ${MY_PATH}/../images/astroport.jpg -resize 300 ~/.zen/tmp/ASTROPORT.png
|
2022-03-02 18:37:42 +01:00
|
|
|
|
2023-04-04 20:33:01 +02:00
|
|
|
composite -compose Over -gravity SouthWest -geometry +280+20 ~/.zen/tmp/ASTROPORT.png ${MY_PATH}/../images/Brother_600x400.png ~/.zen/tmp/astroport.png
|
|
|
|
composite -compose Over -gravity NorthWest -geometry +0+0 ~/.zen/tmp/QR.png ~/.zen/tmp/astroport.png ~/.zen/tmp/one.png
|
|
|
|
# composite -compose Over -gravity NorthWest -geometry +280+280 ~/.zen/game/players/${PLAYER}/QRsec.png ~/.zen/tmp/one.png ~/.zen/tmp/image.png
|
2022-03-02 18:37:42 +01:00
|
|
|
|
2023-04-04 20:33:01 +02:00
|
|
|
convert -gravity northwest -pointsize 35 -fill black -draw "text 50,300 \"$PSEUDO\"" ~/.zen/tmp/one.png ~/.zen/tmp/image.png
|
|
|
|
convert -gravity northwest -pointsize 30 -fill black -draw "text 300,40 \"$PLAYER\"" ~/.zen/tmp/image.png ~/.zen/tmp/pseudo.png
|
|
|
|
convert -gravity northeast -pointsize 25 -fill black -draw "text 20,180 \"$PASS\"" ~/.zen/tmp/pseudo.png ~/.zen/tmp/pass.png
|
|
|
|
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,100 \"$SALT\"" ~/.zen/tmp/pass.png ~/.zen/tmp/salt.png
|
|
|
|
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,140 \"$PEPPER\"" ~/.zen/tmp/salt.png ~/.zen/tmp/done.jpg
|
2022-03-02 18:37:42 +01:00
|
|
|
|
2023-04-04 20:33:01 +02:00
|
|
|
brother_ql_create --model QL-700 --label-size 62 ~/.zen/tmp/done.jpg > ~/.zen/tmp/toprint.bin 2>/dev/null
|
|
|
|
sudo brother_ql_print ~/.zen/tmp/toprint.bin $LP
|
2022-03-02 18:37:42 +01:00
|
|
|
|
2022-08-23 18:13:16 +02:00
|
|
|
################################################################
|
|
|
|
### PRINT PLAYER TW myIP link
|
2022-11-17 20:11:13 +01:00
|
|
|
|
2022-08-23 18:13:16 +02:00
|
|
|
playerns=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f1)
|
2022-12-29 14:51:05 +01:00
|
|
|
qrencode -s 12 -o "$HOME/.zen/tmp/QR.ASTRO.png" "$myIPFSGW/ipns/$playerns"
|
2023-04-04 20:33:01 +02:00
|
|
|
convert $HOME/.zen/tmp/QR.ASTRO.png -resize 600 ~/.zen/tmp/playerns.png
|
2022-08-23 18:13:16 +02:00
|
|
|
|
2023-04-04 20:33:01 +02:00
|
|
|
brother_ql_create --model QL-700 --label-size 62 ~/.zen/tmp/playerns.png > ~/.zen/tmp/toprint.bin 2>/dev/null
|
|
|
|
sudo brother_ql_print ~/.zen/tmp/toprint.bin $LP
|
2022-08-23 18:13:16 +02:00
|
|
|
################################################################
|
2022-08-18 18:32:01 +02:00
|
|
|
|
2022-03-02 18:37:42 +01:00
|
|
|
exit 0
|