Add 3 images to make your Style ( _ : default / x : G1PASS / G1Ticket)

This commit is contained in:
fred 2023-04-19 22:12:16 +02:00
parent 8a038ecb4d
commit a7a214282d
30 changed files with 98 additions and 39 deletions

View File

@ -43,12 +43,18 @@ if [[ $MONTANT != "daemon" ]]; then
echo "CREATION $NBbillets x G1BILLET - $STYLE - "
# CHECK IF $STYLE IMAGES EXIST
[[ ! -f ${MY_PATH}/images/g1${STYLE}.png ]] && echo "AJOUTER : ./images/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 "AJOUTER : ./images/logo${STYLE}.jpg" && exit 1
## DEFAULT STYLE FOLDER IS ${MY_PATH}/images/_
[[ ${STYLE} == "" ]] && STYLE="_"
UNIQID=$(echo "${RANDOM}${RANDOM}${RANDOM}${RANDOM}" | tail -c-7)
# CHECK IF $STYLE IMAGES EXIST
[[ ! -f ${MY_PATH}/images/${STYLE}/g1.png ]] && ERROR="STYLE INCONNU ./images/${STYLE}/g1.png" && echo $ERROR && exit 1
[[ ! -f ${MY_PATH}/images/${STYLE}/fond.jpg ]] && ERROR="STYLE INCONNU ./images/${STYLE}/fond.jpg" && echo $ERROR && exit 1
[[ ! -f ${MY_PATH}/images/${STYLE}/logo.png ]] && ERROR="STYLE INCONNU ./images/${STYLE}/logo.png" && echo $ERROR && exit 1
## THIS IS THE PASS for G1PASS
UNIQID=$(echo "${RANDOM}${RANDOM}${RANDOM}${RANDOM}" | tail -c-5)
[ $DICE -gt 4 ] && UNIQID=$(${MY_PATH}/diceware.sh 1 | xargs)$(echo "${RANDOM}${RANDOM}" | tail -c-5)
[ $DICE -gt 6 ] && UNIQID=$(${MY_PATH}/diceware.sh 1 | xargs)$(echo "${RANDOM}${RANDOM}" | tail -c-7)
# CREATION DE $NBbillets BILLETS DE $MONTANT DU
boucle=0;
@ -145,6 +151,24 @@ else
fi
RNAME="$HNAME:33102"
## AVAILABLE STYLES
sytle=($(find ${MY_PATH}/images/* -type d | sort | rev | cut -d '/' -f 1 | rev))
sytlenb=${#sytle[@]}
OPT=""
for stname in ${sytle[@]}; do
pre=${stname:0:1}
if [[ $pre == "_" ]]; then
OPT="${OPT}<option value=''>Planche 6 G1BILLETS</option>"
elif [[ $pre == "x" ]]; then
OPT="${OPT}<option value='${stname}'>${stname} (G1PASS)</option>"
else
OPT="${OPT}<option value='${stname}'>${stname} (G1Ticket)</option>"
fi
done
HTTPWELLCOME='HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
@ -196,8 +220,7 @@ function countdown() {
<label for="type">Type :</label>
<select name="type">
<option value="">Planche de G1BILLETS</option>
<option value="xbian">G1PASS</option>
'${OPT}'
</select>
<label for="dice">Securite :</label>
@ -258,23 +281,39 @@ function countdown() {
MONTANT=$(urldecode ${arr[1]} | xargs); STYLE=$(urldecode ${arr[3]} | xargs); XPARM=$(urldecode ${arr[5]} | xargs);
echo "DECODED : $ONE=$MONTANT & $TWO=$STYLE & $X=$XPARM"
[[ $STYLE == "dice" ]] && STYLE="" && XPARM=$X ## /?montant=0&type=&dice=1
[[ $STYLE == "dice" ]] && STYLE="_" && XPARM=$X ## /?montant=0&type=&dice=1
#####################################################################
echo ${MY_PATH}/${ME} '"'$MONTANT'"' '"'$STYLE'"' '"'$XPARM'"'
#####################################################################
# EXECUTE COMMAND
LOG=$(${MY_PATH}/${ME} "$MONTANT" "$STYLE" "$XPARM")
echo "$LOG"
echo "$LOG"
# 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"
echo "=========" ## LAST LINE INFORMATION
ZFILE=$(echo "$LOG" | tail -n 1) ### LAST LINE : INFORM DAEMON
echo $ZFILE
echo "========="
### AUCUN RESULTAT
if [[ ! -s $ZFILE ]]; then
(
echo "HTTP/1.1 200 OK
Access-Control-Allow-Origin: ${myASTROPORT}
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET
Server: Astroport.ONE
Content-Type: text/html; charset=UTF-8
<h1>ERROR $ZFILE</h1>" | nc -l -p 33102 -q 1 > /dev/null 2>&1 \
&& rm -f "${MY_PATH}/tmp/http.${MOATS}"
) &
else ## FILE IS FOUND
# PREPARE FILE SENDING
FILE_NAME="$(basename "${ZFILE}")"
@ -297,24 +336,26 @@ Content-Length:'${BSIZE}'
Content-Disposition: attachment; filename='${FILE_NAME}'
' > ${MY_PATH}/tmp/http.${MOATS}
cat ${ZFILE} >> ${MY_PATH}/tmp/http.${MOATS}
cat ${ZFILE} >> ${MY_PATH}/tmp/http.${MOATS}
# NETCAT PUBLISH port=33102
echo "PUBLISHING ${MOATS} : $RNAME"
# NETCAT PUBLISH port=33102
echo "PUBLISHING ${MOATS} : $RNAME"
if [[ $XDG_SESSION_TYPE != 'x11' ]]; then
(
cat ${MY_PATH}/tmp/http.${MOATS} | nc -l -p 33102 -q 1 > /dev/null 2>&1 \
&& rm -f "${MY_PATH}/tmp/http.${MOATS}" \
&& rm -f "${ZFILE}" \
&& rm -Rf "${ZFILE%.*}" \
&& echo "G1BILLETS FILE CONSUMED"
) &
else
rm -f "${MY_PATH}/tmp/http.${MOATS}" \
&& rm -f "${ZFILE}" \
&& rm -Rf "${ZFILE%.*}" \
&& echo "G1BILLETS FILE CONSUMED"
fi
if [[ $XDG_SESSION_TYPE != 'x11' ]]; then
(
cat ${MY_PATH}/tmp/http.${MOATS} | nc -l -p 33102 -q 1 > /dev/null 2>&1 \
&& rm -f "${MY_PATH}/tmp/http.${MOATS}" \
&& rm -f "${ZFILE}" \
&& rm -Rf "${ZFILE%.*}" \
&& echo "G1BILLETS FILE CONSUMED"
) &
else
rm -f "${MY_PATH}/tmp/http.${MOATS}" \
&& rm -f "${ZFILE}" \
&& rm -Rf "${ZFILE%.*}" \
&& echo "G1BILLETS FILE CONSUMED"
fi
done

View File

@ -35,47 +35,47 @@ BILLETNAME=$(echo $SALT | sed 's/ /_/g')
# Prepare June logo color
case "$MONTANT" in
1)
convert "${MY_PATH}/images/g1${STYLE}.png" -fuzz 20% -fill grey -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
convert "${MY_PATH}/images/${STYLE}/g1.png" -fuzz 20% -fill grey -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
;;
2)
convert "${MY_PATH}/images/g1${STYLE}.png" -fuzz 20% -fill green -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
convert "${MY_PATH}/images/${STYLE}/g1.png" -fuzz 20% -fill green -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
;;
5)
convert "${MY_PATH}/images/g1${STYLE}.png" -fuzz 20% -fill orange -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
convert "${MY_PATH}/images/${STYLE}/g1.png" -fuzz 20% -fill orange -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
;;
10)
convert "${MY_PATH}/images/g1${STYLE}.png" -fuzz 20% -fill blue -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
convert "${MY_PATH}/images/${STYLE}/g1.png" -fuzz 20% -fill blue -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
;;
20)
convert "${MY_PATH}/images/g1${STYLE}.png" -fuzz 20% -fill purple -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
convert "${MY_PATH}/images/${STYLE}/g1.png" -fuzz 20% -fill purple -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
;;
50)
convert "${MY_PATH}/images/g1${STYLE}.png" -fuzz 20% -fill red -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
convert "${MY_PATH}/images/${STYLE}/g1.png" -fuzz 20% -fill red -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
;;
100)
convert "${MY_PATH}/images/g1${STYLE}.png" -fuzz 20% -fill black -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
convert "${MY_PATH}/images/${STYLE}/g1.png" -fuzz 20% -fill black -opaque '#e5912b' "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
;;
*)
cp "${MY_PATH}/images/g1${STYLE}.png" "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
cp "${MY_PATH}/images/${STYLE}/g1.png" "${MY_PATH}/tmp/g1billet/${UNIQID}/g1.png"
;;
esac
# Add ${MY_PATH}/images/logo.png (250px)
composite -compose Over -gravity SouthWest -geometry +150+50 -dissolve 70% \
"${MY_PATH}/images/logo${STYLE}.png" \
"${MY_PATH}/images/fond${STYLE}.jpg" \
"${MY_PATH}/images/${STYLE}/logo.png" \
"${MY_PATH}/images/${STYLE}/fond.jpg" \
"${MY_PATH}/tmp/${BILLETNAME}.jpg"
# xbian style (ASTROPORT/KODI) + JEU
if [[ "${STYLE}" == "xbian" || "${STYLE}" == "jeu" || "${STYLE}" == "astro" ]]
# "G1PASS" (GPG+TW) STYLE : xbian, xjeu, xastro
if [[ "${STYLE:0:1}" == "x" ]]
then
if [[ $ASTRONAUTENS ]]; then
## IT IS AN ASTRONAUTENS IPNS LINK
USALT=$(echo "$SALT" | jq -Rr @uri)
UPEPPER=$(echo "$SECRET" | jq -Rr @uri)
echo "Making gpg of /?salt=${USALT}&pepper=${UPEPPER} with pass=$UNIQID"
echo "(≖‿‿≖) Making gpg of /?salt=${USALT}&pepper=${UPEPPER} with pass=$UNIQID"
## SECURED RANDOM salt : pepper GPG SEQUENCE
s=$(${MY_PATH}/diceware.sh 1 | xargs)
@ -83,6 +83,8 @@ then
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
rm ~/.zen/tmp/topgp ## CLEANING CACHE
DISCO="$(cat ${MY_PATH}/tmp/gpg.${BILLETNAME}.asc | tr '-' '~' | tr '\n' '-' | tr '+' '_' | jq -Rr @uri )"
echo "$DISCO"
## Add logo to QRCode

View File

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

BIN
images/g1magicien.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 156 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 104 KiB

View File

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

BIN
images/ticket/g1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 152 KiB

BIN
images/xastro/g1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 152 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

BIN
images/xjeu/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

16
search Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
clear
echo "------------------------------------------------------------------------------"
if [ "$1" == "" ]; then
echo " Nothing to search for!"
else
echo " Searching for "$1" recursively. Please Wait..."
echo "------------------------------------------------------------------------------"
grep -h -r --exclude=B00 -H --colour=always "$1" ./
fi
echo "------------------------------------------------------------------------------"
if [ "$2" != "" ]; then
echo " To replace \"$1\" whith \"$2\", please run"
echo " grep -rl '$1' ./ | xargs sed -i 's~$1~$2~g'"
fi
## THIS IS A GREAT RETRO ENGINEERING AND CODING TOOLS