diff --git a/.install/.GPATH b/.install/.GPATH
new file mode 100644
index 0000000..ac91fa6
--- /dev/null
+++ b/.install/.GPATH
@@ -0,0 +1 @@
+GPATH=/home/pi/G1sms+
diff --git a/.install/2-configure_ipfs_layer.sh b/.install/2a-configure_ipfs_layer.sh
similarity index 98%
rename from .install/2-configure_ipfs_layer.sh
rename to .install/2a-configure_ipfs_layer.sh
index 0839556..162f6f6 100755
--- a/.install/2-configure_ipfs_layer.sh
+++ b/.install/2a-configure_ipfs_layer.sh
@@ -8,7 +8,7 @@
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
stamp=$(date +%s)
-templates="$MY_PATH/templates/2"
+templates="$MY_PATH/templates/2a"
#######################################
# CONFIGURE IPFS for G1sms+ Pi NODES
diff --git a/.install/2b-configure_gammu.sh b/.install/2b-configure_gammu.sh
new file mode 100755
index 0000000..c4ce55c
--- /dev/null
+++ b/.install/2b-configure_gammu.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+MY_PATH="`dirname \"$0\"`" # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
+source $MY_PATH/../.install/.GPATH
+
+## Récupère les données du profile
+[[ -f $MY_PATH/../.profile ]] && source $MY_PATH/../.profile
+
+## Désactive les processus écoutant le tty1
+[[ $(sudo systemctl status getty@tty1.service | grep "loaded" 2>/dev/null) ]] && sudo systemctl stop getty@tty1.service && sudo systemctl disable getty@tty1.service
+
+if [[ -z $(grep "PIN" /etc/gammu-smsdrc) ]]; then
+ ## Copie et sed de /etc/gammu-smsdrc
+ [[ -f /etc/gammu-smsdrc ]] && sudo mv /etc/gammu-smsdrc /etc/gammu-smsdrc.old && echo "/etc/gammu-smsdrc a été renommé en /etc/gammu-smsdrc.old"
+ sudo cp $MY_PATH/templates/2b/gammu-smsdrc /etc/
+
+ GPATHS=$(echo $GPATH | sed 's./.\\/.g')
+ sudo sed -i "s/_GPATH/$GPATHS/g" /etc/gammu-smsdrc
+ sudo sed -i "s/_PIN/$PIN/g" /etc/gammu-smsdrc
+
+ ## Redémarre gammu-smsd
+ sudo service gammu-smsd restart && echo -e "${c_green}Gammu a été correctement configuré$c_" || echo -e "${c_green}Un problème est survenu lors de la configuration de gammu$c_"
+fi
+
+## Configure correctement le UART
+
+[[ ! $(grep enable_uart=1 /boot/config.txt) ]] && echo "enable_uart=1" | sudo tee -a /boot/config.txt
+[[ $(grep "console=serial0" /boot/cmdline.txt) ]] && sudo sed -i "s/console=serial0,115200//g" /boot/cmdline.txt
+[[ $(grep "console=serial0" /boot/cmdline.txt) ]] && echo -e "${c_red}Attention, console=serial0 est toujours présent dans /boot/cmdline.txt !$c_" && err=1
+
+## Configure rc.local
+
+
+
+exit 0
diff --git a/.install/5-install_rompr.sh b/.install/5-install_rompr.sh
new file mode 100755
index 0000000..987c507
--- /dev/null
+++ b/.install/5-install_rompr.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+MY_PATH="`dirname \"$0\"`" # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
+source $MY_PATH/../.install/.GPATH
+
+GPATHS=$(echo $GPATH | sed 's./.\\/.g')
+
+sudo cp $MY_PATH/templates/5/youtube-dl.php $GPATH/www/rompr/REC/youtube-dl.php
+sudo sed -i "s/_GPATH/$GPATHS/g" $GPATH/www/rompr/REC/youtube-dl.php
+
+## TODO
+# Tout les reste ...
+
+exit 0
diff --git a/.install/templates/.profile b/.install/templates/.profile
index d202a9a..c32b4b1 100644
--- a/.install/templates/.profile
+++ b/.install/templates/.profile
@@ -2,4 +2,5 @@ ADMINPSEUDO=_ADMINPSEUDO
ADMINPHONE=_ADMINPHONE
MASTERPHONE=_MASTERPHONE
ADRESSE="_ADRESSE"
+PIN=_PIN
KSMS_DOMAIN=
diff --git a/.install/templates/2b/gammu-smsdrc b/.install/templates/2b/gammu-smsdrc
new file mode 100644
index 0000000..77fbaad
--- /dev/null
+++ b/.install/templates/2b/gammu-smsdrc
@@ -0,0 +1,26 @@
+# Configuration file for Gammu SMS Daemon
+
+[gammu]
+port = /dev/ttyS0
+synchronizetime = yes
+gammucoding = utf8
+connection = at
+# Debugging
+logformat = textall
+
+# SMSD configuration, see gammu-smsdrc(5)
+[smsd]
+service = files
+
+logfile = /var/log/gammu-smsd.log
+PIN = _PIN
+
+# Paths where messages are stored (Not use if service = sql)
+inboxpath = /var/spool/gammu/inbox/
+outboxpath = /var/spool/gammu/outbox/
+sentsmspath = /var/spool/gammu/sent/
+errorsmspath = /var/spool/gammu/error/
+
+RunOnReceive = _GPATH/sms_received.sh
+#IncludeSMSCFile = _GPATH/debug/smsc.txt
+debuglevel = 3
diff --git a/.install/templates/5/youtube-dl.php b/.install/templates/5/youtube-dl.php
new file mode 100644
index 0000000..efd05ca
--- /dev/null
+++ b/.install/templates/5/youtube-dl.php
@@ -0,0 +1,128 @@
+[REC]';
+ zcopylink += ' *';
+ lines[0].text += zcopylink;
+// ZEEBOX HACK ZONE
+*/
+// RUN CLI if($argc>1) parse_str(implode('&',array_slice($argv, 1)), $_REQUEST);
+$search=$radio=$artist=$title=$lnk=$lnkform=$cmd=$len="";
+$search = trim(urldecode($_REQUEST['q']));
+
+$radio = urldecode($_REQUEST['radio']);
+$artist = urldecode($_REQUEST['artist']);
+$title = urldecode($_REQUEST['title']);
+$lnk = trim(urldecode($_REQUEST['lnk']));
+$cmd="$radio|$artist|$title";
+$len=strlen($artist.$title);
+
+//$result='
';
+$result='
';
+if( $radio == "" ) { $radio = "CopyLaRadio"; }
+if( $radio == "Nova zz" ) {
+ $artist = "undefined";
+ $title = "undefined";
+}
+// Write request for copy.sh triggering
+if( $search == "REC" ) {
+///////////////////
+ $result.='
♫ '.$radio.' ♫
';
+ // LINK RECEIVED
+ if ($lnk) {
+ $artist="";
+ shell_exec('_GPATH/_CopyLaRadio/parle.sh "Lien reçu."');
+ // Not making double request
+ if( ! exec('grep '.escapeshellarg($lnk).' /tmp/ytdl.list') ) {
+ file_put_contents("/tmp/ytdl.list","CopyLibre||$lnk\n", FILE_APPEND);
+ }
+ $result.='LIEN: '.$lnk.'
';
+///////////////////
+ // TRACK COPY (not for undefined or local file)
+ } else if ($radio && $artist != $title && $artist != "undefined" && $title != "undefined" && strlen(explode(".", $title)[1]) != 3 && explode(".", $title)[1] != "opus" ) {
+ // Not making double request
+ if( ! exec('grep '.escapeshellarg($cmd).' /tmp/ytdl.list') ) {
+ shell_exec('_GPATH/_CopyLaRadio/parle.sh "Enregistrement ajouté."');
+ file_put_contents("/tmp/ytdl.list","$cmd\n", FILE_APPEND);
+ } else {
+ shell_exec('_GPATH/_CopyLaRadio/parle.sh "Copie déjà lancée"');
+ }
+ $result.='
+'.$artist.' / '.$title.'
+';
+///////////////////
+ // RADIO EXTERNAL TRACK SCRAPER
+ } else if($radio != "" && $artist == "undefined" && $title == "undefined" ){
+ shell_exec('_GPATH/_CopyLaRadio/parle.sh "Recherche externe pour '.$radio.'"');
+ file_put_contents("/tmp/youtube-dl.log", "_GPATH/_CopyLaRadio/libradio/".escapeshellcmd($radio).".php".PHP_EOL, FILE_APPEND);
+ if ( file_exists("_GPATH/_CopyLaRadio/libradio/".escapeshellcmd($radio).".php") ) {
+ file_put_contents("/tmp/ytdl.list","$radio||".PHP_EOL, FILE_APPEND);
+ } else {
+ shell_exec('_GPATH/_CopyLaRadio/parle.sh "Aucun module"');
+ }
+
+ } else {
+ shell_exec('_GPATH/_CopyLaRadio/parle.sh "Identification imprécise. Podcast? Fichier local?"');
+ }
+
+}
+
+$ytform = '
+';
+
+$lnkform.='';
+
+?>
+
+
+
+
+
+
+
+ - Recherche YouTube & Copie privée
+
+
+
+
+
+
diff --git a/.install/templates/init.sh b/.install/templates/init.sh
index 672085c..8a17973 100755
--- a/.install/templates/init.sh
+++ b/.install/templates/init.sh
@@ -4,6 +4,12 @@
# Version: 0.1
# License: GPL (http://www.google.com/search?q=GPL)
##################################################################
+
+MY_PATH="`dirname \"$0\"`" # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
+if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
+if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
+
# Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
function log () {
# log ($1=text)
@@ -31,8 +37,7 @@ fi
export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
- export CHEMIN="/home/$YOU/G1sms+"
- cd $CHEMIN
+ cd $GPATH
##################################################################
# Activate logging to /tmp/g1sms.log (YES/NO)
export DOLOG="YES"
@@ -75,5 +80,5 @@ fi
# TODO Use latest Silkaj from "sudo fredp3 install silkaj"
# export SILKAJ="/usr/local/bin/silkaj"
- source $CHEMIN/shell/init_keys.sh
+ source $GPATH/shell/init_keys.sh
diff --git a/Dos_G1Billets.odt b/Dos_G1Billets.odt
new file mode 100644
index 0000000..0bf050b
Binary files /dev/null and b/Dos_G1Billets.odt differ
diff --git a/GSM_POWERKEY.py b/GSM_POWERKEY.py
deleted file mode 100755
index 037387e..0000000
--- a/GSM_POWERKEY.py
+++ /dev/null
@@ -1,10 +0,0 @@
-import RPi.GPIO as GPIO
-import time
-GPIO.setmode(GPIO.BOARD)
-GPIO.setup(7, GPIO.OUT)
-while True:
- GPIO.output(7, GPIO.LOW)
- time.sleep(4)
- GPIO.output(7, GPIO.HIGH)
- break
-GPIO.cleanup()
diff --git a/_CopyLaRadio/copy.sh b/_CopyLaRadio/copy.sh
index 8391a86..c94b441 100755
--- a/_CopyLaRadio/copy.sh
+++ b/_CopyLaRadio/copy.sh
@@ -1,5 +1,9 @@
#!/bin/bash
+MY_PATH="`dirname \"$0\"`" # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
+source $MY_PATH/../.install/.GPATH
+
# Clean /tmp/ytdl.list
#echo > /tmp/ytdl.list
@@ -74,9 +78,9 @@ elif [[ "$radio" != "" && "$artist" == "" && "$song" == "" ]]; then
# EXTERNAL PARSER: ADD SCRAPERS IN ./libradio
~/parle.sh "Recherche RADIO ${radio}"
echo "External search: ${radio}" >> /tmp/youtube-dl.log 2>&1
- if [[ -f /home/pi/G1sms+/_CopyLaRadio/libradio/${radio}.php ]]; then
+ if [[ -f $GPATH/_CopyLaRadio/libradio/${radio}.php ]]; then
~/parle.sh "Module existant"
- php "/home/pi/G1sms+/_CopyLaRadio/libradio/${radio}.php"
+ php "$GPATH/_CopyLaRadio/libradio/${radio}.php"
else
~/parle.sh "Aucun module de décodage pour cette radio."
fi
diff --git a/_chain b/_chain
index 953407d..f09e9e6 100755
--- a/_chain
+++ b/_chain
@@ -1 +1 @@
-QmbRvGMpwZws4ii5xe5x8EgK1SSxNBaNNjinwdWjhye3TR
+QmbVfLJ9UsnyV3Si9UgZVS4srCnL1c2Gqt7XissCV4iC83
diff --git a/_comments b/_comments
index 7842c23..b7bbce3 100755
--- a/_comments
+++ b/_comments
@@ -175,3 +175,6 @@ OK
2019-12-17: Better G1Tx
2019-12-17: G1TAG REFRESH & more
2019-12-18: RAZ
+2019-12-20: NOW
+2019-12-21: Various
+2019-12-24:
diff --git a/_nanodate b/_nanodate
index 7778f6d..506b75f 100755
--- a/_nanodate
+++ b/_nanodate
@@ -1 +1 @@
-1576627244479575204
+1577203467543924569
diff --git a/GSM_powerkey.sh b/debug/GSM_powerkey.sh
similarity index 54%
rename from GSM_powerkey.sh
rename to debug/GSM_powerkey.sh
index 3615018..5526df2 100755
--- a/GSM_powerkey.sh
+++ b/debug/GSM_powerkey.sh
@@ -1,9 +1,16 @@
#!/bin/bash
+
+MY_PATH="`dirname \"$0\"`"
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`"
+
if [ ! -e /sys/class/gpio/gpio4 ]; then
- echo "File exists."
+ echo "File doesn't exists."
echo "4" > /sys/class/gpio/export
fi
+
echo "out" > /sys/class/gpio/gpio4/direction
-echo "0" > /sys/class/gpio/gpio4/value
-sleep 2
echo "1" > /sys/class/gpio/gpio4/value
+
+sleep 3 && $MY_PATH/gammu-restart.sh
+
+exit 0
diff --git a/debug/smsc.txt b/debug/smsc.txt
new file mode 100644
index 0000000..1dd1c98
--- /dev/null
+++ b/debug/smsc.txt
@@ -0,0 +1,5 @@
++33695000695
++33695000647
++33695000646
++33695000643
++33695000636
diff --git a/install.sh b/install.sh
index 0ecd354..e44d8bb 100755
--- a/install.sh
+++ b/install.sh
@@ -6,6 +6,10 @@
################################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
+
+echo "GPATH=$MY_PATH" > $MY_PATH/.install/.GPATH
+source $MY_PATH/.install/.GPATH
+
init_loc="$MY_PATH/shell/init.sh"
now=$(date +%Y-%m-%d)
unset err
@@ -47,7 +51,7 @@ $MY_PATH/.install/export_colors.sh
if [[ $force_req == "o" || -z $(which ipfs) || -z $(which gammu) ]];then
echo -e "${c_yellow}IPFS ou gammu n'ont pas été détectés sur votre machine, nous allons installer tous les prérequis...$c_"
$MY_PATH/.install/1-install_requirements.sh silkaj ipfs gammu || err+=1
- $MY_PATH/.install/2-configure_ipfs_layer.sh || err+=1
+ $MY_PATH/.install/2a-configure_ipfs_layer.sh || err+=1
else
echo -e "${c_green}IPFS et gammu sont déjà installé !$c_"
fi
@@ -66,7 +70,10 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
[[ ! $ADRESSE ]] && echo -e "${c_light}L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)$c_" && read ADRESSE
- echo -e "ADMINPSEUDO: $ADMINPSEUDO\nADMINPHONE: $ADMINPHONE\nMASTERPHONE: $MASTERPHONE\nADRESSE: $ADRESSE"
+ [[ ! $PIN ]] && echo -e "${c_light}Le code PIN de votre carte SIM ? (ex: 1234)$c_" && read PIN
+ [[ "$PIN" == "" ]] && PIN="1234"
+
+ echo -e "ADMINPSEUDO: $ADMINPSEUDO\nADMINPHONE: $ADMINPHONE\nMASTERPHONE: $MASTERPHONE\nADRESSE: $ADRESSE\nPIN: $PIN"
[[ $noask != "o" ]] && echo -e "${c_light}${c_blue}LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ? (Editez le fichier .profile si incorrect)$c_" && read
[[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old
@@ -83,6 +90,7 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
sed -i s/_ADRESSE/$ADRESSE/g $MY_PATH/.profile
sed -i s/_ADMINPHONE/$ADMINPHONE/g $MY_PATH/.profile
sed -i s/_ADMINPSEUDO/$ADMINPSEUDO/g $MY_PATH/.profile
+ sed -i s/_PIN/$PIN/g $MY_PATH/.profile
fi
else
@@ -91,6 +99,9 @@ else
exit 1
fi
+## Configuration de gammu
+$MY_PATH/.install/2b-configure_gammu.sh || err=1
+
## Installations optionnels
repOld=$repOption
diff --git a/search b/search
index b2c0947..f5b8195 100755
--- a/search
+++ b/search
@@ -2,7 +2,7 @@
clear
echo "------------------------------------------------------------------------------"
if [ "$1" == "" ]; then
- echo " Nothing to search for!"
+ echo " Nothing to search for!"
else
echo " Searching for "$1" recursively. Please Wait..."
echo "------------------------------------------------------------------------------"
@@ -10,7 +10,7 @@ else
fi
echo "------------------------------------------------------------------------------"
if [ "$2" != "" ]; then
- echo " To replace \"$1\" whith \"$2\", please run"
+ echo " To replace \"$1\" whith \"$2\", please run"
echo " grep -rl '$1' ./ | xargs sed -i 's/$1/$2/g'"
fi
diff --git a/shell/Portefeuille.png b/shell/G1Anar.png
similarity index 100%
rename from shell/Portefeuille.png
rename to shell/G1Anar.png
diff --git a/shell/G1Billet_LOVE.png b/shell/G1Billet_LOVE.png
new file mode 100644
index 0000000..84d3d31
Binary files /dev/null and b/shell/G1Billet_LOVE.png differ
diff --git a/shell/G1sms.png b/shell/G1sms.png
deleted file mode 100644
index f05133c..0000000
Binary files a/shell/G1sms.png and /dev/null differ
diff --git a/shell/OLove.jpg b/shell/OneLove.jpg
similarity index 100%
rename from shell/OLove.jpg
rename to shell/OneLove.jpg
diff --git a/shell/checknodes.sh b/shell/checknodes.sh
index 1195192..26e6066 100755
--- a/shell/checknodes.sh
+++ b/shell/checknodes.sh
@@ -144,7 +144,7 @@ done
silkaj=$(echo $DUNITER | cut -d ":" -f 1)
if [[ "$silkaj" != "" && "$silkaj" != "https" ]]; then
#echo "PUT $silkaj SILKAJ PARAM"
- cat ./silkaj/src/constants.default.py | sed s/duniter.moul.re/$silkaj/g > ./silkaj/src/constants.py
+ cat ./silkaj/src/constants.default.py | sed s/duniter-g1.p2p.legal/$silkaj/g > ./silkaj/src/constants.py
else
echo "RESTORE DEFAULT SILKAJ PARAM"
cp -f ./silkaj/src/constants.default.py ./silkaj/src/constants.py
diff --git a/shell/cron_CODE.backup.sh b/shell/cron_CODE.backup.sh
index 43f707a..ed57db3 100755
--- a/shell/cron_CODE.backup.sh
+++ b/shell/cron_CODE.backup.sh
@@ -3,7 +3,7 @@
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
-# BACKUP G1sms+ current Devlt code and push it with MASTERKEYFILE encryption to IPFS
+# BACKUP G1sms+ current Devlt code and push it with NODE_G1PRIVKEYFILE encryption to IPFS
################################################################################
source ./shell/init.sh
source ./shell/functions.sh
diff --git a/shell/cron_CODE.upgrade.sh b/shell/cron_CODE.upgrade.sh
index a342968..8068944 100755
--- a/shell/cron_CODE.upgrade.sh
+++ b/shell/cron_CODE.upgrade.sh
@@ -3,7 +3,7 @@
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
-# BACKUP G1sms+ current Devlt code and push it with MASTERKEYFILE encryption to IPFS
+# BACKUP G1sms+ current Devlt code and push it with NODE_G1PRIVKEYFILE encryption to IPFS
################################################################################
## GET LATEST DEV $ROOT
source ./shell/init.sh
diff --git a/shell/cron_G1TAG_REFRESH.sh b/shell/cron_G1TAG_REFRESH.sh
index de8eaec..4b5ae53 100755
--- a/shell/cron_G1TAG_REFRESH.sh
+++ b/shell/cron_G1TAG_REFRESH.sh
@@ -63,7 +63,7 @@ for tag in ./wallets/.$IPFSNODEID/TAG/*; do
echo "__SUB:cron_G1TAG_REFRESH.sh: GET PUBLISHKEY for that G1TAG";
su $YOU -c "ipfs get -o /home/$YOU/.ipfs/keystore/${RR}.crypt /ipns/$tagj/TAG_publishkey.MASTER.crypt"
if [[ ! -f /home/$YOU/.ipfs/keystore/${RR}.crypt ]]; then log "__SUB:cron_MINUTE.sh: error getting publishkey"; continue; fi
- ./shell/natools.py decrypt -k "$MASTERKEYFILE" -i /home/$YOU/.ipfs/keystore/${RR}.crypt -o /home/$YOU/.ipfs/keystore/$RR
+ ./shell/natools.py decrypt -k "$NODE_G1PRIVKEYFILE" -i /home/$YOU/.ipfs/keystore/${RR}.crypt -o /home/$YOU/.ipfs/keystore/$RR
rm /home/$YOU/.ipfs/keystore/${RR}.crypt
fi
echo "__SUB:cron_G1TAG_REFRESH.sh: G1Tag PUBLISHKEY OK : /home/$YOU/.ipfs/keystore/${RR}"
diff --git a/shell/cron_IPFS_open_SSH.sh b/shell/cron_IPFS_open_SSH.sh
new file mode 100755
index 0000000..2961cc7
--- /dev/null
+++ b/shell/cron_IPFS_open_SSH.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+################################################################################
+# Author: Fred (support@qo-op.com)
+# Version: 0.1
+# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
+################################################################################
+# Activate SUPPORT MODE: open ssh over IPFS
+MY_PATH="`dirname \"$0\"`" # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
+if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
+if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
+
+YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
+if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi
+if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $YOU !"; exit; fi
+IPFSNODEID=$(su $YOU -c "ipfs id -f='\n'")
+cd $GPATH
+
+su $YOU -c ipfs p2p close --all
+su $YOU -c ipfs p2p listen /x/ssh /ip4/127.0.0.1/tcp/22
diff --git a/shell/cron_MINUTE.sh b/shell/cron_MINUTE.sh
index 483b68f..b94ca68 100755
--- a/shell/cron_MINUTE.sh
+++ b/shell/cron_MINUTE.sh
@@ -7,74 +7,113 @@
# CE FICHIER cron_MINUTE.sh EST EXECUTE TOUTES LES MINUTES
# IL CONSTITUE LE BATEMENT DE COEUR DU SYSTEME
################################################################################
+
+MY_PATH="`dirname \"$0\"`" # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
+if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
+if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
+
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
+if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi
+if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $YOU !"; exit; fi
IPFSNODEID=$(su $YOU -c "ipfs id -f='\n'")
-CHEMIN="/home/$YOU/G1sms+"
-cd $CHEMIN
+cd $GPATH
source ./shell/init.sh
source ./shell/functions.sh
-timebar=$(date +%H%M)
-
-if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system. sudo -s ?"; exit; fi
-if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $YOU !"; exit; fi
-
+timebar=$(date +%H:%M)
##################################################################
-# Refresh All peers SWARM Wallets.
+if [[ "$1" == "" ]]; then
+##################################################################
+ echo "It is $timebar in the morning, or in the night? It depends on your day..."
+ exit
+fi
##################################################################
-ipfs_swarm_wallets_refresh "SIMPLE"
################################################################################
# PRINT G1Tag PRINTED FROM ANOTHER NODE
# CREATE and REMOVE rr.bin -> done.rr
-if [[ -d "./wallets_swarm/.$IPFSNODEID/PRINT/" ]]; then
- log "__SUB:cron_MINUTE.sh: SEARCH NEW PRINT FOR ME .$IPFSNODEID"
- mkdir -p ./wallets/.$IPFSNODEID/PRINT/
+## if [[ -d "./wallets_swarm/.$IPFSNODEID/PRINT/" ]]; then
+## log "__SUB:cron_MINUTE.sh: SEARCH NEW PRINT FOR ME .$IPFSNODEID"
+## mkdir -p ./wallets/.$IPFSNODEID/PRINT/
- for qrrtag in ./wallets_swarm/.$IPFSNODEID/PRINT/*.bin; do
- rr=$(echo $qrrtag | cut -d '/' -f 5 | cut -d '.' -f 1)
- if [[ ! -f "./wallets/.$IPFSNODEID/PRINT/done.$rr" ]]; then
- log "__SUB:cron_MINUTE.sh: PRINT G1Tag $rr - START: $(date)"
- ./shell/natools.py decrypt -k "$MASTERKEYFILE" -i "${qrrtag}" -o "/tmp/G1Tag.png"
- log "__SUB:cron_MINUTE.sh: natools.py decrypt - $(date)"
- brother_ql_create --model QL-700 "/tmp/G1Tag.png" --label-size 62 > "/tmp/G1Tag.bin"
- log "__SUB:cron_MINUTE.sh: brother_ql_create - $(date)"
- brother_ql_print "/tmp/G1Tag.bin" /dev/usb/lp0
- log "__SUB:cron_MINUTE.sh: brother_ql_print - $(date)"
- # INFORM PRINT DONE
- echo "OK" > ./wallets/.$IPFSNODEID/PRINT/done.$rr
+##################################################################
+if [[ "$1" == "PRINT" ]]; then
+##################################################################
+ ##################################################################
+ # Refresh All peers SWARM Wallets.
+ ##################################################################
+ ipfs_swarm_wallets_refresh "SIMPLE"
+
+ ################################################################################
+ # PRINT G1Tag PRINTED FROM ANOTHER NODE (TODO: Correct BAD Cypher KEY + BUG why last image png layers are not printed???)
+ # CREATE and REMOVE rr.bin -> done.rr
+ if [[ -d "./wallets_swarm/.$IPFSNODEID/PRINT/" ]]; then
+ log "__SUB:cron_MINUTE.sh: SEARCH NEW PRINT FOR ME .$IPFSNODEID"
+ mkdir -p ./wallets/.$IPFSNODEID/PRINT/
+
+ for qrrtag in ./wallets_swarm/.$IPFSNODEID/PRINT/*.bin; do
+ rr=$(echo $qrrtag | cut -d '/' -f 5 | cut -d '.' -f 1)
+ if [[ ! -f "./wallets/.$IPFSNODEID/PRINT/done.$rr" ]]; then
+ log "__SUB:cron_MINUTE.sh: PRINT G1Tag $rr - START: $(date)"
+ ./shell/natools.py decrypt -k "$NODE_G1PRIVKEYFILE" -i "${qrrtag}" -o "/tmp/G1Tag.png"
+ log "__SUB:cron_MINUTE.sh: natools.py decrypt - $(date)"
+ brother_ql_create --model QL-700 "/tmp/G1Tag.png" --label-size 62 > "/tmp/G1Tag.bin"
+ log "__SUB:cron_MINUTE.sh: brother_ql_create - $(date)"
+ brother_ql_print "/tmp/G1Tag.bin" /dev/usb/lp0
+ log "__SUB:cron_MINUTE.sh: brother_ql_print - $(date)"
+ # INFORM PRINT DONE
+ echo "OK" > ./wallets/.$IPFSNODEID/PRINT/done.$rr
+ I=$(ipfs_node_wallets_add)
+ else
+ lqrrtag=$(echo "${qrrtag}" | sed s/_swarm//g )
+ log "__SUB:cron_MINUTE.sh: REMOVE OLD DONE PRINT ${lqrrtag} + ./wallets/.$IPFSNODEID/PRINT/done.$rr"
+ rm -f "./wallets/.$IPFSNODEID/PRINT/done.$rr"
+ rm -f "${lqrrtag}"
+ I=$(ipfs_node_wallets_add)
+ fi
+ done
+
+ log "__SUB:cron_MINUTE.sh: REMOVE OLD PRINT MARKED AS DONE"
+ for scan in ./wallets_swarm/.Qm*/PRINT/done.*; do
+ lscan=$(echo $scan | sed s/_swarm//g )
+ lid=$(echo $scan | cut -d '/' -f 3 | cut -d '.' -f 2 )
+ lrr=$(echo $scan | cut -d '/' -f 5 | cut -d '.' -f 2 )
+ log "__SUB:cron_MINUTE.sh: REMOVE ./wallets/.$lid/PRINT/$lrr.bin OLD PRINT ${lscan} SENT to $lid ($lrr.bin)"
+ rm -f ./wallets/.$lid/PRINT/$lrr.bin
+ rm -f "${lscan}"
I=$(ipfs_node_wallets_add)
- else
- lqrrtag=$(echo "${qrrtag}" | sed s/_swarm//g )
- log "__SUB:cron_MINUTE.sh: REMOVE OLD DONE PRINT ${lqrrtag} + ./wallets/.$IPFSNODEID/PRINT/done.$rr"
- rm -f "./wallets/.$IPFSNODEID/PRINT/done.$rr"
- rm -f "${lqrrtag}"
- I=$(ipfs_node_wallets_add)
- fi
- done
+ done
- log "__SUB:cron_MINUTE.sh: REMOVE OLD PRINT MARKED AS DONE"
- for scan in ./wallets_swarm/.Qm*/PRINT/done.*; do
- lscan=$(echo $scan | sed s/_swarm//g )
- lid=$(echo $scan | cut -d '/' -f 3 | cut -d '.' -f 2 )
- lrr=$(echo $scan | cut -d '/' -f 5 | cut -d '.' -f 2 )
- log "__SUB:cron_MINUTE.sh: REMOVE ./wallets/.$lid/PRINT/$lrr.bin OLD PRINT ${lscan} SENT to $lid ($lrr.bin)"
- rm -f ./wallets/.$lid/PRINT/$lrr.bin
- rm -f "${lscan}"
- I=$(ipfs_node_wallets_add)
- done
-
- rm "/tmp/G1Tag.bin"
- rm "/tmp/G1Tag.png"
+ rm "/tmp/G1Tag.bin"
+ rm "/tmp/G1Tag.png"
+ fi
fi
-
-
+##################################################################
##################################################################
-if [[ "$timebar" == "0300" ]]; then
+if [[ "$1" == "KALKUN" ]]; then
##################################################################
+<<<<<<< HEAD
echo "It is 3 in the morning, or in the night? It depends on your day..."
+=======
+ for number in ./wallets/*; do
+ member=""
+ phone=$(echo $number | cut -d '/' -f 3);
+ if [[ -f $number/$phone.uidname ]]; then member=$(cat $number/$phone.uidname); fi
+ if [[ ! $member ]]; then member=$phone; fi
+ if [[ $phone && $member ]]; then add_contact $phone $member; log "__SUB:cron_MINUTE.sh: KALKUN add_contact $phone $member"; fi
+ done
fi
##################################################################
+##################################################################
+if [[ "$1" == "TAG" ]]; then
+##################################################################
+ for tag in ./TAG/*; do
+ echo $tag
+ done
+>>>>>>> 5428251f0b59cad31e7955824a87c97cc9a67e76
+fi
+##################################################################
diff --git a/shell/functions.sh b/shell/functions.sh
index a7e80f3..b7367e0 100755
--- a/shell/functions.sh
+++ b/shell/functions.sh
@@ -21,7 +21,7 @@ function sms_SEND () {
if [[ ${#dest} -eq 10 || ${#dest} -eq 12 ]]; then
if [[ -d ./wallets/$dest ]]; then
# TEST IF $dest IS ON CURRENT NODE
- gammu-smsd-inject -l TEXT "$dest" -text "$mess" 1>&2
+ gammu-smsd-inject TEXT "$dest" -text "$mess" 1>&2
else
# Send SMS through $dest NODE (TODO: send it like PRINT, TASK, ...)
DESTNODEID=$(cat ./wallets_swarm/$dest/MASTERPHONE.ipfsid)
@@ -365,11 +365,11 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
#######################
# ACTIVATE G1SMS WALLET
#######################
- # log "$MASTERKEYFILE $PUBKEY THIRD_PARTY_MANAGER:$MASTERPUB"
- TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=3.24 --output=$PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$MASTERPUB " -y)
+ # log "$NODE_G1PRIVKEYFILE $PUBKEY THIRD_PARTY_MANAGER:$NODE_G1PUBKEY"
+ TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1PRIVKEYFILE" --amount=3.24 --output=$PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$NODE_G1PUBKEY " -y)
log "__SUB:sms_INIT_ACCOUNT: G1 Wallet TX IN: $TX_IN"
sleep 2
- TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount=0.1 --output=$MASTERPUB --comment="[G1sms+] $UIDNA$TAIL 3RD:$MASTERPUB:ACK" -y)
+ TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount=0.1 --output=$NODE_G1PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$NODE_G1PUBKEY:ACK" -y)
log "__SUB:sms_INIT_ACCOUNT: G1 Wallet TX OUT: $TX_OUT"
################
@@ -494,8 +494,8 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
#################################################################################################################################
function check_account (){
-log "__SUB:check_account: SILKAJ...... max 15 sec....."
-AMOUNTG1=$(./shell/timeout.sh -t 15 ./silkaj/silkaj amount "$PUBKEY")
+log "__SUB:check_account: SILKAJ...... max 21 sec....."
+AMOUNTG1=$(./shell/timeout.sh -t 21 ./silkaj/silkaj amount "$PUBKEY")
AMOUNTDU=$(bc <<< "scale=2; $AMOUNTG1 / $DUFACTOR")
AMOUNTLOVE=$(bc <<< "$AMOUNTG1 * 100 / $DUFACTOR")
diff --git a/shell/good.nodes.txt b/shell/good.nodes.txt
index 30d8aa9..b5b717b 100644
--- a/shell/good.nodes.txt
+++ b/shell/good.nodes.txt
@@ -1,6 +1,6 @@
-duniter-g1.p2p.legal:443
+duniter.dethegeek.eu.org:443
g1.duniter.fr:443
-g1.duniter.inso.ovh:443
g1.duniter.org:443
g1.le-sou.org:443
g1.monnaielibreoccitanie.org:443
+g1.presles.fr:443
diff --git a/shell/init.sh.old b/shell/init.sh.old
index 65517c1..ca20a67 100755
--- a/shell/init.sh.old
+++ b/shell/init.sh.old
@@ -1,9 +1,14 @@
#!/bin/bash
##################################################################
-# Author: poka (support@qo-op.com)
+# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: GPL (http://www.google.com/search?q=GPL)
##################################################################
+
+MY_PATH="`dirname \"$0\"`" # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
+source $MY_PATH/.install/.GPATH
+
# Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
function log () {
# log ($1=text)
@@ -30,9 +35,8 @@ export G1SMS="YES"
fi
- export YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
- export CHEMIN="/home/$YOU/G1sms+"
- cd $CHEMIN
+ export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
+ cd $GPATH
##################################################################
# Activate logging to /tmp/g1sms.log (YES/NO)
export DOLOG="YES"
@@ -61,13 +65,13 @@ fi
export NODECOMM=10
##################################################################
# SMS SIM Card Phone Number
- export MASTERPHONE="+3368818767"
- export ADRESSE="Blois"
+ export MASTERPHONE="+33651136520"
+ export ADRESSE="G1_Fablab_Toulouse"
export G1DAB="NO"
##################################################################
# ADMIN COMMAND PHONE ORIGIN
- export ADMINPHONE="+33650573417"
- export ADMINPSEUDO="poka"
+ export ADMINPHONE="+33647683646"
+ export ADMINPSEUDO="Fred"
##################################################################
# DUNITER/CESIUM+ DEFAULT SERVERS
export DUNITER="https://g1.duniter.org"
@@ -75,5 +79,5 @@ fi
# TODO Use latest Silkaj from "sudo fredp3 install silkaj"
# export SILKAJ="/usr/local/bin/silkaj"
- source $CHEMIN/shell/init_keys.sh
+ source $GPATH/shell/init_keys.sh
diff --git a/shell/init_keys.sh b/shell/init_keys.sh
index 67210aa..b4e1619 100755
--- a/shell/init_keys.sh
+++ b/shell/init_keys.sh
@@ -6,9 +6,14 @@
##################################################################
# CHECK & WARN | CREATE Keys (gpg encrypt, G1wallet, IPNS publish)
##################################################################
+
+MY_PATH="`dirname \"$0\"`" # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
+if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
+if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
+
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
# TODO Make it directory independant. (for now it is tested for pi running ipfs and code in $HOME/G1sms+
-CHEMIN="/home/$YOU/G1sms+"
##################################################################
# G1sms+ Node KEYS (G1wallet, gpg, IPNS)
@@ -20,19 +25,22 @@ if [ ! $GPGPASS ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey GPGPASS E
# G1sms+ Swarm KEYS
##################################################################
# G1sms Service - G1Wallet
-if [[ -f "${CHEMIN}/g1sms.pub.key" && -f "${CHEMIN}/g1sms.priv.key" ]]; then
- chown root:root ${CHEMIN}/g1sms.priv.key
- chmod 600 ${CHEMIN}/g1sms.priv.key
- export MASTERPUB=$(cat "${CHEMIN}/g1sms.pub.key")
- export MASTERKEYFILE="${CHEMIN}/g1sms.priv.key"
+if [[ -f "${GPATH}/g1sms.pub.key" && -f "${GPATH}/g1sms.priv.key" ]]; then
+ chown root:root ${GPATH}/g1sms.priv.key
+ chmod 600 ${GPATH}/g1sms.priv.key
+ export NODE_G1PUBKEY=$(cat "${GPATH}/g1sms.pub.key")
+ export NODE_G1PRIVKEYFILE="${GPATH}/g1sms.priv.key"
else
echo "ATTENTION!! Vous devez posséder la clef du G1 Wallet utilisé par le SWARM G1sms!!"
./shell/parle.sh "Les clefs du portefeuille essaim G1 SMS sont absente. Au revoir."
echo "Fichiers manquants:"
- echo "${CHEMIN}/g1sms.pub.key"
- echo "${CHEMIN}/g1sms.priv.key"
+ echo "${GPATH}/g1sms.pub.key"
+ echo "${GPATH}/g1sms.priv.key"
echo "Contactez nous sur https://g1sms.fr"
+ log "${GPATH}/g1sms.pub.key"
+ log "${GPATH}/g1sms.priv.key"
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "Clef de G1Wallet du SWARM g1sms.priv.key manquante! contactez-nous pour la recevoir https://g1sms.fr" 1>&2
+ gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "Debug: ${GPATH}/g1sms.pub.key et ${GPATH}/g1sms.priv.key" 1>&2
exit
fi
@@ -70,7 +78,7 @@ if [[ ! -f "./wallets/.$IPFSNODEID/$IPFSNODEID.pub" ]]; then
./shell/natools.py encrypt -p $NODEG1WALLET -i "./authfile" -o "./wallets/.$IPFSNODEID/$IPFSNODEID.authfile.crypt"
# TODO ADD ACCESS TO OTHER SWARM NODES CYPHERING WITH ALL ACTUAL NODES G1WALLET PUB KEYS
- # USEFUL TO OPERATE G1TAG WITHOUT SHARING MASTERKEYFILE...
+ # USEFUL TO OPERATE G1TAG WITHOUT SHARING NODE_G1PRIVKEYFILE...
# for nodepubfile in ./wallets_swarm/.Qm*/*.pub; do
# nodeG1pub=$(cat $nodepubfile)
# nodeID=$(echo $all | cut -d '/' -f 3)
@@ -85,7 +93,7 @@ if [[ ! -f "./wallets/.$IPFSNODEID/$IPFSNODEID.pub" ]]; then
log "__SUB:initkeys.sh: [ADMIN] G1sms+ CREATE G1WALLET FOR: $IPFSNODEID: pub = $NODEG1WALLET "
# BACKUP $IPFSNODEID config
- ./shell/natools.py encrypt -p $MASTERPUB -i "/home/$YOU/.ipfs/config" -o "./wallets/.$IPFSNODEID/$IPFSNODEID.ipfsconfig.crypt"
+ ./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "/home/$YOU/.ipfs/config" -o "./wallets/.$IPFSNODEID/$IPFSNODEID.ipfsconfig.crypt"
log "__SUB:initkeys.sh: [ADMIN] BACKUP $IPFSNODEID NODE CONFIG to ./wallets/.$IPFSNODEID/$IPFSNODEID.ipfsconfig.crypt "
#######################
@@ -110,8 +118,8 @@ if [[ ! -f "./wallets/.$IPFSNODEID/$IPFSNODEID.pub" ]]; then
echo $NODEG1WALLET > "./wallets/.$IPFSNODEID/$IPFSNODEID.pub"
# SILKAJ INIT G1 NODE WALLET
- TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=3.24 --output=$NODEG1WALLET --comment="[G1sms+] G1NODE ($ADMINPSEUDO) $UIDNA$TAIL $IPFSNODEID" -y)
- TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$IPFSNODEID" -password="$GPGPASS" --amount=0.1 --output=$MASTERPUB --comment="[G1sms+] G1NODE $IPFSNODEID:ACK" -y)
+ TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1PRIVKEYFILE" --amount=3.24 --output=$NODEG1WALLET --comment="[G1sms+] G1NODE ($ADMINPSEUDO) $UIDNA$TAIL $IPFSNODEID" -y)
+ TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$IPFSNODEID" -password="$GPGPASS" --amount=0.1 --output=$NODE_G1PUBKEY --comment="[G1sms+] G1NODE $IPFSNODEID:ACK" -y)
log "__SUB:initkeys.sh: [ADMIN] G1sms+ $ADMINPSEUDO-$UIDNA$TAIL OUVERT POUR NODE: ls ./wallet/.$IPFSNODEID"
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "[ADMIN] G1sms+ $ADMINPSEUDO-$UIDNA$TAIL OUVERT POUR NODE: ls ./wallets/.$IPFSNODEID" 1>&2
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "$NODEG1WALLET" 1>&2
diff --git a/shell/manual_BILLETS_PERIMES.sh b/shell/manual_BILLETS_PERIMES.sh
index 8b202c0..2b67696 100755
--- a/shell/manual_BILLETS_PERIMES.sh
+++ b/shell/manual_BILLETS_PERIMES.sh
@@ -4,13 +4,14 @@
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
################################################################################
-# Search for old G1Billets to transfer G1 & destroy them
+# TODO: Before June 2020: Get "./billets/$bpath/note.authfile.GPGPASS.gpg" for automatic Payback
+# Search for old G1Billets for final CHK : Forget & Transfer G1 ?
source ./shell/init.sh
source ./shell/functions.sh
# Existence days number can be $1
-if [[ "$1" ]]; then vieux="$1"; else vieux=180; fi
-if [[ "$2" ]]; then dest="$2"; else dest=$MASTERPUB; fi
+if [[ "$1" ]]; then vieux="$1"; else vieux=210; fi
+if [[ "$2" ]]; then dest="$2"; else dest=$NODE_G1PUBKEY; fi
echo "Recherche de G1Billets plus vieux que $vieux jours."
Nbillets=$(find billets/ -daystart -mtime +$vieux -type f -name "*.pubkey" | wc -l)
@@ -18,32 +19,43 @@ echo "$Nbillets G1Billets trouvés..."
for result in $(find billets/ -daystart -mtime +$vieux -type d -name "*"); do
billetname=$(echo $result | cut -d '/' -f 2)
- ((Nbillets --))
if [[ $billetname && "$billetname" != "MEMBERS" ]]; then
- code=$(echo $billetname | sed s/_/\ /g )
- creator=$(cat $result/*.creator)
+ ((Nbillets --))
+ numero=$(echo $billetname | sed s/_/\ /g )
+ creator=$(cat "$result/note.creator")
value=$(cat "$result/note.value")
unit=$(cat "$result/note.unit")
pubkey=$(cat "$result/note.pubkey")
salt=$(cat "$result/note.salt")
secret=$(cat "$result/note.secret")
- virement=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 balance $pubkey | grep Quantitative | cut -d '=' -f 2 | cut -d ' ' -f 2)
+ solde=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 balance $pubkey | grep Quantitative | cut -d '=' -f 2 | cut -d ' ' -f 2)
- echo ">>> $billetname $pubkey créé par $creator, valeur $virement G1."
+ # GET creator member wallet ($dest) and refund if still at initial G1 value (lost or unused BILL).
+ virement=$solde
+ [[ -f "$result/note.g1" ]] && initialvalue=$(cat "$result/note.g1") && if [[ $solde -eq $initialvalue ]]; then virement=$solde; else virement=1; fi
+ [[ -f "$result/note.memrib" ]] && dest=$(cat "$result/memrib")
+
+ echo ">>> $billetname $pubkey créé par $creator, valeur initiale $virement G1 (initialement $initialvalue G1)."
echo ">>> Virer à $dest $virement G1 du G1billet !! ID / Pass:"
- echo $code
+ echo $numero
echo $secret $salt
echo "/usr/local/bin/silkaj tx --amount=\"$virement\" --output=\"$dest\""
- PAY=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 tx --amount="$virement" --output="$dest" -y)
-
- if [[ ! $(echo $PAY | grep "successfully sent") ]]; then
- echo "!!!! ERREUR: $virement Something Wrong happened with $result"
- if [[ ! $virement ]]; then mv $result /tmp/$result; fi
+ if [[ "$solde" == "0.0" ]]; then
+ echo "G1Billet déjà vide, suppression de $result"; rm -Rf $result;
else
- echo "Tout s'est bien passé! On supprime $result et continue avec le billet $Nbillets"
- rm -Rf $result
+ PAY=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 tx --amount="$virement" --output="$dest" --comment="[G1Billet] $numero" -y)
+ if [[ ! $(echo $PAY | grep "successfully sent") ]]; then
+ echo "!!!! ERREUR: $virement Something Wrong happened with $result. Moving to /tmp/ERROR_BILL_$billetname (please check or remove)"
+ mkdir -p /tmp/ERROR_BILL_$billetname
+ mv $result/* /tmp/ERROR_BILL_$billetname
+ else
+ echo $PAY
+ echo "OK! On supprime $result et continue avec le billet $Nbillets"
+ echo
+ rm -Rf $result
+ fi
fi
else
echo "MEMBER:" $result
diff --git a/shell/nodes.txt b/shell/nodes.txt
index bd8c901..87579bf 100644
--- a/shell/nodes.txt
+++ b/shell/nodes.txt
@@ -1,9 +1,11 @@
-g1.duniter.inso.ovh:443
-g1.duniter.fr:443
-g1.monnaielibreoccitanie.org:443
-g1.le-sou.org:443
-monit.g1.nordstrom.duniter.org:443
-g1.duniter.org:443
-g1.presles.fr:443
duniter.moul.re:443
-duniter-g1.p2p.legal:443
+duniter.dethegeek.eu.org:443
+g1.presles.fr:443
+g1.duniter.fr:443
+monit.g1.nordstrom.duniter.org:443
+g1.le-sou.org:443
+g1.duniter.org:443
+g1.monnaielibreoccitanie.org:443
+follow.the.white-rabbit.net:443
+g1.acostey.fr:443
+duniter.acostey.fr:443
diff --git a/shell/sms_AIDE.sh b/shell/sms_AIDE.sh
index 404691d..0bd21ad 100755
--- a/shell/sms_AIDE.sh
+++ b/shell/sms_AIDE.sh
@@ -11,23 +11,20 @@ log "X sms_AIDE.sh ($1=phone)"
sms_INIT_ACCOUNT "$1" "NOSMS"
MESS="[Aide]
-N Id-M (Relier au portefeuille Id-M)
-U G1/DU/LOVE (UNIT)
-S (Solde)
-P 06nnnnnnnn 300 (Envoyer 300 UNIT à 06nnnnnnnn)"
+N Pseudo (membre ou nom de portefeuille) : Création portefeuille
+U G1/DU/LOVE : Unité
+S : Solde
+P 06nnnnnnnn 300 : Payer 300 à 06nnnnnnnn"
# Send response SMS
sms_SEND "$1" "$MESS"
-MESS="EMAIL moi@email.tld (Recevoir vos commandes par email)
-TAG 10 5 (Créer 5 G1Tag de 10 G1)
-VIR 50 Idw (Virer 50 UNIT vers Idw)"
+MESS="EMAIL moi@email : Indiquer son email
+VIR 50 Pseudo : Virer 50 à Pseudo (membre ou Portefeuille SMS)"
sms_SEND "$1" "$MESS"
-MESS="REC (Pour un payement récurrent)
-D (Détail de votre compte)
-A votre service.
-$ADMINPSEUDO / G1sms+ / $ADMINPHONE
-https://g1sms.fr"
+MESS="REC 50 Dest S 4 : Virer 50 à Dest pendant 4 Semaines (J/S/M/A)
+BILL n : Recevoir 6 G1Billets remplis de n LOVE par email!
+https://g1sms.fr - $ADMINPSEUDO ($ADMINPHONE)"
sms_SEND "$1" "$MESS"
log "END sms_AIDE.sh"
diff --git a/shell/sms_BILLET.sh b/shell/sms_BILLET.sh
index 5fe9d18..f902841 100755
--- a/shell/sms_BILLET.sh
+++ b/shell/sms_BILLET.sh
@@ -7,7 +7,7 @@
# Create and print 6 G1Billets de nn LOVE
source ./shell/init.sh
source ./shell/functions.sh
-log "X sms_BILLET.sh ($1=phone, $2=VALbillet)"
+log "__SUB:sms_BILLET.sh: ($1=phone, $2=VALbillet)"
phone="$1"
VALbillet="$2"
@@ -20,7 +20,7 @@ sms_INIT_ACCOUNT "$phone" "NOSMS"
# FIXED LOVE UNIT (6 month maximum validity)
UNIT="LOVE"
-log "MEMBER? $PHONE => $MEMBER"
+log "__SUB:sms_BILLET.sh: MEMBER? $PHONE => $MEMBER"
if [[ $UNKNOWN == "unknown" || "$MEMBER" == "" ]]; then
sms_ERROR "$phone" "Porte-monnaie non identifié.
@@ -56,88 +56,115 @@ VIR=$(bc -l <<< "scale=2; $amount * $DUFACTOR / 100")
# Need at least $MIN G1 available! $BILLCOM G1 commission
MIN=$(bc -l <<< "$AMOUNTG1 - $LIMIT - 21")
testmin=$( echo "${VIR} < ${MIN}" | bc -l )
-log "TEST : $VIR < $MIN ? $testmin"
+log "__SUB:sms_BILLET.sh: TEST : $VIR < $MIN ? $testmin"
# silkaj NODE CHANGE !!!
-SILKAJNODE=$(./shell/checknodes.sh)
-log "NEW SILKAJ NODE: $SILKAJNODE"
+#SILKAJNODE=$(./shell/checknodes.sh)
+#log "NEW SILKAJ NODE: $SILKAJNODE"
if [[ "$testmin" -eq "1" ]]
then
+ # Clean MEMBER directory
+ rm -f ./billets/MEMBERS/$MEMBER/*.jpg
boucle=0;
while [ $boucle -lt $NBbillets ]
do
# Creation du numéro de billet
- NUMBER=$(./shell/diceware.sh 4 | xargs)
+ NUMBER=$(./shell/diceware.sh 2 | xargs)
bpath=$(echo $NUMBER | sed 's/ /_/g')
# Cas d'un billet existant
while [ -d "./billets/$bpath" ]
do
- NUMBER=$(./shell/diceware.sh 4 | xargs)
+ NUMBER=$(./shell/diceware.sh 2 | xargs)
bpath=$(echo $NUMBER | sed 's/ /_/g')
done
- SECRET=$(./shell/diceware.sh 3 | xargs)
- SALT=$(./shell/diceware.sh 3 | xargs)
+ SECRET=$(./shell/diceware.sh 4 | xargs)
+
+ # ADD/REMOVE G1sms forced control over G1Billet
+ # SALT=$(./shell/diceware.sh 3 | xargs)
+ SALT=""
boucle=$(bc -l <<< "$boucle + 1")
- log "->BILLET:$PHONE:$NUMBER:$VALbillet:$UNIT"
+ log "__SUB:sms_BILLET.sh: ->BILLET:$PHONE:$NUMBER:$VALbillet:$UNIT"
# CREATE "NUMBER SECRET SALT" ACCOUNT for G1 transfert
TRANSAC=$(bc -l <<< "scale=2; $VIR / $NBbillets")
- BILLETPUBKEY=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$NUMBER" -password="$SECRET $SALT")
- log_history $PHONE "BILLET, $TRANSAC, $BILLETPUBKEY"
+ BILLETPUBKEY=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$NUMBER" -password="$SECRET$SALT")
+ # COPY authfile for easier usage in 6 month...
+ log "__SUB:sms_BILLET.sh: authfile KEY : ./billets/$bpath/note.authfile.GPGPASS.gpg"
+ mkdir -p "./billets/$bpath"
+ echo "${GPGPASS}" | gpg -q --output "./billets/$bpath/note.authfile.GPGPASS.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "./authfile"
+ rm -f "./authfile"
+
+ log_history $PHONE "G1BILLET, $TRANSAC, $BILLETPUBKEY"
sleep 3
# Fill BILLET with TRANSAC amount
- PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$TRANSAC" --output="$BILLETPUBKEY" --comment="THIRD_PARTY_MANAGER:$MASTERPUB:G1SMS:BILLET" -y)
+ PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$TRANSAC" --output="$BILLETPUBKEY" --comment="G1Billet $NUMBER" -y)
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
- mkdir -p "./billets/$bpath"
# NOTES ARE FILES STORED IN DICEWARE COMPOSED SUBDIR
+ echo "$(date +%Y%m%d)" > "./billets/$bpath/note.creationdate"
echo "$MEMBER" > "./billets/$bpath/note.creator"
+ echo "$MEMRIB" > "./billets/$bpath/note.memrib"
echo "$NUMBER" > "./billets/$bpath/note.number"
echo "$PHONE" > "./billets/$bpath/note.phone"
echo "$SECRET" > "./billets/$bpath/note.secret"
echo "$SALT" > "./billets/$bpath/note.salt"
- echo "$VALbillet" > "./billets/$bpath/note.value"
- echo "$UNIT" > "./billets/$bpath/note.unit"
+ echo "$VALbillet" > "./billets/$bpath/note.love"
+ echo "$TRANSAC" > "./billets/$bpath/note.g1"
echo "$BILLETPUBKEY" > "./billets/$bpath/note.pubkey"
log "Remplissage: $TRANSAC G1... $BILLETPUBKEY = $PAY"
# CREATION FICHIER IMAGE BILLET
- $(./shell/sms_BILLET_MAKE.sh "$NUMBER" "$SECRET" "$VALbillet" "$UNIT" "$DUFACTOR" "$BILLETPUBKEY" "$MEMBER" "$TRANSAC")
- log "./shell/sms_BILLET_MAKE.sh \"$NUMBER\" \"$SECRET\" \"$VALbillet\" \"$UNIT\" \"$DUFACTOR\" \"$BILLETPUBKEY\" \"$MEMBER\" \"$TRANSAC\""
+ $(./shell/sms_BILLET_MAKE.sh "$NUMBER" "$SECRET" "$VALbillet" "$UNIT" "$TRANSAC" "$BILLETPUBKEY" "$MEMBER" "$TRANSAC" "$PHONE")
+ log "./shell/sms_BILLET_MAKE.sh \"$NUMBER\" \"$SECRET\" \"$VALbillet\" \"$UNIT\" \"$TRANSAC\" \"$BILLETPUBKEY\" \"$MEMBER\" \"$TRANSAC\" \"$PHONE\""
# Transaction to create Link BILLET <-> MEMBER RIB => Decrease BILLET value !
sleep 2
- # PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$NUMBER" -password="$SECRET $SALT" --amount="0.05" --output="$MEMRIB" --comment="THIRD_PARTY_MANAGER:$MASTERPUB:G1SMS:BILLET:$VALbillet:$UNIT:$NUMBER" -y)
+ # PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$NUMBER" -password="$SECRET $SALT" --amount="0.05" --output="$MEMRIB" --comment="THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:G1SMS:BILLET:$VALbillet:$UNIT:$NUMBER" -y)
else
sms_ERROR "$PHONE" "Un problème est survenu. Contactez $ADMINPSEUDO au $ADMINPHONE"
+ # Copy & Send produiced files
+ zip /tmp/$PHONE_Bills_$bpath.zip ./billets/MEMBERS/$MEMBER/*.*
+ mpack -s "[G1sms+]_G1Billets ($bpath) Erreur... création G1Billets..." -d /tmp/message_body.txt /tmp/$PHONE_Bills_$bpath.zip $MAIL && mv /tmp/$PHONE_Bills_$bpath.zip ./billets/MEMBERS/$MEMBER/ && log "__SUB:sms_BILLET.sh: ALERT sent....."
+
+ log "__SUB:sms_BILLET.sh: ERROR SILKAJ $(cat ./silkaj/src/constants.py)"
+ exit
fi
done
# + G1SMS Commission
sleep 2
- COM=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$BILLCOM" --output="$MASTERPUB" --comment="[G1SMS] G1billet Commission" -y)
+ COM=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$BILLCOM" --output="$NODE_G1PUBKEY" --comment="[G1sms+] Achat G1Billets" -y)
- # IMPRIMER LES BILLETS! Brancher votre imprimante et configurer cups avant ;)
+ # POUR IMPRIMER LES BILLETS! Brancher votre imprimante, configurer cups, activer code lp ;)
num=$(date +%Y%m%d)
- log "PRINT $num $MEMBER"
- montage ./billets/MEMBERS/$MEMBER/*.jpg -tile 2x3 -geometry 964x459 /tmp/$PHONE_Bills_$bpath.pdf
-# lp /tmp/$PHONE_Bills_$bpath.pdf
- cp /tmp/$PHONE_Bills_$bpath.pdf ./billets/MEMBERS/$MEMBER/
- zip ./_Bill_$MEMBER_$num.zip ./billets/MEMBERS/$MEMBER/*.jpg && rm -f ./billets/MEMBERS/$MEMBER/*.jpg
+ log "__SUB:sms_BILLET.sh: PRINT $num $MEMBER"
+ montage ./billets/MEMBERS/$MEMBER/*.jpg -tile 2x3 -geometry 964x459 /tmp/$PHONE_Bills_$bpath.pdf && rm -f ./billets/MEMBERS/$MEMBER/*.jpg && log "__SUB:sms_BILLET.sh: PDF made /tmp/$PHONE_Bills_$bpath.pdf"
+ cd /tmp && zip $PHONE_Bills_$bpath.zip $PHONE_Bills_$bpath.pdf && log "__SUB:sms_BILLET.sh: Zip DONE :: /tmp$PHONE_Bills_$bpath.zip !!" && cd -
+ # rm -f /tmp/$PHONE_Bills_$bpath.pdf
- # SEND EMAIL
- # Détruit ce mail et le pdf après impression et fabrication des billets au code caché.
- # Créer la monnaie implique une grande responsabilité!
-
+ # SEND EMAIL ZIP attached
+ echo "Commande #$NANODATE/$bpath
+>> Planche de 6 G1Billets : $VALbillet LOVE <<
+Envoyez-nous vos remarques...
+
+https://g1sms.fr" > /tmp/message_body.txt
+ mpack -s "[G1sms+]_G1Billets ($bpath) A IMPRIMER et détruire cet email..." -d /tmp/message_body.txt /tmp/$PHONE_Bills_$bpath.zip $MAIL && log "__SUB:sms_BILLET.sh: EMAIL sent....."
+# rm -f /tmp/$PHONE_Bills_$bpath.zip
+# mpack -s "[G1sms+]_G1Billets ($bpath) imprimer recto/verso vos G1Billets?!" -d /tmp/message_body.txt ./Dos_G1Billets.odt $MAIL && log "__SUB:sms_BILLET.sh: + EMAIL recto: OK"
+ log "__SUB:sms_BILLET.sh: G1Billets $PHONE_Bills_$bpath.pdf envoyé par email à $MEMBER : $MAIL "
mess="[G1SMS]
-$NBbillets billet(s) de $VALbillet $UNIT ($TRANSAC G1) créé(s).
-Contactez $ADMINPSEUDO au $ADMINPHONE pour les recevoir...
-http://g1sms.fr/g1sms/aide"
+$NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1) créé(s).
+Envoyés vers $MAIL, vérifiez vos SPAM...
+Support: $ADMINPSEUDO ($ADMINPHONE)
+"
sms_SEND "$phone" "$mess"
+ # ADMIN ALERT SMS + TODO Add ADMINEMAIL parameter in "install.sh"
+ sms_SEND "$ADMINPHONE" "$MEMBER vient de créer $NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1): $MAIL"
+ cat ./email.txt | sed s/EMAIL/frenault@linkeo.com/g | sed s/SUBJECT/Creation_G1Billets/g | sed s/MESSAGE/"$MEMBER ($PHONE) vient de creer $NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1) vers $MAIL"/g | ssmtp "frenault@linkeo.com"
#####################################
# Amount too High, solde insuffisant
@@ -151,7 +178,7 @@ Insuffisant pour créer $NBbillets billet(s) de $VALbillet $UNIT
https://g1.duniter.fr/api/#/v1/payment/$PUBKEY?amount=$VIR"
fi
-log "END sms_BILLET.sh"
+log "__SUB:sms_BILLET.sh: END sms_BILLET.sh"
log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
exit
diff --git a/shell/sms_BILLETCHK.sh b/shell/sms_BILLETCHK.sh
index 5a46923..b0e0c1d 100755
--- a/shell/sms_BILLETCHK.sh
+++ b/shell/sms_BILLETCHK.sh
@@ -7,8 +7,8 @@ source ./shell/functions.sh
log "X sms_BILLETCHK.sh $0"
PHONE="$1"
-CODE="$2 $3 $4 $5"
-SEC="$6 $7 $8"
+CODE="$2 $3"
+SEC="$4 $5 $6 $7"
# Construct billet path
bpath=$(echo "$CODE" | sed 's/ /_/g')
@@ -41,24 +41,22 @@ https://www.g1sms.fr/contact"
# Account creation
sms_INIT_ACCOUNT "$PHONE"
fi
- log "./silkaj/silkaj transaction --auth-scrypt -salt=\"$CODE\" -password=\"$SEC $SALT\" --amount=\"$AMOUNTG1\" --output=\"$PUBKEY\" --comment=\"THIRD_PARTY_MANAGER:$MASTERPUB:G1SMS:ENCAISSEMENT:$CODE\" -y"
- PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$CODE" -password="$SEC $SALT" --amount="$AMOUNTG1" --output="$PUBKEY" --comment="THIRD_PARTY_MANAGER:$MASTERPUB:ENCAISSEMENT:$CODE" -y)
+ log "./silkaj/silkaj transaction --auth-scrypt -salt=\"$CODE\" -password=\"$SEC$SALT\" --amount=\"$AMOUNTG1\" --output=\"$PUBKEY\" --comment=\"THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:G1SMS:ENCAISSEMENT:$CODE\" -y"
+ PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$CODE" -password="$SEC$SALT" --amount="$AMOUNTG1" --output="$PUBKEY" --comment="THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:ENCAISSEMENT:$CODE" -y)
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
# DESTROY BILLET
- rm -f ./billets/$bpath/note.*
- rmdir ./billets/$bpath
+ rm -Rf ./billets/$bpath
# DESTROY PUBLIC CACHE in /tmp
if [ -d "/tmp/billets_valides/$bpath" ]; then
- rm -f /tmp/billets_valides/$bpath/*
- rmdir /tmp/billets_valides/$bpath
+ rm -Rf /tmp/billets_valides/$bpath
fi
SOLDE=$(./silkaj/silkaj amount "$PUBKEY")
mess="[G1SMS]
ENCAISSEMENT de $VALbillet $UNIT ($AMOUNTG1 G1)
-ds le porte-monnaie $PHONE ($PUBKEY)
+dans portefeuille $UIDNA ($PHONE)
OK!
Solde: $SOLDE G1"
sms_SEND "$PHONE" "$mess"
@@ -66,7 +64,7 @@ Solde: $SOLDE G1"
log "=> $PUBKEY"
log_history $PHONE "BILLET_CHK, $AMOUNTG1, $bpath, $PUBKEY"
else
- sms_ERROR "$PHONE" "Erreur! Transaction Impossible... Réessayez plus tard ou contactez $ADMINPSEUDO : $ADMINPHONE"
+ sms_ERROR "$PHONE" "Erreur! Transaction Impossible! Valeur du G1Billet $AMOUNTG1 G1. Contactez $ADMINPSEUDO : $ADMINPHONE"
fi
fi
else
diff --git a/shell/sms_BILLET_MAKE.sh b/shell/sms_BILLET_MAKE.sh
index 9b39a91..18c1493 100755
--- a/shell/sms_BILLET_MAKE.sh
+++ b/shell/sms_BILLET_MAKE.sh
@@ -17,11 +17,12 @@ NUMERO="$1"
SECRET="$2"
MONTANT="$3"
UNIT="$4"
-DUFACTOR="$5"
+JUNE="$5"
NOTERIB="$6"
MEMBER="$7"
TRANSAC="$8"
-log "X ./shell/sms_BILLET_MAKE.sh \"$1\" \"$2\" \"$3\" \"$4\" \"$5\" \"$6\" \"$7\" \"$8\""
+PHONE="$9"
+log "X sudo ./shell/sms_BILLET_MAKE.sh \"$1\" \"$2\" \"$3\" \"$4\" \"$5\" \"$6\" \"$7\" \"$8\""
if [[ "$NOTERIB" == "" || "$MEMBER" == "" ]]
then
@@ -43,17 +44,24 @@ fi
valid="0${valid:0:2}"
# ADD VALIDITY to convert: -pointsize 20 -draw 'text 380,410 "'"A encaisser avant le 01/$valid/$year"'"' \
-# Add G1sms logo (250px)
-composite -compose Over -gravity SouthWest -geometry +50+50 "./shell/G1sms.png" "./shell/Oeuro.jpg" "/tmp/$NUMERO.jpg"
+# ADD Avatar on G1 Logo SouthEast
+if [[ $(file "./wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then
+ composite -compose Over -gravity East -geometry +15+0 -dissolve 33% "./wallets/$PHONE/$PHONE.avatar.png" "./shell/Oeuro.jpg" "/tmp/$NUMERO.jpg"
+ composite -compose Over -gravity West -geometry +15+0 -dissolve 33% "./wallets/$PHONE/$PHONE.avatar.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
+else
+ composite -compose Over -gravity East -geometry +15+0 -dissolve 33% "./shell/G1Anar.png" "./shell/Oeuro.jpg" "/tmp/$NUMERO.jpg"
+ composite -compose Over -gravity West -geometry +15+0 -dissolve 33% "./shell/G1Anar.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
+fi
+
+# Add G1Billet_LOVE.png logo (250px)
+composite -compose Over -gravity SouthWest -geometry +50+50 -dissolve 70% "./shell/G1Billet_LOVE.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
# Prepare BILLET qrcode verification URL
-#qrencode "$NOTERIB" -o "/tmp/$NUMERO_NOTERIB.png"
-REQ=$(echo $NUMERO | sed 's/ /_/g')
-qrencode "https://www.g1sms.fr/$ADMINPSEUDO/check.php?code=$REQ" -o "/tmp/$NUMERO_NOTERIB.png"
+qrencode -s 3 -o "/tmp/$NUMERO_NOTERIB.png" "$NOTERIB"
-# BILL PUBKEY => Someone can Add amount to it !!!
+# BILL PUBKEY means Someone can Add amount to it !!!
# Add verification QRCode
-composite -compose Over -gravity NorthEast -geometry +40+40 "/tmp/$NUMERO_NOTERIB.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
+composite -compose Over -gravity NorthEast -geometry +50+25 "/tmp/$NUMERO_NOTERIB.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
# Add June logo
case "$MONTANT" in
@@ -82,7 +90,7 @@ case "$MONTANT" in
cp "./shell/g1.png" "/tmp/g1.png"
;;
esac
-composite -compose Over -gravity SouthEast -geometry +20+20 "/tmp/g1.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
+composite -compose Over -gravity SouthEast -geometry +20+20 -dissolve 90% "/tmp/g1.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
DUPART=$(bc -l <<< "scale=2; $MONTANT / 100")
# ADD 0 to <1 DUPART
@@ -90,16 +98,17 @@ testdu=$( echo "${DUPART} < 1" | bc -l )
if [[ "$testdu" -eq "1" ]]; then
DUPART="0${DUPART}"
fi
-#SECRET=$(echo $SECRET | sed 's/ /\n/g')
+
+SIMPLEPHONE=$(echo $MASTERPHONE | sed 's/\+33/0/g')
convert -font 'Liberation-Sans' \
-pointsize 120 -fill black -draw 'text 200,220 "'"$DUPART DU"'"' \
-pointsize 45 -draw 'text 550,270 "'"$MONTANT $UNIT"'"' \
--pointsize 35 -draw 'text 50,60 "'"[G1sms] 06 66 80 57 20"'"' \
--pointsize 30 -draw 'text 60,100 "'"CHK $NUMERO"'"' \
--pointsize 22 -fill black -draw 'text 520,340 "'"$SECRET"'"' \
--pointsize 22 -fill black -draw 'text 400,410 "'"Encaisser avant le 01/$valid/$year"'"' \
--pointsize 20 -draw 'text 50,444 "'"Envoyer par sms, CHK $NUMERO + les mots découverts sous la zone à gratter"'"' \
+-pointsize 35 -draw 'text 50,60 "'"https://g1sms.fr _ G1Billet _ $JUNE G1"'"' \
+-pointsize 30 -draw 'text 60,100 "'"Identifiant: $NUMERO"'"' \
+-pointsize 22 -fill black -draw 'text 380,340 "'"Code Secret: $SECRET"'"' \
+-pointsize 22 -fill black -draw 'text 260,408 "'"Porte Monnaie Libre!! A utiliser avant le 01/$valid/$year"'"' \
+-pointsize 20 -draw 'text 15,442 "'"Utilisation: CHK $NUMERO (+ code secret) par SMS au $SIMPLEPHONE ou https://cesium.app"'"' \
"/tmp/$NUMERO.jpg" "/tmp/BILL.$year.$valid.$NUMERO.$MONTANT.$UNIT.jpg"
# Payable par SMS en envoyant les codes grattant la case comportant le SECRET
diff --git a/shell/sms_COUNT.sh b/shell/sms_COUNT.sh
index e422a58..db68e8c 100755
--- a/shell/sms_COUNT.sh
+++ b/shell/sms_COUNT.sh
@@ -47,10 +47,11 @@ log "Solde = $AMOUNTG1 ($UNIT)"
if [ "$2" != "NOSMS" ]; then
if [[ "$AMOUNT" != "" ]]; then
mess="[G1sms+]
-ID: $UIDNA <=> $MEMBER
+ID: $UIDNA
$AMOUNT $UNIT ($AMOUNTG1 G1)
-
-Recharger avec https://cesium.app"
+=> $MEMBER
+$MEMRIB
+https://cesium.app"
# Send response SMS
sms_SEND "$PHONE" "$mess"
sms_SEND "$PHONE" "$PUBKEY"
diff --git a/shell/sms_DESTROY.sh b/shell/sms_DESTROY.sh
index 5369a74..4b53d1c 100755
--- a/shell/sms_DESTROY.sh
+++ b/shell/sms_DESTROY.sh
@@ -31,8 +31,8 @@ fi
sms_INIT_ACCOUNT "$PHONE"
if [[ "$MEMBERUID" == "DON" || "$MEMBERUID" == "" || "$MEMBERUID" == "$MEMBER" ]]; then
# OK THAT GUYS KNOWS something (TODO Secure better with double authentification, with email or second phone number...)
- # IF no Dest PubKey (no member) or DON, then MASTERPUB is collecting LOVE money.
- if [[ $MEMRIB == "" || "$MEMBERUID" == "DON" ]]; then MEMBER=$ADMINPSEUDO; MEMRIB=$MASTERPUB; fi
+ # IF no Dest PubKey (no member) or DON, then NODE_G1PUBKEY is collecting LOVE money.
+ if [[ $MEMRIB == "" || "$MEMBERUID" == "DON" ]]; then MEMBER=$ADMINPSEUDO; MEMRIB=$NODE_G1PUBKEY; fi
AMOUNTG1=$(./silkaj/silkaj amount "$PUBKEY")
GETLIMIT=$(bc <<< "$AMOUNTG1 - $LIMIT")
diff --git a/shell/sms_EMAIL.sh b/shell/sms_EMAIL.sh
index 2ebba7b..9df63c6 100755
--- a/shell/sms_EMAIL.sh
+++ b/shell/sms_EMAIL.sh
@@ -7,9 +7,10 @@
# sudo apt install ssmtp mpack
# Configure in /etc/ssmtp
# Send email with file attachement: mpack -s "Logo G1Tag" /home/pi/G1sms+/G1Tag.png dest@email.ext
-
+
source ./shell/init.sh
source ./shell/functions.sh
+
log "__SUB:sms_EMAIL.sh.sh: START ($1=phone, $2=mail)"
phone="$1"
@@ -35,7 +36,7 @@ fi
# SEND EMAIL WITH ssmtp
SUBJECT="[G1sms+] $MEMBER, message de votre portefeuille monnaie libre $UIDNA ($PHONE)"
-MESSAGE="Bonjour $MEMBER\n\nLe detenteur du porte-monnaie G1sms $UIDNA ($PHONE) a choisi votre email comme contact.\nVous y recevrez nos prochains envois ...\n\n\nA bientot <3\n$ADMINPSEUDO - ($MASTERPHONE) Partenaire G1sms+"
+MESSAGE="Bonjour $MEMBER\n\nVotre porte-monnaie G1sms $UIDNA ($PHONE) a choisi votre email comme contact.\nPour commander vos G1Billets, envoyez par SMS à $MASTERPHONE :\nBILL 10/20/50/100/200/500/1000\n\n\nA bientot <3\n$ADMINPSEUDO - ($MASTERPHONE) Partenaire G1sms+"
cat ./email.txt | sed s/EMAIL/"${mail}"/g | sed s/SUBJECT/"${SUBJECT}"/g | sed s/MESSAGE/"${MESSAGE}"/g | ssmtp ${mail}
log "__SUB:sms_EMAIL.sh.sh: Send welcome EMAIL to $mail via ssmtp"
log_history $PHONE "EMAIL, $mail"
@@ -43,7 +44,7 @@ log_history $PHONE "EMAIL, $mail"
mess="[G1sms+]
$MEMBER
Votre email est : $mail
-Mettez le à jour, quand cela est nécessaire..."
+Mettez le à jour, si cela est nécessaire..."
sms_SEND "$phone" "$mess"
diff --git a/shell/sms_G1TAG.sh b/shell/sms_G1TAG.sh
index e022f48..4d4d528 100755
--- a/shell/sms_G1TAG.sh
+++ b/shell/sms_G1TAG.sh
@@ -82,7 +82,7 @@ if [[ ! $PASSENGER && ! $G1DAB ]]; then
if [[ -f ./wallets/$PHONE/ipfsid.G1TAGNODE ]]; then
DABnode=$(cat ./wallets/$PHONE/ipfsid.G1TAGNODE)
if [[ "$DABnode" == "$IPFSNODEID" ]]; then
- sms_ERROR "$PHONE" "IMPRIMANTE G1Tag non détectée!! Choisissez un autre NODE G1Dab... $spot"
+ sms_ERROR "$PHONE" "IMPRIMANTE G1Tag non détectée!! Choisissez un autre G1Dab... $spot"
log "__SUB:sms_G1TAG.sh: IMPRIMANTE G1Tag non détectée!!"
exit
fi
@@ -100,18 +100,18 @@ fi
###########################################
# PAY VIR + PERCENT G1
ML=$(bc -l <<< "scale=2; $VIR + $PERCENT")
-PAY=$(./shell/timeout.sh -t 29 ./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$ML" --output="$MASTERPUB" --comment="[G1sms+] ACHAT $3 G1Tag(s) - $2 $UNIT" -y)
+PAY=$(./shell/timeout.sh -t 29 ./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$ML" --output="$NODE_G1PUBKEY" --comment="[G1sms+] ACHAT $3 G1Tag(s) - $2 $UNIT" -y)
if [[ "$PAY" == "" || "$(echo $PAY | cut -d '|' -f 1)" == "KO" ]]; then
new=$(./shell/checknodes.sh "BAN")
sms_ERROR "$PHONE" "Il est survenu un problème lors de votre virement: $PAY / Silkaj: $new";
exit
else
cents=$(echo $(bc -l <<< "scale=0; $ML * 100") | cut -d '.' -f 1)
- move_g1cents "$PHONE" "$MASTERPUB" "$cents"
+ move_g1cents "$PHONE" "$NODE_G1PUBKEY" "$cents"
fi
#############################################
-log "__SUB:sms_G1TAG.sh: CREATE $NUMBER x $2 $UNIT G1Tag(s) for $MEMBER ($PHONE) : PAYEMENT $ML G1 to $MASTERPUB: $PAY"
+log "__SUB:sms_G1TAG.sh: CREATE $NUMBER x $2 $UNIT G1Tag(s) for $MEMBER ($PHONE) : PAYEMENT $ML G1 to $NODE_G1PUBKEY: $PAY"
c=0
while [[ $c -lt $NUMBER ]]; do
((c++))
@@ -180,7 +180,7 @@ TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash
# Enregistrement de la clef de publication chiffrée par $PUBKEY la clef publique du portefeuille G1 createur.
./shell/natools.py encrypt -p $PUBKEY -i "/home/$YOU/.ipfs/keystore/${RR}" -o "$TAGG1smsWKEY"
# GIVE SWARM ACCESS TO ZEN TAG
- ./shell/natools.py encrypt -p $MASTERPUB -i "/home/$YOU/.ipfs/keystore/${RR}" -o "$TAGSWARMKEY"
+ ./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "/home/$YOU/.ipfs/keystore/${RR}" -o "$TAGSWARMKEY"
###########################################################
# TAG IPFS STORAGE & G1Tag IPNS PUBLISHING
@@ -217,15 +217,17 @@ TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash
composite -compose Over -resize 133% -gravity West "./TAG/${RR}/TAG_READ.png" "./shell/g1tag.png" "./TAG/${RR}/${RR}.png"
composite -compose Over -gravity SouthEast "./TAG/${RR}/TAG_WRITE.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
# ADD Avatar in the Center
- if [[ $(file "./wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then
- composite -compose Over -resize 150% -gravity Center "./wallets/$PHONE/$PHONE.avatar.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
- else
- composite -compose Over -resize 100% -gravity Center "./shell/Portefeuille.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
- fi
+# if [[ $(file "./wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then
+# composite -compose Over -resize 150% -gravity Center "./wallets/$PHONE/$PHONE.avatar.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
+# else
+# composite -compose Over -resize 100% -gravity Center "./shell/G1Anar.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
+# fi
# WRITE G1Tag G1 amount
- convert -pointsize 150 -fill black -gravity Center -draw 'text 300,-140 "'"$2"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
- convert -pointsize 50 -fill black -gravity North -draw 'text 20,0 "'"${PR}"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
+# if [[ $NUMBER -ne 1 ]]; then
+ convert -pointsize 60 -fill black -gravity Center -draw 'text 0,-100 "'"$2"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png";
+# fi
+ convert -pointsize 40 -fill black -gravity NorthEast -draw 'text 80,0 "'"${PR}"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
# WRITE G1Tag RR
convert -pointsize 40 -fill black -gravity SouthWest -draw 'text 3,0 "'"${RR}"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
@@ -239,10 +241,10 @@ TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash
brother_ql_create --model QL-700 "./TAG/${RR}/${RR}.png" --label-size 62 > "./TAG/${RR}/${RR}.bin"
brother_ql_print "./TAG/${RR}/${RR}.bin" /dev/usb/lp0
else
- # PRINT ON ANOTHER G1Dab. Send files to G1Tag Printer TODO: Could use DESTNODEPUB instead of MASTERPUB ?
+ # PRINT ON ANOTHER G1Dab. Send files to G1Tag Printer TODO: Could use DESTNODEPUB instead of NODE_G1PUBKEY ?
log "__SUB:sms_G1TAG.sh: Remote PRINT :: ./wallets/.$destnode/PRINT/${RR}.bin "
mkdir -p "./wallets/.$destnode/PRINT/"
- ./shell/natools.py encrypt -p $MASTERPUB -i "./TAG/${RR}/${RR}.png" -o "./wallets/.$destnode/PRINT/${RR}.bin"
+ ./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "./TAG/${RR}/${RR}.png" -o "./wallets/.$destnode/PRINT/${RR}.bin"
fi
else
#
@@ -258,13 +260,19 @@ done
if [[ "$destnode" == "" || "$destnode" == "$IPFSNODEID" ]]; then
# PRINT $PHONE WALLET PUBKEY
qrencode -s 5 -o "/tmp/G1PubQR.$PHONE.png" "$(cat ./wallets/$PHONE/$PHONE.pub)"
- composite -compose Over -resize 133% -gravity West "/tmp/G1PubQR.$PHONE.png" "./shell/g1tag.png" "/tmp/G1PubQR.$PHONE.png"
+ composite -compose Over -gravity West "/tmp/G1PubQR.$PHONE.png" "./shell/g1tag.png" "/tmp/G1PubQR.$PHONE.png"
+
if [[ $(file "./wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then
- composite -compose Over -resize 150% -gravity Center "./wallets/$PHONE/$PHONE.avatar.png" "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
+ composite -compose Over -gravity Center "./wallets/$PHONE/$PHONE.avatar.png" "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
fi
- convert -pointsize 60 -fill black -gravity Center -draw 'text 340,-160 "'"$MEMBER"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
- convert -pointsize 70 -fill black -gravity Center -draw 'text 345,-5 "'"$UIDNA"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
- convert -pointsize 60 -fill black -gravity Center -draw 'text 350,80 "'"$PHONE"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
+ if [[ -f ./wallets/$PHONE/$PHONE.uidrib ]]; then
+ qrencode -s 6 -o "/tmp/G1MemQR.$PHONE.png" "$(cat ./wallets/$PHONE/$PHONE.uidrib)";
+ composite -compose Over -gravity SouthEast "/tmp/G1MemQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" && rm /tmp/G1MemQR.$PHONE.png
+ fi
+
+ convert -pointsize 40 -fill black -gravity NorthEast -draw 'text 100,0 "'"G1 $MEMBER"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
+ convert -pointsize 40 -fill black -gravity SouthWest -draw 'text 10,0 "'"$UIDNA"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
+ #convert -pointsize 60 -fill black -gravity Center -draw 'text 350,80 "'"$PHONE"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
brother_ql_create --model QL-700 "/tmp/G1PubQR.$PHONE.png" --label-size 62 > "/tmp/G1PubQR.$PHONE.bin"
brother_ql_print "/tmp/G1PubQR.$PHONE.bin" /dev/usb/lp0
rm -f /tmp/G1PubQR.*
diff --git a/shell/sms_PAY.sh b/shell/sms_PAY.sh
index 586e3cf..3edb8c2 100755
--- a/shell/sms_PAY.sh
+++ b/shell/sms_PAY.sh
@@ -64,7 +64,7 @@ fi
sleep 2
# + G1SMS Commission
-COM=$(./shell/timeout.sh -t 20 ./silkaj/silkaj transaction --auth-scrypt -salt="$phone" -password="$pin" --amount="$PERCENT" --output="$MASTERPUB" --comment="[G1sms+] Commission" -y)
+COM=$(./shell/timeout.sh -t 20 ./silkaj/silkaj transaction --auth-scrypt -salt="$phone" -password="$pin" --amount="$PERCENT" --output="$NODE_G1PUBKEY" --comment="[G1sms+] Commission" -y)
if [[ "$(echo $COM | cut -d '|' -f 1)" == "KO" || "$PAY" == "" ]]; then
new=$(./shell/checknodes.sh "BAN")
sms_ERROR "$phone" "Problème de payement avec silkaj (changement de serveur $new): $COM";
@@ -73,7 +73,7 @@ if [[ "$(echo $COM | cut -d '|' -f 1)" == "KO" || "$PAY" == "" ]]; then
else
# OK: Sync g1cents
cents=$(echo $(bc -l <<< "scale=0; $PERCENT * 100") | cut -d '.' -f 1)
- move_g1cents "$phone" "$MASTERPUB" "$cents"
+ move_g1cents "$phone" "$NODE_G1PUBKEY" "$cents"
fi
# LOG ACCOUNT HISTORY EVENTS
diff --git a/shell/sms_REC.sh b/shell/sms_REC.sh
index 7ec15d1..911e01d 100755
--- a/shell/sms_REC.sh
+++ b/shell/sms_REC.sh
@@ -79,20 +79,22 @@ else
log "__SUB:sms_REC.sh: SEARCH $VIRDEST related wallet!!! $DESTRIB "
DESTMEM="$VIRDEST"
# SEARCH IN WALLETS
- LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidna | tail -n 1 | cut -f 3 -d '/')
+ LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
+ if [[ "$LOCAL" == "" ]]; then LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
if [[ "$LOCAL" != "" ]]; then
# LOCAL G1sms account
DESTRIB=$(cat ./wallets/$LOCAL/$LOCAL.pub)
DESTPHONE=$LOCAL
log "__SUB:sms_REC.sh: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)"
else
- # SEARCH IN WALLETS SWARM
- SWARMNB=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/')
- if [[ "$LOCAL" != "" ]]; then
- REMOTENODE=$(cat ./wallets_swarm/$SWARMNB/MASTERPHONE.sms)
- DESTRIB=$(cat ./wallets_swarm/$SWARMNB/$SWARMNB.pub)
- DESTPHONE=$SWARMNB
- log "__SUB:sms_REC.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($SWARMNB)"
+ # SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA)
+ INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
+ if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
+ if [[ "$INSWARM" != "" ]]; then
+ REMOTENODE=$(cat ./wallets_swarm/$INSWARM/MASTERPHONE.sms)
+ DESTRIB=$(cat ./wallets_swarm/$INSWARM/$INSWARM.pub)
+ DESTPHONE=$INSWARM
+ log "__SUB:sms_REC.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)"
else
# SEARCH WITH SILKAJ
DESTRIB=$(./silkaj/silkaj id "$DESTMEM" | grep -w "$DESTMEM" | awk '{print $2}')
@@ -155,7 +157,7 @@ $DESTRIB"
log_history "$PHONE" "REC, $VIR, $DESTRIB, $DESTMEM, $PERIOD, $TIME"
# Send DESTPHONE sms
if [[ "$DESTPHONE" != "" ]]; then
- sms_SEND "$DESTPHONE" "[G1sms+] Bonjour $DESTMEM. Vous recev(r)ez un payement de $VIR G1 (pendant $TIME $PERIOD) de la part du portefeuille: $MEMBER."
+ sms_SEND "$DESTPHONE" "[G1sms+] Bonjour $DESTMEM. Vous recev(r)ez un payement de $VIR G1 (pendant $TIME $PERIOD) de la part du portefeuille: $MEMBER $UIDNA."
fi
else
diff --git a/shell/sms_VIR.sh b/shell/sms_VIR.sh
index ea97204..5847be3 100755
--- a/shell/sms_VIR.sh
+++ b/shell/sms_VIR.sh
@@ -33,7 +33,7 @@ testmin=${accounting[0]}
VIR=${accounting[1]}
PERCENT=${accounting[2]}
if [[ $testmin -eq 0 ]]; then
- sms_ERROR "$PHONE" "Solde de votre Porte-monnaie G1sms insuffisant. Minimum $charge G1! Rechargez par Cesium."
+ sms_ERROR "$PHONE" "Solde de votre Porte-monnaie G1sms insuffisant. Minimum $VIR G1! Rechargez par Cesium."
exit
fi
@@ -48,15 +48,17 @@ else
log "__SUB:sms_VIR.sh: SEARCH $VIRDEST related wallet!!! $DESTRIB "
DESTMEM="$VIRDEST"
# SEARCH IN WALLETS
- LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidna | tail -n 1 | cut -f 3 -d '/')
+ LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
+ if [[ "$LOCAL" == "" ]]; then LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
if [[ "$LOCAL" != "" ]]; then
# LOCAL G1sms account
DESTRIB=$(cat ./wallets/$LOCAL/$LOCAL.pub)
DESTPHONE=$LOCAL
log "__SUB:sms_VIR.sh: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)"
else
- # SEARCH IN WALLETS SWARM
- INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/')
+ # SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA)
+ INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
+ if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
if [[ "$INSWARM" != "" ]]; then
REMOTENODE=$(cat ./wallets_swarm/$INSWARM/MASTERPHONE.sms)
DESTRIB=$(cat ./wallets_swarm/$INSWARM/$INSWARM.pub)
@@ -71,7 +73,7 @@ else
fi
if [[ "$DESTRIB" != "" ]]; then
- PAY=$(./shell/timeout.sh -t 20 ./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$VIR" --output="$DESTRIB" --comment="[G1sms+] VIR $VIR G1" -y)
+ PAY=$(./shell/timeout.sh -t 30 ./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$VIR" --output="$DESTRIB" --comment="[G1sms+] VIR $VIR G1" -y)
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" && "$PAY" != "" ]]; then
log "__SUB:sms_VIR.sh: VIREMENT VERS $DESTMEM OK"
mess="[G1sms+] $MEMBER
@@ -83,7 +85,7 @@ $PAY"
log_history "$PHONE" "VIR, $VIR, $DESTRIB, $DESTMEM"
# Send DESTPHONE sms
if [[ "$DESTPHONE" != "" ]]; then
- sms_SEND "$DESTPHONE" "Bonjour $DESTMEM. Vous venez de recevoir un virement de $AMOUNT $UNIT ($VIR G1) de la part de $member portefeuille $UIDNA ($phone)"
+ sms_SEND "$DESTPHONE" "Bonjour $DESTMEM. Vous venez de recevoir un virement de $AMOUNT $UNIT ($VIR G1) de la part de $member portefeuille $UIDNA"
fi
cents=$(echo $(bc -l <<< "scale=0; $VIR * 100") | cut -d '.' -f 1)
move_g1cents "$PHONE" "$DESTRIB" "$cents"
diff --git a/shell/tag_LOAD_passenger.sh b/shell/tag_LOAD_passenger.sh
index ef24c67..391b6b2 100755
--- a/shell/tag_LOAD_passenger.sh
+++ b/shell/tag_LOAD_passenger.sh
@@ -125,8 +125,8 @@ IFILE=$(su $YOU -c "ipfs add \"${MUSICFILE}\" | tail -n 1")
if [[ ! $IFILE ]]; then exit; fi
echo "$IFILE" > $TAGPASSENGER
# ONLY SWARM KEY CAN DECRYPT IPFS LINK TO FILE (TODO: Glue better)
-MASTERPUB=$(cat "./g1sms.pub.key")
-./shell/natools.py encrypt -p "$MASTERPUB" -i "$TAGPASSENGER" -o "$TAGPASSENGERCRYPT"
+NODE_G1PUBKEY=$(cat "./g1sms.pub.key")
+./shell/natools.py encrypt -p "$NODE_G1PUBKEY" -i "$TAGPASSENGER" -o "$TAGPASSENGERCRYPT"
echo "LOADED" > $TAGPASSENGER
echo "$DEB" > $TAGPASSENGERDEBIT
diff --git a/shell/tag_PLAY_passenger.sh b/shell/tag_PLAY_passenger.sh
index f2af7e9..b43e715 100755
--- a/shell/tag_PLAY_passenger.sh
+++ b/shell/tag_PLAY_passenger.sh
@@ -12,9 +12,9 @@
READERID=$1
JSOURCE=$2
KEYFILE="./g1sms.priv.key"
-MASTERPUB=$(cat "./g1sms.pub.key")
+NODE_G1PUBKEY=$(cat "./g1sms.pub.key")
-if [[ ! $READERID || ! $JSOURCE || ! -f "$KEYFILE" || ! $MASTERPUB ]]; then "Something is wrong! Do you know what you are doing?"; exit; fi
+if [[ ! $READERID || ! $JSOURCE || ! -f "$KEYFILE" || ! $NODE_G1PUBKEY ]]; then "Something is wrong! Do you know what you are doing?"; exit; fi
NODEG1TAG=$(cat "./wallets_swarm/.$READERID/TAG/$READERID") # Contains IPNS link to Node G1Tag
if [[ ! $NODEG1TAG ]]; then
diff --git a/shell/tag_READ.sh b/shell/tag_READ.sh
index bbbbbbc..bfe7376 100755
--- a/shell/tag_READ.sh
+++ b/shell/tag_READ.sh
@@ -155,8 +155,8 @@ cat /dev/ttyACM0 | while read line; do
# Make Silkaj TX
G1VAL=$(bc -l <<< "scale=2; $BVALUE / 100" | cut -d '.' -f 1)
- log "__SUB:tag_READ.sh: Silkaj TX $MASTERKEYFILE ($G1VAL) -> $CASHBACK"
- PAY=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=$G1VAL --output=$CASHBACK --comment="[G1sms+] CAPTURE G1Tag $RR" -y)
+ log "__SUB:tag_READ.sh: Silkaj TX $NODE_G1PRIVKEYFILE ($G1VAL) -> $CASHBACK"
+ PAY=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1PRIVKEYFILE" --amount=$G1VAL --output=$CASHBACK --comment="[G1sms+] CAPTURE G1Tag $RR" -y)
log "__SUB:tag_READ.sh: Silkaj output = $PAY"
if [[ "$(echo $PAY | cut -d '|' -f 1)" == "KO" ]]; then
@@ -221,7 +221,7 @@ cat /dev/ttyACM0 | while read line; do
else
log "__SUB:tag_READ.sh: Transfert de G1 Tag à G1 Tag. $BVALUE $CUR"
./shell/parle.sh "Transfert de ${val[1]} $CUR vers le G1 Tag ${FID}"
- log "__SUB:tag_READ.sh: $(./shell/tag_OP.sh ${obj[1]} ${obj[0]} ${val[1]} $MASTERKEYFILE)"
+ log "__SUB:tag_READ.sh: $(./shell/tag_OP.sh ${obj[1]} ${obj[0]} ${val[1]} $NODE_G1PRIVKEYFILE)"
fi
CASHBACK=""
fi
@@ -234,7 +234,7 @@ cat /dev/ttyACM0 | while read line; do
else
log "__SUB:tag_READ.sh: Transformation du G1 Tag en Rec Tag. ${val[0]} = ${val[1]}"
./shell/parle.sh "Transformation du G1 Tag ${val[0]} $CUR en Rec Tag chargé de ${FID}..."
- log "__SUB:tag_READ.sh: $(./shell/tag_OP.sh ${obj[0]} ${obj[0]} 0 $MASTERKEYFILE)"
+ log "__SUB:tag_READ.sh: $(./shell/tag_OP.sh ${obj[0]} ${obj[0]} 0 $NODE_G1PRIVKEYFILE)"
fi
CASHBACK=""
fi
diff --git a/shell/tag_READ_X.sh b/shell/tag_READ_X.sh
index 538939c..cba512a 100755
--- a/shell/tag_READ_X.sh
+++ b/shell/tag_READ_X.sh
@@ -20,9 +20,9 @@ function log () {
$1" >> /tmp/tag_READ_X.log
}
-MASTERKEYFILE="${MY_PATH}/../g1sms.priv.key"
-if [ ! -f $MASTERKEYFILE ]; then echo "ERREUR CLEF DECHIFFRAGE!"; exit; fi
-# TODO G1TAG: USE CREATOR NODE KEY FILE INSTEAD OF MASTERKEYFILE SWARM KEY
+NODE_G1PRIVKEYFILE="${MY_PATH}/../g1sms.priv.key"
+if [ ! -f $NODE_G1PRIVKEYFILE ]; then echo "ERREUR CLEF DECHIFFRAGE!"; exit; fi
+# TODO G1TAG: USE CREATOR NODE KEY FILE INSTEAD OF NODE_G1PRIVKEYFILE SWARM KEY
# DOUCHETTE ES TU LA?
if [ ! $G1TX ]; then echo "Branchez votre lecteur de QR code!"; exit; fi
@@ -57,10 +57,10 @@ cat /dev/ttyACM0 | while read line; do
FID=$(echo $ID | awk '{print toupper($1)}')
RR=$(echo $ID | sed s/\ //g)
- ./shell/tools/4LETTER.scroll.py "G1TAG $FID >"
+ ./shell/tools/4LETTER.scroll.py "${#act[@]} $FID > "
RVALUE=$(su $YOU -c "ipfs cat /ipns/$J/TAG_amount");
CURRENCY=$(su $YOU -c "ipfs cat /ipns/$J/TAG_currency" | awk '{print tolower($1)}')
- if [[ "$CURRENCY" == "zen" ]]; then CUR="zène"; else CUR=$CURRENCY; fi # Correction du défaut de prononciation.
+
PASSENGER=$(su $YOU -c "ipfs cat /ipns/$J/TAG_passenger");
if [[ "$PASSENGER" != "" ]]; then
./shell/tools/4LETTER.scroll.py "G1TAG PASSENGER $RVALUE ZEN"
@@ -87,10 +87,10 @@ cat /dev/ttyACM0 | while read line; do
FID=$(echo $ID | awk '{print toupper($1)}')
RR=$(echo $ID | sed s/\ //g)
- ./shell/tools/4LETTER.scroll.py "G1TAG [TX] $FID >"
+ ./shell/tools/4LETTER.scroll.py "${#act[@]} $FID TX >>"
BVALUE=$(su $YOU -c "ipfs cat /ipns/$J/TAG_amount")
CURRENCY=$(su $YOU -c "ipfs cat /ipns/$J/TAG_currency" | awk '{print tolower($1)}')
- if [[ "$CURRENCY" == "zen" ]]; then CUR="zène"; else CUR=$CURRENCY; fi # Correction du défaut de prononciation.
+
PASSENGER=$(su $YOU -c "ipfs cat /ipns/$J/TAG_passenger");
# DIG PUBLISHING KEY
if [[ -f /home/$YOU/.ipfs/keystore/$RR ]]; then
@@ -122,7 +122,7 @@ cat /dev/ttyACM0 | while read line; do
*)
if [[ $lon -eq 44 ]]; then
- ./shell/tools/4LETTER.scroll.py "PORTEFEUILLE G1 >>>>>>>>" &
+ ./shell/tools/4LETTER.scroll.py "PORTEFEUILLE G1 >>>>>>>> ${#act[@]}" &
J=$qrvalue
if [[ "$J" != "${obj[0]}" ]]; then
VALUE=$(./shell/timeout.sh -t 25 ./silkaj/silkaj amount $J)
@@ -177,8 +177,8 @@ cat /dev/ttyACM0 | while read line; do
# Make Silkaj TX
G1VAL=$(bc -l <<< "scale=2; $BVALUE / 100" | cut -d '.' -f 1)
- log "__SUB:tag_READ_X.sh: Silkaj TX $MASTERKEYFILE ($G1VAL) -> $CASHBACK"
- PAY=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=$G1VAL --output=$CASHBACK --comment="[G1sms+] G1Tag $RR ZEN -> G1" -y)
+ log "__SUB:tag_READ_X.sh: Silkaj TX $NODE_G1PRIVKEYFILE ($G1VAL) -> $CASHBACK"
+ PAY=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1PRIVKEYFILE" --amount=$G1VAL --output=$CASHBACK --comment="[G1sms+] G1Tag $RR ZEN -> G1" -y)
log "__SUB:tag_READ_X.sh: Silkaj output = $PAY"
# Stop 1LETTER.spinner.py
@@ -251,8 +251,8 @@ cat /dev/ttyACM0 | while read line; do
COMBIENZEN=$(bc -l <<< "$COMBIEN * 100")
log "__SUB:tag_READ_X.sh: Transfert de G1 Tag à G1 Tag. $COMBIEN"
./shell/tools/4LETTER.scroll.py "G1TAG ${FID} -> TX $COMBIENZEN ZEN *** $COMBIEN G1"
- log "__SUB:tag_READ_X.sh: ./shell/tag_OP.sh ${obj[1]} ${obj[0]} $COMBIENZEN $MASTERKEYFILE"
- ./shell/tag_OP.sh ${obj[1]} ${obj[0]} $COMBIENZEN "$MASTERKEYFILE"
+ log "__SUB:tag_READ_X.sh: ./shell/tag_OP.sh ${obj[1]} ${obj[0]} $COMBIENZEN $NODE_G1PRIVKEYFILE"
+ ./shell/tag_OP.sh ${obj[1]} ${obj[0]} $COMBIENZEN "$NODE_G1PRIVKEYFILE"
else
./shell/tools/4LETTER.scroll.py "ERREUR $COMBIEN > VALEUR DE ${FID} *** ${val[1]} ZEN"
fi
@@ -268,7 +268,7 @@ cat /dev/ttyACM0 | while read line; do
else
log "__SUB:tag_READ_X.sh: Transformation du G1 Tag en Rec Tag. ${val[0]} = ${val[1]}"
./shell/tools/4LETTER.scroll.py "TRASNFORMATION G1TAG ${val[0]} ZEN EN PASSENGER ${FID}";
- log "__SUB:tag_READ_X.sh: $(./shell/tag_OP.sh ${obj[0]} ${obj[0]} 0 $MASTERKEYFILE)"
+ log "__SUB:tag_READ_X.sh: $(./shell/tag_OP.sh ${obj[0]} ${obj[0]} 0 $NODE_G1PRIVKEYFILE)"
fi
CASHBACK=""
fi
diff --git a/silkaj/src/constants.default.py b/silkaj/src/constants.default.py
index b49f415..3612867 100644
--- a/silkaj/src/constants.default.py
+++ b/silkaj/src/constants.default.py
@@ -2,4 +2,4 @@ SILKAJ_VERSION = "silkaj 0.5.0"
NO_MATCHING_ID = "No matching identity"
G1_SYMBOL = "Ğ1"
GTEST_SYMBOL = "ĞTest"
-G1_DEFAULT_ENDPOINT = "duniter.moul.re", "443"
+G1_DEFAULT_ENDPOINT = "duniter-g1.p2p.legal", "443"
diff --git a/sms_received.sh b/sms_received.sh
index 4bf00d5..23ed95b 100755
--- a/sms_received.sh
+++ b/sms_received.sh
@@ -27,14 +27,16 @@
# License: GPL (http://www.google.com/search?q=GPL)
################################################################################
+MY_PATH="`dirname \"$0\"`" # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
+
# Execute Kalkun daemon
[[ -f /var/www/kalkun/scripts/daemon.sh ]] && /var/www/kalkun/scripts/daemon.sh
export YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
-export CHEMIN="/home/$YOU/G1sms+"
-cd $CHEMIN
-source ./shell/init.sh
-source ./shell/functions.sh
+cd $MY_PATH
+source $MY_PATH/shell/init.sh
+source $MY_PATH/shell/functions.sh
##################################################################
# Get global variables from gammu-smsd
@@ -70,7 +72,7 @@ if [[ ! -f "./wallets/$PHONE/MASTERPHONE.sms" && "$CMD" != "ADMIN" ]]
then
NODEPHONE=$(cat "./wallets_swarm/$PHONE/MASTERPHONE.sms")
if [[ "$NODEPHONE" != "$MASTERPHONE" && "$NODEPHONE" != "" ]]; then
- sms_SEND "$PHONE" "[G1sms+] Vous avez déjà un compte portefeuille sur $NODEPHONE (Envoyez lui DESTROY avant de pouvoir "
+ sms_SEND "$PHONE" "[G1sms+] Vous avez déjà un compte portefeuille sur $NODEPHONE (Envoyez lui RAZ si vous voulez fermer votre compte)"
log "ALERT!! $PHONE compte existant sur le NODE G1sms+ ($NODEPHONE)"
exit
fi
@@ -155,10 +157,10 @@ case "$CMD" in
W5=$(echo "$TEXT" | awk '{print tolower($6)}' | grep -E "^[a-z0-9]+$")
W6=$(echo "$TEXT" | awk '{print tolower($7)}' | grep -E "^[a-z0-9]+$")
W7=$(echo "$TEXT" | awk '{print tolower($8)}' | grep -E "^[a-z0-9]+$")
- if [[ "$W1" != "" && "$W2" != "" && "$W3" != "" && "$W4" != "" ]]; then
+ if [[ "$W1" != "" && "$W2" != "" ]]; then
./shell/sms_BILLETCHK.sh "$PHONE" "$W1" "$W2" "$W3" "$W4" "$W5" "$W6" "$W7" &
else
- ./shell/sms_ERROR.sh "$PHONE" "Mauvais Format. Le code doit comporter 4 mots pour vérifier la valeur du billet, 7 mots pour l'encaisser..." &
+ ./shell/sms_ERROR.sh "$PHONE" "Mauvais Format. Le code doit comporter 2 mots minimum pour vérifier la valeur du billet, + code secret pour l'encaisser..." &
fi
;;
TAG)
diff --git a/wait_actions/sync_ipfs.sh b/wait_actions/sync_ipfs.sh
new file mode 100755
index 0000000..9eda412
--- /dev/null
+++ b/wait_actions/sync_ipfs.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+MY_PATH="`dirname \"$0\"`" # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
+
+YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
+IPFSNODEID=$(ipfs id -f='\n')
+
+#toWatch="$MY_PATH/../wallets_swarm/.$IPFSNODEID"
+toWatch="./test"
+
+inotifywait -r -q -e create,close_write,delete -m "$toWatch" |
+while read -s -r directory event filename; do
+
+ ## Action à réaliser lors du changement d'état de ce dossier
+ ## ipfs_swarm_wallets_refresh
+
+ echo "$filename $event in $directory !" # >> /tmp/g1sms.log
+
+done
+
+exit 0
diff --git a/www/rompr/REC/youtube-dl.php b/www/rompr/REC/youtube-dl.php
index 26e2eda..ad1d71d 100644
--- a/www/rompr/REC/youtube-dl.php
+++ b/www/rompr/REC/youtube-dl.php
@@ -1,11 +1,11 @@
[REC]';
+// ZEEBOX HACK ZONE
+ var reclink = '/REC/youtube-dl.php?q=REC&artist=' + escape(encodeURIComponent(npinfo.Artist)) + '&title=' + escape(encodeURIComponent(npinfo.Title)) + '&radio='+ escape(encodeURIComponent(npinfo.stream)) +'&maxResults=1';
+ var zcopylink = ' [REC]';
zcopylink += ' *';
- lines[0].text += zcopylink;
+ lines[0].text += zcopylink;
// ZEEBOX HACK ZONE
*/
// RUN CLI if($argc>1) parse_str(implode('&',array_slice($argv, 1)), $_REQUEST);
@@ -22,7 +22,7 @@ $len=strlen($artist.$title);
//$result='
';
$result='
';
if( $radio == "" ) { $radio = "CopyLaRadio"; }
-if( $radio == "Nova zz" ) {
+if( $radio == "Nova zz" ) {
$artist = "undefined";
$title = "undefined";
}
@@ -62,7 +62,7 @@ if( $search == "REC" ) {
} else {
shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Aucun module"');
}
-
+
} else {
shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Identification imprécise. Podcast? Fichier local?"');
}
@@ -116,10 +116,10 @@ $lnkform.='