2021-01-24 19:21:49 +01:00
|
|
|
#!/bin/bash
|
|
|
|
################################################################################
|
|
|
|
# Author: Fred (support@qo-op.com)
|
|
|
|
# Version: 0.1
|
|
|
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
|
|
################################################################################
|
|
|
|
# INSTALLER convert et qrencode: sudo apt install imagemagick qrencode
|
|
|
|
################################################################################
|
|
|
|
MY_PATH="`dirname \"$0\"`" # relative
|
|
|
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
|
|
ME="${0##*/}"
|
|
|
|
############################################################################################################################################################
|
|
|
|
# ${MY_PATH}/G1BILLET_MAKE.sh "nu me ro test" "se cr et" 100 7sn9dKeCNEsHmqm1gMWNREke4YAWtNw8KG1YBSN8CmSh 97968583
|
|
|
|
############################################################################
|
|
|
|
|
2022-12-07 14:33:34 +01:00
|
|
|
SALT="$1"
|
2021-01-24 19:21:49 +01:00
|
|
|
SECRET="$2"
|
|
|
|
MONTANT="$3"
|
|
|
|
NOTERIB="$4"
|
|
|
|
UNIQID="$5"
|
2021-01-26 22:54:49 +01:00
|
|
|
STYLE="$6"
|
2022-12-06 22:16:21 +01:00
|
|
|
## ASTRO TW MODE
|
2022-12-06 01:00:20 +01:00
|
|
|
ASTRONAUTENS="$7"
|
2023-03-26 01:27:18 +01:00
|
|
|
EMAIL="$8"
|
2021-01-24 19:21:49 +01:00
|
|
|
|
2022-12-07 14:33:34 +01:00
|
|
|
if [[ "$SALT" == "" || "$SECRET" == "" || "$MONTANT" == "" || "$NOTERIB" == "" || "$UNIQID" == "" ]]
|
2021-01-24 19:21:49 +01:00
|
|
|
then
|
2023-03-10 02:39:50 +01:00
|
|
|
echo "ERROR MISSING PARAM"
|
2022-02-19 17:42:15 +01:00
|
|
|
exit 1
|
2021-01-24 19:21:49 +01:00
|
|
|
fi
|
|
|
|
|
2022-12-06 14:49:27 +01:00
|
|
|
mkdir -p ${MY_PATH}/tmp/g1billet/$UNIQID
|
2022-12-07 14:33:34 +01:00
|
|
|
BILLETNAME=$(echo $SALT | sed 's/ /_/g')
|
2021-01-24 19:21:49 +01:00
|
|
|
|
2022-12-06 01:00:20 +01:00
|
|
|
# Prepare June logo color
|
2021-01-24 19:21:49 +01:00
|
|
|
case "$MONTANT" in
|
2022-02-19 17:42:15 +01:00
|
|
|
1)
|
2023-04-19 22:12:16 +02:00
|
|
|
convert "${MY_PATH}/images/${STYLE}/g1.png" -fuzz 20% -fill grey -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
|
|
|
2)
|
2023-04-19 22:12:16 +02:00
|
|
|
convert "${MY_PATH}/images/${STYLE}/g1.png" -fuzz 20% -fill green -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
|
|
|
5)
|
2023-04-19 22:12:16 +02:00
|
|
|
convert "${MY_PATH}/images/${STYLE}/g1.png" -fuzz 20% -fill orange -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
|
|
|
10)
|
2023-04-19 22:12:16 +02:00
|
|
|
convert "${MY_PATH}/images/${STYLE}/g1.png" -fuzz 20% -fill blue -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
|
|
|
20)
|
2023-04-19 22:12:16 +02:00
|
|
|
convert "${MY_PATH}/images/${STYLE}/g1.png" -fuzz 20% -fill purple -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
|
|
|
50)
|
2023-04-19 22:12:16 +02:00
|
|
|
convert "${MY_PATH}/images/${STYLE}/g1.png" -fuzz 20% -fill red -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
|
|
|
100)
|
2023-04-19 22:12:16 +02:00
|
|
|
convert "${MY_PATH}/images/${STYLE}/g1.png" -fuzz 20% -fill black -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
|
|
|
*)
|
2023-04-19 22:12:16 +02:00
|
|
|
cp "${MY_PATH}/images/${STYLE}/g1.png" "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
2021-01-24 19:21:49 +01:00
|
|
|
esac
|
|
|
|
|
2022-12-06 01:00:20 +01:00
|
|
|
|
|
|
|
# Add ${MY_PATH}/images/logo.png (250px)
|
2023-03-26 01:27:18 +01:00
|
|
|
composite -compose Over -gravity SouthWest -geometry +150+50 -dissolve 70% \
|
2023-04-19 22:12:16 +02:00
|
|
|
"${MY_PATH}/images/${STYLE}/logo.png" \
|
|
|
|
"${MY_PATH}/images/${STYLE}/fond.jpg" \
|
2023-03-26 01:27:18 +01:00
|
|
|
"${MY_PATH}/tmp/${BILLETNAME}.jpg"
|
2022-12-06 01:00:20 +01:00
|
|
|
|
2023-04-19 22:12:16 +02:00
|
|
|
# "G1PASS" (GPG+TW) STYLE : xbian, xjeu, xastro
|
|
|
|
if [[ "${STYLE:0:1}" == "x" ]]
|
2021-01-29 00:07:25 +01:00
|
|
|
then
|
2023-03-10 02:39:50 +01:00
|
|
|
|
|
|
|
if [[ $ASTRONAUTENS ]]; then
|
|
|
|
## IT IS AN ASTRONAUTENS IPNS LINK
|
2023-03-26 01:27:18 +01:00
|
|
|
USALT=$(echo "$SALT" | jq -Rr @uri)
|
|
|
|
UPEPPER=$(echo "$SECRET" | jq -Rr @uri)
|
2023-04-19 22:12:16 +02:00
|
|
|
echo "(≖‿‿≖) Making gpg of /?salt=${USALT}&pepper=${UPEPPER} with pass=$UNIQID"
|
2023-04-08 15:37:46 +02:00
|
|
|
|
|
|
|
## SECURED RANDOM salt : pepper GPG SEQUENCE
|
|
|
|
s=$(${MY_PATH}/diceware.sh 1 | xargs)
|
|
|
|
p=$(${MY_PATH}/diceware.sh 1 | xargs)
|
2023-04-14 22:57:03 +02:00
|
|
|
echo "/?${s}=${USALT}&${p}=${UPEPPER}" > ~/.zen/tmp/topgp
|
|
|
|
cat ~/.zen/tmp/topgp | gpg --symmetric --armor --batch --passphrase "$UNIQID" -o ${MY_PATH}/tmp/gpg.${BILLETNAME}.asc
|
2023-03-26 01:27:18 +01:00
|
|
|
|
2023-04-19 22:12:16 +02:00
|
|
|
rm ~/.zen/tmp/topgp ## CLEANING CACHE
|
|
|
|
|
2023-03-31 16:01:20 +02:00
|
|
|
DISCO="$(cat ${MY_PATH}/tmp/gpg.${BILLETNAME}.asc | tr '-' '~' | tr '\n' '-' | tr '+' '_' | jq -Rr @uri )"
|
|
|
|
echo "$DISCO"
|
2023-03-26 01:27:18 +01:00
|
|
|
## Add logo to QRCode
|
2023-03-31 16:01:20 +02:00
|
|
|
cp ${MY_PATH}/images/astrologo_nb.png ${MY_PATH}/tmp/fond.png
|
2023-03-26 01:27:18 +01:00
|
|
|
|
|
|
|
## MAKE amzqr WITH astro:// LINK
|
2023-03-31 16:01:20 +02:00
|
|
|
amzqr -d ${MY_PATH}/tmp \
|
2023-03-26 01:27:18 +01:00
|
|
|
-l H \
|
2023-03-31 16:01:20 +02:00
|
|
|
-p ${MY_PATH}/tmp/fond.png \
|
|
|
|
"$DISCO"
|
2023-03-26 01:27:18 +01:00
|
|
|
|
|
|
|
## ADD PLAYER EMAIL
|
2023-04-20 22:15:18 +02:00
|
|
|
convert -gravity southeast -pointsize 28 -fill black -draw "text 5,3 \"$EMAIL\"" ${MY_PATH}/tmp/fond_qrcode.png ${MY_PATH}/tmp/g1billet/${UNIQID}/${BILLETNAME}.G1PASS.png
|
|
|
|
convert ${MY_PATH}/tmp/g1billet/${UNIQID}/${BILLETNAME}.G1PASS.png -resize 300 ${MY_PATH}/tmp/g1billet/${UNIQID}/${BILLETNAME}.TW.png
|
2023-03-26 01:27:18 +01:00
|
|
|
|
|
|
|
composite -compose Over -gravity SouthWest -geometry +50+50 \
|
|
|
|
"${MY_PATH}/tmp/g1billet/${UNIQID}/${BILLETNAME}.TW.png" \
|
|
|
|
"${MY_PATH}/tmp/${BILLETNAME}.jpg" \
|
|
|
|
"${MY_PATH}/tmp/${BILLETNAME}.jpg"
|
|
|
|
|
|
|
|
rm ${MY_PATH}/tmp/gpg.${BILLETNAME}.asc
|
|
|
|
|
2023-03-31 16:01:20 +02:00
|
|
|
if [[ ${STYLE} == "xbian" ]]; then
|
|
|
|
amzqr "https://ipfs.copylaradio.com/ipns/$ASTRONAUTENS" -l H -p "$MY_PATH/images/moa_net.png" -c -n QRTWavatar.png -d ${MY_PATH}/tmp/g1billet/${UNIQID}/
|
|
|
|
convert ${MY_PATH}/tmp/g1billet/${UNIQID}/QRTWavatar.png -resize 260 ${MY_PATH}/tmp/g1billet/${UNIQID}/300.png
|
|
|
|
composite -compose Over -gravity Center -geometry +40+40 \
|
|
|
|
"${MY_PATH}/tmp/g1billet/${UNIQID}/300.png" \
|
|
|
|
"${MY_PATH}/tmp/${BILLETNAME}.jpg" \
|
|
|
|
"${MY_PATH}/tmp/${BILLETNAME}.jpg"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2023-03-10 02:39:50 +01:00
|
|
|
fi
|
|
|
|
|
2023-03-26 01:27:18 +01:00
|
|
|
# ENTETE ET BAS DE BILLET
|
2023-04-15 22:28:50 +02:00
|
|
|
XZUID="__________@__________"
|
2023-03-13 15:10:01 +01:00
|
|
|
BOTTOM="$(date) :: $(hostname) :: ♥Box ::"
|
2023-03-10 02:39:50 +01:00
|
|
|
|
2022-02-19 17:42:15 +01:00
|
|
|
else
|
2023-03-10 02:39:50 +01:00
|
|
|
|
2022-02-19 17:42:15 +01:00
|
|
|
XZUID="G1 BILLET"
|
2023-03-13 15:10:01 +01:00
|
|
|
BOTTOM="$(date) :: https://gchange.fr :: https://cesium.app :: $(hostname)"
|
2023-03-10 02:39:50 +01:00
|
|
|
|
2021-01-29 00:07:25 +01:00
|
|
|
fi
|
|
|
|
|
2023-03-10 02:39:50 +01:00
|
|
|
# G1PUB QR CODE
|
|
|
|
qrencode -s 6 -o "${MY_PATH}/tmp/g1billet/${UNIQID}/${BILLETNAME}.QR.png" "$NOTERIB"
|
|
|
|
|
2023-03-26 01:27:18 +01:00
|
|
|
# AJOUT DU QRCODE SUR LE FOND DE BILLET
|
|
|
|
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"
|
|
|
|
|
|
|
|
# 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"
|
2023-03-10 02:39:50 +01:00
|
|
|
|
2021-06-02 03:08:44 +02:00
|
|
|
|
|
|
|
if [[ "$MONTANT" != "___" ]]; then
|
2021-01-24 19:21:49 +01:00
|
|
|
convert -font 'Liberation-Sans' \
|
2021-01-31 01:26:14 +01:00
|
|
|
-pointsize 40 -fill black -draw 'text 70,50 "'"$XZUID"'"' \
|
2023-03-10 02:45:12 +01:00
|
|
|
-pointsize 120 -fill black -draw 'text 450,250 "'"$MONTANT"'"' \
|
2021-02-03 15:14:08 +01:00
|
|
|
-pointsize 20 -fill black -draw 'text 380,20 "'"${NOTERIB}"'"' \
|
2022-12-07 14:33:34 +01:00
|
|
|
-pointsize 30 -draw 'text 50,100 "'"Identifiant: $SALT"'"' \
|
2021-01-24 19:21:49 +01:00
|
|
|
-pointsize 22 -fill black -draw 'text 50,130 "'"Code Secret: $SECRET"'"' \
|
2023-04-19 04:55:43 +02:00
|
|
|
-pointsize 25 -fill black -draw 'text 50,440 "'"$BOTTOM"'"' \
|
2022-12-06 14:49:27 +01:00
|
|
|
"${MY_PATH}/tmp/${BILLETNAME}.jpg" "${MY_PATH}/tmp/g1billet/${UNIQID}/${BILLETNAME}.BILLET.jpg"
|
2021-06-02 03:08:44 +02:00
|
|
|
else
|
|
|
|
convert -font 'Liberation-Sans' \
|
2023-04-16 22:05:13 +02:00
|
|
|
-pointsize 35 -fill black -draw 'text 50,56 "'"$XZUID"'"' \
|
2023-04-16 22:07:15 +02:00
|
|
|
-pointsize 22 -fill black -draw 'text 340,26 "'"${NOTERIB}"'"' \
|
2023-04-15 22:28:50 +02:00
|
|
|
-pointsize 22 -draw 'text 50,90 "'"Secret 1: $SALT"'"' \
|
2023-04-16 22:05:13 +02:00
|
|
|
-pointsize 22 -fill black -draw 'text 50,110 "'"Secret 2: $SECRET"'"' \
|
2023-03-13 15:10:01 +01:00
|
|
|
-pointsize 25 -fill white -draw 'text 50,440 "'"$BOTTOM"'"' \
|
2022-12-06 14:49:27 +01:00
|
|
|
"${MY_PATH}/tmp/${BILLETNAME}.jpg" "${MY_PATH}/tmp/g1billet/${UNIQID}/${BILLETNAME}.BILLET.jpg"
|
2021-06-02 03:08:44 +02:00
|
|
|
fi
|
2021-01-24 19:21:49 +01:00
|
|
|
|
2022-12-06 14:49:27 +01:00
|
|
|
rm -f ${MY_PATH}/tmp/${BILLETNAME}.jpg
|
2023-03-31 16:01:20 +02:00
|
|
|
|
2023-03-26 01:27:18 +01:00
|
|
|
exit 0
|
|
|
|
|