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
|
|
|
|
############################################################################
|
|
|
|
|
2023-05-01 21:34:42 +02:00
|
|
|
## SEND LOG TO ~/.zen/tmp/_12345.log
|
|
|
|
exec 2>&1 >> ~/.zen/G1BILLET/tmp/G1BILLETS.log
|
|
|
|
|
2023-04-21 18:18:00 +02:00
|
|
|
## LOAD PERSONAL OR DEFAULT STYLES
|
|
|
|
[[ -d ${MY_PATH}/_images/_/ ]] \
|
|
|
|
&& IMAGES="_images" \
|
|
|
|
|| IMAGES="images"
|
|
|
|
echo "USING ${IMAGES} STYLES"
|
|
|
|
|
|
|
|
|
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-05-01 21:34:42 +02:00
|
|
|
convert "${MY_PATH}/${IMAGES}/${STYLE}/fond.jpg" -fuzz 20% -fill grey -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/fond.jpg"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
|
|
|
2)
|
2023-05-01 21:34:42 +02:00
|
|
|
convert "${MY_PATH}/${IMAGES}/${STYLE}/fond.jpg" -fuzz 20% -fill green -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/fond.jpg"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
|
|
|
5)
|
2023-05-01 21:34:42 +02:00
|
|
|
convert "${MY_PATH}/${IMAGES}/${STYLE}/fond.jpg" -fuzz 20% -fill orange -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/fond.jpg"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
|
|
|
10)
|
2023-05-01 21:34:42 +02:00
|
|
|
convert "${MY_PATH}/${IMAGES}/${STYLE}/fond.jpg" -fuzz 20% -fill blue -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/fond.jpg"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
|
|
|
20)
|
2023-05-01 21:34:42 +02:00
|
|
|
convert "${MY_PATH}/${IMAGES}/${STYLE}/fond.jpg" -fuzz 20% -fill purple -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/fond.jpg"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
|
|
|
50)
|
2023-05-01 21:34:42 +02:00
|
|
|
convert "${MY_PATH}/${IMAGES}/${STYLE}/fond.jpg" -fuzz 20% -fill red -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/fond.jpg"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
|
|
|
100)
|
2023-05-01 21:34:42 +02:00
|
|
|
convert "${MY_PATH}/${IMAGES}/${STYLE}/fond.jpg" -fuzz 20% -fill black -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/fond.jpg"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
|
|
|
*)
|
2023-05-01 21:34:42 +02:00
|
|
|
cp "${MY_PATH}/${IMAGES}/${STYLE}/fond.jpg" "${MY_PATH}/tmp/g1billet/${UNIQID}/fond.jpg"
|
2022-02-19 17:42:15 +01:00
|
|
|
;;
|
2021-01-24 19:21:49 +01:00
|
|
|
esac
|
|
|
|
|
2023-05-01 21:34:42 +02:00
|
|
|
## PREPARE LOGO
|
|
|
|
cp "${MY_PATH}/${IMAGES}/${STYLE}/g1.png" "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
|
|
|
|
|
|
|
|
# Add logo.png over FOND
|
|
|
|
composite -compose Over -dissolve 60% \
|
2023-04-21 18:18:00 +02:00
|
|
|
"${MY_PATH}/${IMAGES}/${STYLE}/logo.png" \
|
2023-05-01 21:34:42 +02:00
|
|
|
"${MY_PATH}/tmp/g1billet/${UNIQID}/fond.jpg" \
|
2023-03-26 01:27:18 +01:00
|
|
|
"${MY_PATH}/tmp/${BILLETNAME}.jpg"
|
2022-12-06 01:00:20 +01:00
|
|
|
|
2023-05-01 21:34:42 +02:00
|
|
|
## NOT TO BE IN FINAL PDF (getting all jpg)
|
|
|
|
rm "${MY_PATH}/tmp/g1billet/${UNIQID}/fond.jpg"
|
|
|
|
|
|
|
|
if [[ "${STYLE:0:1}" != "_" ]]
|
2021-01-29 00:07:25 +01:00
|
|
|
then
|
2023-05-01 21:34:42 +02:00
|
|
|
if [[ ${ASTRONAUTENS} ]]; then
|
|
|
|
## ♥Box :: G1PASS
|
|
|
|
BOTTOM="$(date) :: ♥Box :: G1PASS :: $(hostname) ::"
|
|
|
|
XZUID="__________@__________"
|
2023-03-10 02:39:50 +01:00
|
|
|
|
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-04-21 18:18:00 +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-05-01 21:34:42 +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
|
2023-04-20 22:15:18 +02:00
|
|
|
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-05-01 21:34:42 +02:00
|
|
|
if [[ "${STYLE:0:1}" == "x" ]]; then
|
|
|
|
|
|
|
|
[[ "${EMAIL}" != "" ]] && XZUID="${EMAIL}"
|
|
|
|
## ♥Box :: G1TW (central IPFS QRCODE)
|
|
|
|
BOTTOM="$(date) :: ♥Box :: G1TW :: $(hostname) ::"
|
|
|
|
|
|
|
|
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}/
|
2023-03-31 16:01:20 +02:00
|
|
|
convert ${MY_PATH}/tmp/g1billet/${UNIQID}/QRTWavatar.png -resize 260 ${MY_PATH}/tmp/g1billet/${UNIQID}/300.png
|
2023-05-01 21:34:42 +02:00
|
|
|
composite -compose Over -gravity Center -geometry +30+40 \
|
2023-03-31 16:01:20 +02:00
|
|
|
"${MY_PATH}/tmp/g1billet/${UNIQID}/300.png" \
|
|
|
|
"${MY_PATH}/tmp/${BILLETNAME}.jpg" \
|
|
|
|
"${MY_PATH}/tmp/${BILLETNAME}.jpg"
|
2023-05-01 21:34:42 +02:00
|
|
|
|
2023-03-31 16:01:20 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2023-03-10 02:39:50 +01:00
|
|
|
fi
|
|
|
|
|
2022-02-19 17:42:15 +01:00
|
|
|
else
|
2023-03-10 02:39:50 +01:00
|
|
|
|
2023-05-01 21:34:42 +02:00
|
|
|
XZUID="G1BILLET"
|
|
|
|
BOTTOM="$(date) :: ♥Box :: G1BILLET :: $(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"
|
|
|
|
|
2023-05-01 21:34:42 +02:00
|
|
|
# Add g1.png SIGLE
|
|
|
|
composite -compose Over -dissolve 90% \
|
2023-03-26 01:27:18 +01:00
|
|
|
"${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-05-01 21:34:42 +02:00
|
|
|
-pointsize 150 -fill black -draw 'text 120,380 "'"$MONTANT"'"' \
|
|
|
|
-pointsize 20 -fill black -draw 'text 340,22 "'"${NOTERIB}"'"' \
|
|
|
|
-pointsize 22 -draw 'text 50,100 "'"Secret 1: $SALT"'"' \
|
|
|
|
-pointsize 22 -fill black -draw 'text 50,130 "'"Secret 2: $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
|
|
|
|
|