From c2cd235e257ba82bfbc8880747b2129cc7260150 Mon Sep 17 00:00:00 2001 From: qo-op Date: Sun, 10 May 2020 22:11:47 +0200 Subject: [PATCH] g1billets sms auth --- 0.sms.command.sh | 30 ++++++++++++++++ g1sms/sms_AUTH.sh | 57 ++++++++++++++++++++++++++++++ www/LOVELand/error/400.html | 2 +- www/LOVELand/error/401.html | 2 +- www/LOVELand/error/403.html | 2 +- www/LOVELand/error/404.html | 2 +- www/LOVELand/error/405.html | 2 +- www/LOVELand/error/500.html | 2 +- www/LOVELand/error/502.html | 2 +- www/LOVELand/error/503.html | 2 +- www/LOVELand/g1billet/code_sms.php | 17 +++++++++ www/LOVELand/g1billet/test.php | 13 +++++++ www/LOVELand/g1billet/zen_sms.php | 15 ++++++++ www/LOVELand/index.html | 26 ++++++++------ 14 files changed, 155 insertions(+), 19 deletions(-) create mode 100755 0.sms.command.sh create mode 100755 g1sms/sms_AUTH.sh create mode 100644 www/LOVELand/g1billet/code_sms.php create mode 100644 www/LOVELand/g1billet/test.php create mode 100644 www/LOVELand/g1billet/zen_sms.php diff --git a/0.sms.command.sh b/0.sms.command.sh new file mode 100755 index 0000000..590514c --- /dev/null +++ b/0.sms.command.sh @@ -0,0 +1,30 @@ +# Author: Fred (support@qo-op.com) +# Version: 0.2 +# License: GPL (http://www.google.com/search?q=GPL) +################################################################################ +# READ /tmp/sms.commands and RUN it.. TODO, add keys for security ;) +################################################################################# +# RECEIVE COMMAND FROM ./www/LOVELand/g1billet/zen_sms.php +# +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized + +[[ -f /tmp/sms.commands ]] && echo "" > /tmp/sms.commands +tail -fn 1 /tmp/sms.commands | while read -r line +do + if [[ $line != "" ]]; then + mycmd="$MY_PATH/g1sms/sms_AUTH.sh $line" + echo "RUN: $mycmd" > /tmp/sms.commmand.result + eval "$mycmd" >> /tmp/sms.commmand.result + fi +done diff --git a/g1sms/sms_AUTH.sh b/g1sms/sms_AUTH.sh new file mode 100755 index 0000000..6296a68 --- /dev/null +++ b/g1sms/sms_AUTH.sh @@ -0,0 +1,57 @@ +#!/bin/bash +################################################################################ +# Author: Fred (support@qo-op.com) +# Version: 0.1 +# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) +################################################################################ +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized + +cd ~/.zen/astroport/g1sms/ + +source ./init.sh +source ./functions.sh + +PHONE=$1 +VALEUR=$2 +TODAY=$(date '+%Y%m%d') +log "__SUB:sms_AUTH.sh ($PHONE, $VALEUR)" + +## INITIALIZE RESULT FILE +[[ $VALEUR == "" ]] && echo "Indiquez la valeur des G1Billets" && exit 1 +[[ $PHONE != "" ]] && sms_INIT_ACCOUNT "$PHONE" "NOSMS" || exit 1 +[[ $UNKNOWN == "unknown" ]] && echo "G1sms Wallet $PHONE inconnu! Envoyer N au $MASTERPHONE" && exit 1 + +# Get AMOUNTG1, AMOUNTLOVE, AMOUNTDU +AMOUNTG1=$(silkaj_balance $PUBKEY) +AMOUNTDU=$(bc -l <<< "scale=2; $AMOUNTG1 / $DUFACTOR") +AMOUNTLOVE=$(bc -l <<< "scale=0; $AMOUNTG1 * 100 / $DUFACTOR") + +# Convert amount to G1 unit +VIR=$(bc -l <<< "scale=2; $VALEUR * $DUFACTOR / 100") + +# Need at least $MIN G1 available! +MIN=$(bc -l <<< "$AMOUNTG1 - $LIMIT") +testmin=$( echo "${VIR} < ${MIN}" | bc -l ) +SMSPIN=$((1000 + RANDOM % 9999)) + +log "__SUB:sms_AUTH.sh: CODE $SMSPIN : $VIR < $MIN ? $testmin" +if [[ "$testmin" -eq "1" ]] +then + mess="CODE: $SMSPIN +A saisir pour vous authentifier... +[G1] Zen Astroport Satellite #$(cat /etc/hostname)" + # Send response SMS + sms_SEND "$PHONE" "$mess" + echo $SMSPIN > /tmp/$PHONE.PIN.auth + echo $SMSPIN +else + text="Solde: $AMOUNTLOVE LOVE ($AMOUNTG1 G1 = $AMOUNTDU DU) +Insuffisant (minimum $VIR G1 + $LIMIT G1)" + sms_ERROR "$PHONE" "$text" + echo "Minimum $VIR G1 + $LIMIT G1" +fi +log "__SUB:sms_AUTH.sh: END sms_AUTH.sh " +log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + +exit 0 diff --git a/www/LOVELand/error/400.html b/www/LOVELand/error/400.html index 39fd163..a4167ba 100644 --- a/www/LOVELand/error/400.html +++ b/www/LOVELand/error/400.html @@ -54,7 +54,7 @@

Please contact the webmaster with any queries.

diff --git a/www/LOVELand/error/401.html b/www/LOVELand/error/401.html index 28fc2a0..8ad0153 100644 --- a/www/LOVELand/error/401.html +++ b/www/LOVELand/error/401.html @@ -54,7 +54,7 @@

Please contact the webmaster with any queries.

diff --git a/www/LOVELand/error/403.html b/www/LOVELand/error/403.html index 676f713..5009021 100644 --- a/www/LOVELand/error/403.html +++ b/www/LOVELand/error/403.html @@ -54,7 +54,7 @@

Please contact the webmaster with any queries.

diff --git a/www/LOVELand/error/404.html b/www/LOVELand/error/404.html index 78452ba..43b1c1a 100644 --- a/www/LOVELand/error/404.html +++ b/www/LOVELand/error/404.html @@ -54,7 +54,7 @@

Please check the URL or contact the webmaster.

diff --git a/www/LOVELand/error/405.html b/www/LOVELand/error/405.html index c9ed8f6..72d7d66 100644 --- a/www/LOVELand/error/405.html +++ b/www/LOVELand/error/405.html @@ -54,7 +54,7 @@

Please contact the webmaster with any queries.

diff --git a/www/LOVELand/error/500.html b/www/LOVELand/error/500.html index 43864a7..8e5ec0a 100644 --- a/www/LOVELand/error/500.html +++ b/www/LOVELand/error/500.html @@ -54,7 +54,7 @@

If you get this message repeatedly please contact the webmaster.

diff --git a/www/LOVELand/error/502.html b/www/LOVELand/error/502.html index 62a1b02..ce0a65f 100644 --- a/www/LOVELand/error/502.html +++ b/www/LOVELand/error/502.html @@ -54,7 +54,7 @@

If you get this message repeatedly please contact the webmaster.

diff --git a/www/LOVELand/error/503.html b/www/LOVELand/error/503.html index eb55a56..9e39408 100644 --- a/www/LOVELand/error/503.html +++ b/www/LOVELand/error/503.html @@ -54,7 +54,7 @@

Please contact the webmaster with any queries.

diff --git a/www/LOVELand/g1billet/code_sms.php b/www/LOVELand/g1billet/code_sms.php new file mode 100644 index 0000000..84548e8 --- /dev/null +++ b/www/LOVELand/g1billet/code_sms.php @@ -0,0 +1,17 @@ + + diff --git a/www/LOVELand/g1billet/test.php b/www/LOVELand/g1billet/test.php new file mode 100644 index 0000000..e252348 --- /dev/null +++ b/www/LOVELand/g1billet/test.php @@ -0,0 +1,13 @@ + +
+
+
+ +
+ LOVE
+ +
+ + diff --git a/www/LOVELand/g1billet/zen_sms.php b/www/LOVELand/g1billet/zen_sms.php new file mode 100644 index 0000000..194d5cf --- /dev/null +++ b/www/LOVELand/g1billet/zen_sms.php @@ -0,0 +1,15 @@ + + diff --git a/www/LOVELand/index.html b/www/LOVELand/index.html index da86c2c..164f943 100644 --- a/www/LOVELand/index.html +++ b/www/LOVELand/index.html @@ -59,6 +59,7 @@
Cesium Gchange + G1Billets
@@ -113,21 +114,24 @@
-

Embarquez dans un nouvel Univers Numérique et Réel

+

Un nouvel Univers Numérique et Réel

Impossible à réaliser jusqu'à aujourd'hui! Nous avons mis au point un système d'information totalement décentralisé. Créé par les Humains qui le compose. Chacun y est souverain. Forgeron monétaire dans l'Oasis formé par son réseau d'amis. - Ici nul privilège autre que celui consciemment admis.

-

Il suffit de se saisir d'une clef pour y entrer !

+

Ici nul privilège autre que celui consciemment transmit.

+

Commandez votre clef, évadons-nous ensemble !

-

Bâtisseurs d'un Monde Libre

-

Astroport compose le Metavers qui connecte nos mini-mondes - Gchange organise nos échanges gratuitement !!
-

Devenons maitre de son Economie! Entre amis et collaborateurs !

+

Bâtissons un Monde Libre

+

Astroport fait émerger un Metavers composé des mini-mondes de chacun. + Tous associés partageant besoins, compétences et connaissances. +

+

Totalement gratuit!!

+

Maîtres de la valeur et de nos échanges!
Nous commerçons entre amis uniquement!

+


Annonces Gchange

@@ -164,8 +168,8 @@
-

Marchés Artisanaux

-

Vendez, achetez, échangez Librement entre amis avec Gchange.

+

Marché Local Individual

+

Vendez, achetez, échangez Librement entre amis avec Gchange.

@@ -173,8 +177,8 @@
-

Stockage Maillé

-

Vos amis se chargeront de votre réputation... et de votre stockage IPFS

+

Stockage Collectif

+

Vos amis et vous-même hébergez vos données en essaim IPFS