forked from qo-op/G1BILLET
bug fix & API enhancement
This commit is contained in:
parent
09e3ab20b5
commit
05519d225e
41
G1BILLETS.sh
41
G1BILLETS.sh
@ -24,10 +24,10 @@ STYLE="$2"
|
|||||||
|
|
||||||
## CHECK IF STYLE IS EMAIL => astro IPFS G1BILLET
|
## CHECK IF STYLE IS EMAIL => astro IPFS G1BILLET
|
||||||
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 "ASTROPORT NEW PLAYER"
|
||||||
# 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
|
||||||
@ -51,24 +51,32 @@ do
|
|||||||
mkdir -p "${MY_PATH}/tmp/g1billet/${UNIQID}"
|
mkdir -p "${MY_PATH}/tmp/g1billet/${UNIQID}"
|
||||||
|
|
||||||
SALT=$(${MY_PATH}/diceware.sh 4 | xargs)
|
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)
|
|
||||||
|
|
||||||
|
|
||||||
# CREATION CLEF BILLET
|
# CREATION CLEF BILLET
|
||||||
BILLETPUBKEY=$(python3 ${MY_PATH}/key_create_dunikey.py "$SALT" "$SECRET")
|
BILLETPUBKEY=$(python3 ${MY_PATH}/key_create_dunikey.py "$SALT" "$SECRET")
|
||||||
rm -f /tmp/secret.dunikey
|
rm -f /tmp/secret.dunikey
|
||||||
echo "$boucle : $BILLETPUBKEY"
|
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" ]] \
|
if [[ "$STYLE" == "astro" ]]; then
|
||||||
&& ${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) \
|
${MY_PATH}/keygen -t ipfs -o ${MY_PATH}/tmp/g1billet.${UNIQID}.ipns.key "$SALT" "$SECRET"
|
||||||
&& rm -f ${MY_PATH}/tmp/g1billet.${UNIQID}.ipns.key \
|
ASTRONAUTENS=$(ipfs key import ${UNIQID} -f pem-pkcs8-cleartext ${MY_PATH}/tmp/g1billet.${UNIQID}.ipns.key)
|
||||||
&& ipfs key rm ${UNIQID} && echo "/ipns/$ASTRONAUTENS" \
|
|
||||||
&& [[ ${EMAIL} ]] \
|
rm -f ${MY_PATH}/tmp/g1billet.${UNIQID}.ipns.key
|
||||||
&& curl -s 'https://astroport.copylaradio.com/?salt='$UN'&pepper='$DE'&g1pub=on&email='$EMAIL
|
ipfs key rm ${UNIQID} && echo "/ipns/$ASTRONAUTENS"
|
||||||
|
|
||||||
|
UN=$(echo ${SALT} | jq -Rr @uri) ## URL ENCODED
|
||||||
|
DE=$(echo ${SECRET} | jq -Rr @uri) ## URL ENCODED
|
||||||
|
|
||||||
|
[[ ${EMAIL} ]] \
|
||||||
|
echo 'https://astroport.copylaradio.com/?salt='$UN'&pepper='$DE'&g1pub=on&email='$EMAIL \
|
||||||
|
curl -s 'https://astroport.copylaradio.com/?salt='$UN'&pepper='$DE'&g1pub=on&email='$EMAIL
|
||||||
|
|
||||||
|
fi
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
# 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 "${SALT}" "${SECRET}" "${MONTANT}" "${BILLETPUBKEY}" "${UNIQID}" "${STYLE}" "${ASTRONAUTENS}" "${EMAIL}")
|
$(${MY_PATH}/MAKE_G1BILLET.sh "${SALT}" "${SECRET}" "${MONTANT}" "${BILLETPUBKEY}" "${UNIQID}" "${STYLE}" "${ASTRONAUTENS}" "${EMAIL}")
|
||||||
@ -111,7 +119,7 @@ else
|
|||||||
## MAKE IT A NETWORK MICRO SERVICE -- PORTS : INPUT=33101 OUTPUT=33102
|
## MAKE IT A NETWORK MICRO SERVICE -- PORTS : INPUT=33101 OUTPUT=33102
|
||||||
############## CLEAN START DAEMON MODE ###
|
############## CLEAN START DAEMON MODE ###
|
||||||
pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p 33101" | 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 33101" | grep -v -E 'color=auto|grep' | awk '{gsub(/^ +| +$/,"")} {print $0}' | tail -n 1 | cut -d " " -f 1)
|
||||||
[[ $pidportinuse ]] && echo "KILLING OLD DEAMON 33101 $pidportinuse" && kill -9 $pidportinuse && killall G1BILLETS.sh
|
[[ $pidportinuse ]] && echo "KILLING OLD DEAMON 33101 $pidportinuse" && kill -9 $pidportinuse && killall G1BILLETS.sh && exit 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=$(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"
|
||||||
@ -121,11 +129,10 @@ isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.1
|
|||||||
|
|
||||||
if [[ $isLAN ]]; then
|
if [[ $isLAN ]]; then
|
||||||
HNAME="http://g1billet.localhost"
|
HNAME="http://g1billet.localhost"
|
||||||
RNAME="$HNAME:33102"
|
|
||||||
else
|
else
|
||||||
HNAME="http://$(hostname)"
|
HNAME="http://$(hostname)"
|
||||||
RNAME="http://qo-op.com:33102"
|
|
||||||
fi
|
fi
|
||||||
|
RNAME="$HNAME:33102"
|
||||||
|
|
||||||
HTTPWELLCOME='HTTP/1.1 200 OK
|
HTTPWELLCOME='HTTP/1.1 200 OK
|
||||||
Access-Control-Allow-Origin: *
|
Access-Control-Allow-Origin: *
|
||||||
@ -192,7 +199,7 @@ while true; do
|
|||||||
echo "=================================================="
|
echo "=================================================="
|
||||||
echo "$MOATS"
|
echo "$MOATS"
|
||||||
echo "=================================================="
|
echo "=================================================="
|
||||||
# echo "$REQ"
|
echo "$REQ"
|
||||||
echo "=================================================="
|
echo "=================================================="
|
||||||
echo "$URL"
|
echo "$URL"
|
||||||
arr=(${URL//[=&]/ })
|
arr=(${URL//[=&]/ })
|
||||||
@ -238,8 +245,8 @@ Content-Disposition: attachment; filename='${FILE_NAME}'
|
|||||||
cat ${ZFILE} >> ${MY_PATH}/tmp/http.${MOATS}
|
cat ${ZFILE} >> ${MY_PATH}/tmp/http.${MOATS}
|
||||||
|
|
||||||
# NETCAT PUBLISH port=33102
|
# NETCAT PUBLISH port=33102
|
||||||
[[ $XDG_SESSION_TYPE != 'x11' ]] \
|
echo "33102 LOADING"
|
||||||
&& echo "33102 LOADING" && (cat ${MY_PATH}/tmp/http.${MOATS} | nc -l -p 33102 -q 1 > /dev/null 2>&1) &
|
(cat ${MY_PATH}/tmp/http.${MOATS} | nc -l -p 33102 -q 1 > /dev/null 2>&1) &
|
||||||
echo "DELIVERED ${MOATS} : http://g1billet.localhost:33102"
|
echo "DELIVERED ${MOATS} : http://g1billet.localhost:33102"
|
||||||
rm -f "${MY_PATH}/tmp/http.${MOATS}"
|
rm -f "${MY_PATH}/tmp/http.${MOATS}"
|
||||||
|
|
||||||
|
16
README.md
16
README.md
@ -33,21 +33,17 @@ La fabrication de la planche de G1Billets depuis un site web est possible en met
|
|||||||
./G1BILLETS.sh daemon
|
./G1BILLETS.sh daemon
|
||||||
```
|
```
|
||||||
|
|
||||||
Une fois lancé de cette façon, G1BILLET se commande depuis un navigateur
|
Une fois lancé de cette façon, la création de G1BILLETS se commande depuis un navigateur
|
||||||
|
|
||||||
> Essayez le nouveau G1BILLET "astro" avec une adresse email, vous fabriquez un TW relié au G1BILLET.
|
|
||||||
|
|
||||||
## Type "astro"
|
|
||||||
|
|
||||||
Avec une adresse email, vous associez son TW à votre G1BILLET
|
|
||||||
```
|
```
|
||||||
G1BILLETS.sh DAEMON MODE http://g1billet.localhost:33101/?m=0&u=0&type=astro@yopmail.com
|
PLANCHE : http://g1billet.localhost:33101
|
||||||
./G1BILLETS.sh "0" "0" "astro@yopmail.com"
|
TICKET : http://g1billet.localhost:33101/?montant=10&style=ticket
|
||||||
|
ASTRO TW : http://g1billet.localhost:33101/?montant=0&style=astro24887@yopmail.com
|
||||||
```
|
```
|
||||||
Enregistrez votre G1BILLET...
|
|
||||||
|
Avec une adresse email, vous reliez un TW Multimedia à votre G1BILLET
|
||||||
Vous recevez les détails de sa fabrication dans votre boite email ;)
|
Vous recevez les détails de sa fabrication dans votre boite email ;)
|
||||||
|
|
||||||
Copiez ce G1BILLET en cachant ses secrets pour en faire votre "carte de visite TW"
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user