merge fred

This commit is contained in:
poka 2020-01-02 01:15:56 +01:00
commit 6db82d6b3d
53 changed files with 668 additions and 283 deletions

1
.install/.GPATH Normal file
View File

@ -0,0 +1 @@
GPATH=/home/pi/G1sms+

View File

@ -8,7 +8,7 @@
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
stamp=$(date +%s) stamp=$(date +%s)
templates="$MY_PATH/templates/2" templates="$MY_PATH/templates/2a"
####################################### #######################################
# CONFIGURE IPFS for G1sms+ Pi NODES # CONFIGURE IPFS for G1sms+ Pi NODES

36
.install/2b-configure_gammu.sh Executable file
View File

@ -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

14
.install/5-install_rompr.sh Executable file
View File

@ -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

View File

@ -2,4 +2,5 @@ ADMINPSEUDO=_ADMINPSEUDO
ADMINPHONE=_ADMINPHONE ADMINPHONE=_ADMINPHONE
MASTERPHONE=_MASTERPHONE MASTERPHONE=_MASTERPHONE
ADRESSE="_ADRESSE" ADRESSE="_ADRESSE"
PIN=_PIN
KSMS_DOMAIN= KSMS_DOMAIN=

View File

@ -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

View File

@ -0,0 +1,128 @@
<?php
/*
DONE!!!? WRITE THAT CODE IN infobar2.js : arrount line 158 before "return lines;"
// 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 = ' <a id="REC" title="Enregistrer sur Youtube" href="#" onclick=\'javascript:window.open("'+ reclink +'","REC","menubar=no, scrollbars=no, top=10, left=10, width=384, height=546");return false;\'>[REC]</a>';
zcopylink += ' <a title="RECHERCHE LIBRE" href="/REC/youtube-dl.php" target="youtube">*</a>';
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='<a href="#null" onclick="javascript:window.close();"><img src="/REC/REC.png"></a><br>';
$result='<a href="https://www.copylaradio.com" target="copylaradio"><img src="/REC/REC.png"></a><br>';
if( $radio == "" ) { $radio = "CopyLaRadio"; }
if( $radio == "Nova zz" ) {
$artist = "undefined";
$title = "undefined";
}
// Write request for copy.sh triggering
if( $search == "REC" ) {
///////////////////
$result.='<h2>♫ '.$radio.' ♫</h2>';
// 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.='<p><a href="'.$lnk.'" target="check">LIEN: '.$lnk.'</a></p>';
///////////////////
// 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.='<a style="color:#FFFFFF" href="https://www.youtube.com/results?search_query='.urlencode($artist).'%20'.urlencode($title).'" target="check">
<h4>'.$artist.' / '.$title.'</h4>
</a>';
///////////////////
// 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 = '<form action="/REC/youtube-dl.php" method="GET">
<div>
<h3>ARTISTE: <input type="search" id="artist" name="artist" size="17" placeholder="Indiquez un artiste" value="'.$artist.'"></h3>
<h3>TITRE: <input type="search" id="title" name="title" size="20" placeholder="Titre de la chanson" value="'.$title.'"></h3>
</div>
<input type="hidden" id="radio" name="radio" value="'.$radio.'">
<input type="hidden" id="q" name="q" value="REC">
<br>
<input type="submit" value="♫ Copie Youtube ♫">
</form>
';
$lnkform.='<form action="/REC/youtube-dl.php" method="GET">
<a href="https://youtube.com" target="search"><img src="/REC/youtube.png"></a>
<p><h1>youtube-dl</h1>
<a style="color:#FFFFFF" href="https://ytdl-org.github.io/youtube-dl/supportedsites.html" target="_blank">- Sites compatibles -</a>
<input type="search" id="lnk" name="lnk" placeholder="Inscrivez le lien à copier" value="" size="40">
<input type="hidden" id="q" name="q" value="REC">
</p>
<div>
<input type="submit" value="Copie du Lien">
</div>
</form>';
?>
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="fred" >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
<title><?php echo $search;?> - Recherche YouTube & Copie privée</title>
<link href="/REC/bootstrap.css" rel="stylesheet">
</head>
<body style='background: url("/REC/fond.jpg") no-repeat scroll center center / cover rgb(0, 0, 0); color:#FFFFFF;'>
<section class="content-section text-center">
<div class="container-fluid">
<div class="container" id="result" >
<div class="col-lg-8 col-lg-offset-2 page-scroll">
<ul>
<?php echo $result; ?>
<hr>
</ul>
<ul>
<?php echo $ytform; ?>
<hr>
<?php echo $lnkform; ?>
<hr>
</ul>
</div>
</div>
</div>
</section>
</body>
</html>

View File

@ -4,6 +4,12 @@
# Version: 0.1 # Version: 0.1
# License: GPL (http://www.google.com/search?q=GPL) # 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 # Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
function log () { function log () {
# log ($1=text) # 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 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 $GPATH
cd $CHEMIN
################################################################## ##################################################################
# Activate logging to /tmp/g1sms.log (YES/NO) # Activate logging to /tmp/g1sms.log (YES/NO)
export DOLOG="YES" export DOLOG="YES"
@ -75,5 +80,5 @@ fi
# TODO Use latest Silkaj from "sudo fredp3 install silkaj" # TODO Use latest Silkaj from "sudo fredp3 install silkaj"
# export SILKAJ="/usr/local/bin/silkaj" # export SILKAJ="/usr/local/bin/silkaj"
source $CHEMIN/shell/init_keys.sh source $GPATH/shell/init_keys.sh

BIN
Dos_G1Billets.odt Normal file

Binary file not shown.

View File

@ -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()

View File

@ -1,5 +1,9 @@
#!/bin/bash #!/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 # Clean /tmp/ytdl.list
#echo > /tmp/ytdl.list #echo > /tmp/ytdl.list
@ -74,9 +78,9 @@ elif [[ "$radio" != "" && "$artist" == "" && "$song" == "" ]]; then
# EXTERNAL PARSER: ADD SCRAPERS IN ./libradio # EXTERNAL PARSER: ADD SCRAPERS IN ./libradio
~/parle.sh "Recherche RADIO ${radio}" ~/parle.sh "Recherche RADIO ${radio}"
echo "External search: ${radio}" >> /tmp/youtube-dl.log 2>&1 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" ~/parle.sh "Module existant"
php "/home/pi/G1sms+/_CopyLaRadio/libradio/${radio}.php" php "$GPATH/_CopyLaRadio/libradio/${radio}.php"
else else
~/parle.sh "Aucun module de décodage pour cette radio." ~/parle.sh "Aucun module de décodage pour cette radio."
fi fi

2
_chain
View File

@ -1 +1 @@
QmbRvGMpwZws4ii5xe5x8EgK1SSxNBaNNjinwdWjhye3TR QmbVfLJ9UsnyV3Si9UgZVS4srCnL1c2Gqt7XissCV4iC83

View File

@ -175,3 +175,6 @@ OK
2019-12-17: Better G1Tx 2019-12-17: Better G1Tx
2019-12-17: G1TAG REFRESH & more 2019-12-17: G1TAG REFRESH & more
2019-12-18: RAZ 2019-12-18: RAZ
2019-12-20: NOW
2019-12-21: Various
2019-12-24:

View File

@ -1 +1 @@
1576627244479575204 1577203467543924569

View File

@ -1,9 +1,16 @@
#!/bin/bash #!/bin/bash
MY_PATH="`dirname \"$0\"`"
MY_PATH="`( cd \"$MY_PATH\" && pwd )`"
if [ ! -e /sys/class/gpio/gpio4 ]; then if [ ! -e /sys/class/gpio/gpio4 ]; then
echo "File exists." echo "File doesn't exists."
echo "4" > /sys/class/gpio/export echo "4" > /sys/class/gpio/export
fi fi
echo "out" > /sys/class/gpio/gpio4/direction echo "out" > /sys/class/gpio/gpio4/direction
echo "0" > /sys/class/gpio/gpio4/value
sleep 2
echo "1" > /sys/class/gpio/gpio4/value echo "1" > /sys/class/gpio/gpio4/value
sleep 3 && $MY_PATH/gammu-restart.sh
exit 0

5
debug/smsc.txt Normal file
View File

@ -0,0 +1,5 @@
+33695000695
+33695000647
+33695000646
+33695000643
+33695000636

View File

@ -6,6 +6,10 @@
################################################################################ ################################################################################
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized 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" init_loc="$MY_PATH/shell/init.sh"
now=$(date +%Y-%m-%d) now=$(date +%Y-%m-%d)
unset err unset err
@ -47,7 +51,7 @@ $MY_PATH/.install/export_colors.sh
if [[ $force_req == "o" || -z $(which ipfs) || -z $(which gammu) ]];then 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_" 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/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 else
echo -e "${c_green}IPFS et gammu sont déjà installé !$c_" echo -e "${c_green}IPFS et gammu sont déjà installé !$c_"
fi 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 [[ ! $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 [[ $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 [[ -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/_ADRESSE/$ADRESSE/g $MY_PATH/.profile
sed -i s/_ADMINPHONE/$ADMINPHONE/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/_ADMINPSEUDO/$ADMINPSEUDO/g $MY_PATH/.profile
sed -i s/_PIN/$PIN/g $MY_PATH/.profile
fi fi
else else
@ -91,6 +99,9 @@ else
exit 1 exit 1
fi fi
## Configuration de gammu
$MY_PATH/.install/2b-configure_gammu.sh || err=1
## Installations optionnels ## Installations optionnels
repOld=$repOption repOld=$repOption

4
search
View File

@ -2,7 +2,7 @@
clear clear
echo "------------------------------------------------------------------------------" echo "------------------------------------------------------------------------------"
if [ "$1" == "" ]; then if [ "$1" == "" ]; then
echo " Nothing to search for!" echo " Nothing to search for!"
else else
echo " Searching for "$1" recursively. Please Wait..." echo " Searching for "$1" recursively. Please Wait..."
echo "------------------------------------------------------------------------------" echo "------------------------------------------------------------------------------"
@ -10,7 +10,7 @@ else
fi fi
echo "------------------------------------------------------------------------------" echo "------------------------------------------------------------------------------"
if [ "$2" != "" ]; then 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'" echo " grep -rl '$1' ./ | xargs sed -i 's/$1/$2/g'"
fi fi

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

BIN
shell/G1Billet_LOVE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 253 KiB

After

Width:  |  Height:  |  Size: 253 KiB

View File

@ -144,7 +144,7 @@ done
silkaj=$(echo $DUNITER | cut -d ":" -f 1) silkaj=$(echo $DUNITER | cut -d ":" -f 1)
if [[ "$silkaj" != "" && "$silkaj" != "https" ]]; then if [[ "$silkaj" != "" && "$silkaj" != "https" ]]; then
#echo "PUT $silkaj SILKAJ PARAM" #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 else
echo "RESTORE DEFAULT SILKAJ PARAM" echo "RESTORE DEFAULT SILKAJ PARAM"
cp -f ./silkaj/src/constants.default.py ./silkaj/src/constants.py cp -f ./silkaj/src/constants.default.py ./silkaj/src/constants.py

View File

@ -3,7 +3,7 @@
# Author: Fred (support@qo-op.com) # Author: Fred (support@qo-op.com)
# Version: 0.1 # Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) # 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/init.sh
source ./shell/functions.sh source ./shell/functions.sh

View File

@ -3,7 +3,7 @@
# Author: Fred (support@qo-op.com) # Author: Fred (support@qo-op.com)
# Version: 0.1 # Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) # 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 ## GET LATEST DEV $ROOT
source ./shell/init.sh source ./shell/init.sh

View File

@ -63,7 +63,7 @@ for tag in ./wallets/.$IPFSNODEID/TAG/*; do
echo "__SUB:cron_G1TAG_REFRESH.sh: GET PUBLISHKEY for that G1TAG"; 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" 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 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 rm /home/$YOU/.ipfs/keystore/${RR}.crypt
fi fi
echo "__SUB:cron_G1TAG_REFRESH.sh: G1Tag PUBLISHKEY OK : /home/$YOU/.ipfs/keystore/${RR}" echo "__SUB:cron_G1TAG_REFRESH.sh: G1Tag PUBLISHKEY OK : /home/$YOU/.ipfs/keystore/${RR}"

20
shell/cron_IPFS_open_SSH.sh Executable file
View File

@ -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='<id>\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

View File

@ -7,74 +7,113 @@
# CE FICHIER cron_MINUTE.sh EST EXECUTE TOUTES LES MINUTES # CE FICHIER cron_MINUTE.sh EST EXECUTE TOUTES LES MINUTES
# IL CONSTITUE LE BATEMENT DE COEUR DU SYSTEME # 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) 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='<id>\n'") IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
CHEMIN="/home/$YOU/G1sms+" cd $GPATH
cd $CHEMIN
source ./shell/init.sh source ./shell/init.sh
source ./shell/functions.sh source ./shell/functions.sh
timebar=$(date +%H%M) 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
################################################################## ##################################################################
# 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 # PRINT G1Tag PRINTED FROM ANOTHER NODE
# CREATE and REMOVE rr.bin -> done.rr # CREATE and REMOVE rr.bin -> done.rr
if [[ -d "./wallets_swarm/.$IPFSNODEID/PRINT/" ]]; then ## if [[ -d "./wallets_swarm/.$IPFSNODEID/PRINT/" ]]; then
log "__SUB:cron_MINUTE.sh: SEARCH NEW PRINT FOR ME .$IPFSNODEID" ## log "__SUB:cron_MINUTE.sh: SEARCH NEW PRINT FOR ME .$IPFSNODEID"
mkdir -p ./wallets/.$IPFSNODEID/PRINT/ ## 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 [[ "$1" == "PRINT" ]]; then
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" # Refresh All peers SWARM Wallets.
log "__SUB:cron_MINUTE.sh: natools.py decrypt - $(date)" ##################################################################
brother_ql_create --model QL-700 "/tmp/G1Tag.png" --label-size 62 > "/tmp/G1Tag.bin" ipfs_swarm_wallets_refresh "SIMPLE"
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)" # PRINT G1Tag PRINTED FROM ANOTHER NODE (TODO: Correct BAD Cypher KEY + BUG why last image png layers are not printed???)
# INFORM PRINT DONE # CREATE and REMOVE rr.bin -> done.rr
echo "OK" > ./wallets/.$IPFSNODEID/PRINT/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) I=$(ipfs_node_wallets_add)
else done
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" rm "/tmp/G1Tag.bin"
for scan in ./wallets_swarm/.Qm*/PRINT/done.*; do rm "/tmp/G1Tag.png"
lscan=$(echo $scan | sed s/_swarm//g ) fi
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"
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..." 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 fi
################################################################## ##################################################################
##################################################################
if [[ "$1" == "TAG" ]]; then
##################################################################
for tag in ./TAG/*; do
echo $tag
done
>>>>>>> 5428251f0b59cad31e7955824a87c97cc9a67e76
fi
##################################################################

View File

@ -21,7 +21,7 @@ function sms_SEND () {
if [[ ${#dest} -eq 10 || ${#dest} -eq 12 ]]; then if [[ ${#dest} -eq 10 || ${#dest} -eq 12 ]]; then
if [[ -d ./wallets/$dest ]]; then if [[ -d ./wallets/$dest ]]; then
# TEST IF $dest IS ON CURRENT NODE # 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 else
# Send SMS through $dest NODE (TODO: send it like PRINT, TASK, ...) # Send SMS through $dest NODE (TODO: send it like PRINT, TASK, ...)
DESTNODEID=$(cat ./wallets_swarm/$dest/MASTERPHONE.ipfsid) DESTNODEID=$(cat ./wallets_swarm/$dest/MASTERPHONE.ipfsid)
@ -365,11 +365,11 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
####################### #######################
# ACTIVATE G1SMS WALLET # ACTIVATE G1SMS WALLET
####################### #######################
# log "$MASTERKEYFILE $PUBKEY THIRD_PARTY_MANAGER:$MASTERPUB" # log "$NODE_G1PRIVKEYFILE $PUBKEY THIRD_PARTY_MANAGER:$NODE_G1PUBKEY"
TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=3.24 --output=$PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$MASTERPUB " -y) 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" log "__SUB:sms_INIT_ACCOUNT: G1 Wallet TX IN: $TX_IN"
sleep 2 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" 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 (){ function check_account (){
log "__SUB:check_account: SILKAJ...... max 15 sec....." log "__SUB:check_account: SILKAJ...... max 21 sec....."
AMOUNTG1=$(./shell/timeout.sh -t 15 ./silkaj/silkaj amount "$PUBKEY") AMOUNTG1=$(./shell/timeout.sh -t 21 ./silkaj/silkaj amount "$PUBKEY")
AMOUNTDU=$(bc <<< "scale=2; $AMOUNTG1 / $DUFACTOR") AMOUNTDU=$(bc <<< "scale=2; $AMOUNTG1 / $DUFACTOR")
AMOUNTLOVE=$(bc <<< "$AMOUNTG1 * 100 / $DUFACTOR") AMOUNTLOVE=$(bc <<< "$AMOUNTG1 * 100 / $DUFACTOR")

View File

@ -1,6 +1,6 @@
duniter-g1.p2p.legal:443 duniter.dethegeek.eu.org:443
g1.duniter.fr:443 g1.duniter.fr:443
g1.duniter.inso.ovh:443
g1.duniter.org:443 g1.duniter.org:443
g1.le-sou.org:443 g1.le-sou.org:443
g1.monnaielibreoccitanie.org:443 g1.monnaielibreoccitanie.org:443
g1.presles.fr:443

View File

@ -1,9 +1,14 @@
#!/bin/bash #!/bin/bash
################################################################## ##################################################################
# Author: poka (support@qo-op.com) # Author: Fred (support@qo-op.com)
# Version: 0.1 # Version: 0.1
# License: GPL (http://www.google.com/search?q=GPL) # 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 # Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
function log () { function log () {
# log ($1=text) # log ($1=text)
@ -30,9 +35,8 @@ export G1SMS="YES"
fi fi
export YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1) 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 $GPATH
cd $CHEMIN
################################################################## ##################################################################
# Activate logging to /tmp/g1sms.log (YES/NO) # Activate logging to /tmp/g1sms.log (YES/NO)
export DOLOG="YES" export DOLOG="YES"
@ -61,13 +65,13 @@ fi
export NODECOMM=10 export NODECOMM=10
################################################################## ##################################################################
# SMS SIM Card Phone Number # SMS SIM Card Phone Number
export MASTERPHONE="+3368818767" export MASTERPHONE="+33651136520"
export ADRESSE="Blois" export ADRESSE="G1_Fablab_Toulouse"
export G1DAB="NO" export G1DAB="NO"
################################################################## ##################################################################
# ADMIN COMMAND PHONE ORIGIN # ADMIN COMMAND PHONE ORIGIN
export ADMINPHONE="+33650573417" export ADMINPHONE="+33647683646"
export ADMINPSEUDO="poka" export ADMINPSEUDO="Fred"
################################################################## ##################################################################
# DUNITER/CESIUM+ DEFAULT SERVERS # DUNITER/CESIUM+ DEFAULT SERVERS
export DUNITER="https://g1.duniter.org" export DUNITER="https://g1.duniter.org"
@ -75,5 +79,5 @@ fi
# TODO Use latest Silkaj from "sudo fredp3 install silkaj" # TODO Use latest Silkaj from "sudo fredp3 install silkaj"
# export SILKAJ="/usr/local/bin/silkaj" # export SILKAJ="/usr/local/bin/silkaj"
source $CHEMIN/shell/init_keys.sh source $GPATH/shell/init_keys.sh

View File

@ -6,9 +6,14 @@
################################################################## ##################################################################
# CHECK & WARN | CREATE Keys (gpg encrypt, G1wallet, IPNS publish) # 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) 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+ # 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) # 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+ Swarm KEYS
################################################################## ##################################################################
# G1sms Service - G1Wallet # G1sms Service - G1Wallet
if [[ -f "${CHEMIN}/g1sms.pub.key" && -f "${CHEMIN}/g1sms.priv.key" ]]; then if [[ -f "${GPATH}/g1sms.pub.key" && -f "${GPATH}/g1sms.priv.key" ]]; then
chown root:root ${CHEMIN}/g1sms.priv.key chown root:root ${GPATH}/g1sms.priv.key
chmod 600 ${CHEMIN}/g1sms.priv.key chmod 600 ${GPATH}/g1sms.priv.key
export MASTERPUB=$(cat "${CHEMIN}/g1sms.pub.key") export NODE_G1PUBKEY=$(cat "${GPATH}/g1sms.pub.key")
export MASTERKEYFILE="${CHEMIN}/g1sms.priv.key" export NODE_G1PRIVKEYFILE="${GPATH}/g1sms.priv.key"
else else
echo "ATTENTION!! Vous devez posséder la clef du G1 Wallet utilisé par le SWARM G1sms!!" 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." ./shell/parle.sh "Les clefs du portefeuille essaim G1 SMS sont absente. Au revoir."
echo "Fichiers manquants:" echo "Fichiers manquants:"
echo "${CHEMIN}/g1sms.pub.key" echo "${GPATH}/g1sms.pub.key"
echo "${CHEMIN}/g1sms.priv.key" echo "${GPATH}/g1sms.priv.key"
echo "Contactez nous sur https://g1sms.fr" 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 "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 exit
fi 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" ./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 # 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 # for nodepubfile in ./wallets_swarm/.Qm*/*.pub; do
# nodeG1pub=$(cat $nodepubfile) # nodeG1pub=$(cat $nodepubfile)
# nodeID=$(echo $all | cut -d '/' -f 3) # 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 " log "__SUB:initkeys.sh: [ADMIN] G1sms+ CREATE G1WALLET FOR: $IPFSNODEID: pub = $NODEG1WALLET "
# BACKUP $IPFSNODEID config # 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 " 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" echo $NODEG1WALLET > "./wallets/.$IPFSNODEID/$IPFSNODEID.pub"
# SILKAJ INIT G1 NODE WALLET # 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_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=$MASTERPUB --comment="[G1sms+] G1NODE $IPFSNODEID:ACK" -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" 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 "[ADMIN] G1sms+ $ADMINPSEUDO-$UIDNA$TAIL OUVERT POUR NODE: ls ./wallets/.$IPFSNODEID" 1>&2
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "$NODEG1WALLET" 1>&2 gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "$NODEG1WALLET" 1>&2

View File

@ -4,13 +4,14 @@
# Version: 0.1 # Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) # 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/init.sh
source ./shell/functions.sh source ./shell/functions.sh
# Existence days number can be $1 # Existence days number can be $1
if [[ "$1" ]]; then vieux="$1"; else vieux=180; fi if [[ "$1" ]]; then vieux="$1"; else vieux=210; fi
if [[ "$2" ]]; then dest="$2"; else dest=$MASTERPUB; fi if [[ "$2" ]]; then dest="$2"; else dest=$NODE_G1PUBKEY; fi
echo "Recherche de G1Billets plus vieux que $vieux jours." echo "Recherche de G1Billets plus vieux que $vieux jours."
Nbillets=$(find billets/ -daystart -mtime +$vieux -type f -name "*.pubkey" | wc -l) 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 for result in $(find billets/ -daystart -mtime +$vieux -type d -name "*"); do
billetname=$(echo $result | cut -d '/' -f 2) billetname=$(echo $result | cut -d '/' -f 2)
((Nbillets --))
if [[ $billetname && "$billetname" != "MEMBERS" ]]; then if [[ $billetname && "$billetname" != "MEMBERS" ]]; then
code=$(echo $billetname | sed s/_/\ /g ) ((Nbillets --))
creator=$(cat $result/*.creator) numero=$(echo $billetname | sed s/_/\ /g )
creator=$(cat "$result/note.creator")
value=$(cat "$result/note.value") value=$(cat "$result/note.value")
unit=$(cat "$result/note.unit") unit=$(cat "$result/note.unit")
pubkey=$(cat "$result/note.pubkey") pubkey=$(cat "$result/note.pubkey")
salt=$(cat "$result/note.salt") salt=$(cat "$result/note.salt")
secret=$(cat "$result/note.secret") 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 ">>> Virer à $dest $virement G1 du G1billet !! ID / Pass:"
echo $code echo $numero
echo $secret $salt echo $secret $salt
echo "/usr/local/bin/silkaj tx --amount=\"$virement\" --output=\"$dest\"" 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 [[ "$solde" == "0.0" ]]; then
echo "G1Billet déjà vide, suppression de $result"; rm -Rf $result;
if [[ ! $(echo $PAY | grep "successfully sent") ]]; then
echo "!!!! ERREUR: $virement Something Wrong happened with $result"
if [[ ! $virement ]]; then mv $result /tmp/$result; fi
else else
echo "Tout s'est bien passé! On supprime $result et continue avec le billet $Nbillets" PAY=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 tx --amount="$virement" --output="$dest" --comment="[G1Billet] $numero" -y)
rm -Rf $result 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 fi
else else
echo "MEMBER:" $result echo "MEMBER:" $result

View File

@ -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.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

View File

@ -11,23 +11,20 @@ log "X sms_AIDE.sh ($1=phone)"
sms_INIT_ACCOUNT "$1" "NOSMS" sms_INIT_ACCOUNT "$1" "NOSMS"
MESS="[Aide] MESS="[Aide]
N Id-M (Relier au portefeuille Id-M) N Pseudo (membre ou nom de portefeuille) : Création portefeuille
U G1/DU/LOVE (UNIT) U G1/DU/LOVE : Unité
S (Solde) S : Solde
P 06nnnnnnnn 300 (Envoyer 300 UNIT à 06nnnnnnnn)" P 06nnnnnnnn 300 : Payer 300 à 06nnnnnnnn"
# Send response SMS # Send response SMS
sms_SEND "$1" "$MESS" sms_SEND "$1" "$MESS"
MESS="EMAIL moi@email.tld (Recevoir vos commandes par email) MESS="EMAIL moi@email : Indiquer son email
TAG 10 5 (Créer 5 G1Tag de 10 G1) VIR 50 Pseudo : Virer 50 à Pseudo (membre ou Portefeuille SMS)"
VIR 50 Idw (Virer 50 UNIT vers Idw)"
sms_SEND "$1" "$MESS" sms_SEND "$1" "$MESS"
MESS="REC (Pour un payement récurrent) MESS="REC 50 Dest S 4 : Virer 50 à Dest pendant 4 Semaines (J/S/M/A)
D (Détail de votre compte) BILL n : Recevoir 6 G1Billets remplis de n LOVE par email!
A votre service. https://g1sms.fr - $ADMINPSEUDO ($ADMINPHONE)"
$ADMINPSEUDO / G1sms+ / $ADMINPHONE
https://g1sms.fr"
sms_SEND "$1" "$MESS" sms_SEND "$1" "$MESS"
log "END sms_AIDE.sh" log "END sms_AIDE.sh"

View File

@ -7,7 +7,7 @@
# Create and print 6 G1Billets de nn LOVE # Create and print 6 G1Billets de nn LOVE
source ./shell/init.sh source ./shell/init.sh
source ./shell/functions.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" phone="$1"
VALbillet="$2" VALbillet="$2"
@ -20,7 +20,7 @@ sms_INIT_ACCOUNT "$phone" "NOSMS"
# FIXED LOVE UNIT (6 month maximum validity) # FIXED LOVE UNIT (6 month maximum validity)
UNIT="LOVE" UNIT="LOVE"
log "MEMBER? $PHONE => $MEMBER" log "__SUB:sms_BILLET.sh: MEMBER? $PHONE => $MEMBER"
if [[ $UNKNOWN == "unknown" || "$MEMBER" == "" ]]; then if [[ $UNKNOWN == "unknown" || "$MEMBER" == "" ]]; then
sms_ERROR "$phone" "Porte-monnaie non identifié. 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 # Need at least $MIN G1 available! $BILLCOM G1 commission
MIN=$(bc -l <<< "$AMOUNTG1 - $LIMIT - 21") MIN=$(bc -l <<< "$AMOUNTG1 - $LIMIT - 21")
testmin=$( echo "${VIR} < ${MIN}" | bc -l ) testmin=$( echo "${VIR} < ${MIN}" | bc -l )
log "TEST : $VIR < $MIN ? $testmin" log "__SUB:sms_BILLET.sh: TEST : $VIR < $MIN ? $testmin"
# silkaj NODE CHANGE !!! # silkaj NODE CHANGE !!!
SILKAJNODE=$(./shell/checknodes.sh) #SILKAJNODE=$(./shell/checknodes.sh)
log "NEW SILKAJ NODE: $SILKAJNODE" #log "NEW SILKAJ NODE: $SILKAJNODE"
if [[ "$testmin" -eq "1" ]] if [[ "$testmin" -eq "1" ]]
then then
# Clean MEMBER directory
rm -f ./billets/MEMBERS/$MEMBER/*.jpg
boucle=0; boucle=0;
while [ $boucle -lt $NBbillets ] while [ $boucle -lt $NBbillets ]
do do
# Creation du numéro de billet # Creation du numéro de billet
NUMBER=$(./shell/diceware.sh 4 | xargs) NUMBER=$(./shell/diceware.sh 2 | xargs)
bpath=$(echo $NUMBER | sed 's/ /_/g') bpath=$(echo $NUMBER | sed 's/ /_/g')
# Cas d'un billet existant # Cas d'un billet existant
while [ -d "./billets/$bpath" ] while [ -d "./billets/$bpath" ]
do do
NUMBER=$(./shell/diceware.sh 4 | xargs) NUMBER=$(./shell/diceware.sh 2 | xargs)
bpath=$(echo $NUMBER | sed 's/ /_/g') bpath=$(echo $NUMBER | sed 's/ /_/g')
done done
SECRET=$(./shell/diceware.sh 3 | xargs) SECRET=$(./shell/diceware.sh 4 | xargs)
SALT=$(./shell/diceware.sh 3 | xargs)
# ADD/REMOVE G1sms forced control over G1Billet
# SALT=$(./shell/diceware.sh 3 | xargs)
SALT=""
boucle=$(bc -l <<< "$boucle + 1") 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 # CREATE "NUMBER SECRET SALT" ACCOUNT for G1 transfert
TRANSAC=$(bc -l <<< "scale=2; $VIR / $NBbillets") TRANSAC=$(bc -l <<< "scale=2; $VIR / $NBbillets")
BILLETPUBKEY=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$NUMBER" -password="$SECRET $SALT") BILLETPUBKEY=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$NUMBER" -password="$SECRET$SALT")
log_history $PHONE "BILLET, $TRANSAC, $BILLETPUBKEY" # 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 sleep 3
# Fill BILLET with TRANSAC amount # 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 if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
mkdir -p "./billets/$bpath"
# NOTES ARE FILES STORED IN DICEWARE COMPOSED SUBDIR # NOTES ARE FILES STORED IN DICEWARE COMPOSED SUBDIR
echo "$(date +%Y%m%d)" > "./billets/$bpath/note.creationdate"
echo "$MEMBER" > "./billets/$bpath/note.creator" echo "$MEMBER" > "./billets/$bpath/note.creator"
echo "$MEMRIB" > "./billets/$bpath/note.memrib"
echo "$NUMBER" > "./billets/$bpath/note.number" echo "$NUMBER" > "./billets/$bpath/note.number"
echo "$PHONE" > "./billets/$bpath/note.phone" echo "$PHONE" > "./billets/$bpath/note.phone"
echo "$SECRET" > "./billets/$bpath/note.secret" echo "$SECRET" > "./billets/$bpath/note.secret"
echo "$SALT" > "./billets/$bpath/note.salt" echo "$SALT" > "./billets/$bpath/note.salt"
echo "$VALbillet" > "./billets/$bpath/note.value" echo "$VALbillet" > "./billets/$bpath/note.love"
echo "$UNIT" > "./billets/$bpath/note.unit" echo "$TRANSAC" > "./billets/$bpath/note.g1"
echo "$BILLETPUBKEY" > "./billets/$bpath/note.pubkey" echo "$BILLETPUBKEY" > "./billets/$bpath/note.pubkey"
log "Remplissage: $TRANSAC G1... $BILLETPUBKEY = $PAY" log "Remplissage: $TRANSAC G1... $BILLETPUBKEY = $PAY"
# CREATION FICHIER IMAGE BILLET # CREATION FICHIER IMAGE BILLET
$(./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\" \"$DUFACTOR\" \"$BILLETPUBKEY\" \"$MEMBER\" \"$TRANSAC\"" 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 ! # Transaction to create Link BILLET <-> MEMBER RIB => Decrease BILLET value !
sleep 2 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 else
sms_ERROR "$PHONE" "Un problème est survenu. Contactez $ADMINPSEUDO au $ADMINPHONE" 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 fi
done done
# + G1SMS Commission # + G1SMS Commission
sleep 2 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) num=$(date +%Y%m%d)
log "PRINT $num $MEMBER" log "__SUB:sms_BILLET.sh: PRINT $num $MEMBER"
montage ./billets/MEMBERS/$MEMBER/*.jpg -tile 2x3 -geometry 964x459 /tmp/$PHONE_Bills_$bpath.pdf 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"
# lp /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 -
cp /tmp/$PHONE_Bills_$bpath.pdf ./billets/MEMBERS/$MEMBER/ # rm -f /tmp/$PHONE_Bills_$bpath.pdf
zip ./_Bill_$MEMBER_$num.zip ./billets/MEMBERS/$MEMBER/*.jpg && rm -f ./billets/MEMBERS/$MEMBER/*.jpg
# SEND EMAIL # SEND EMAIL ZIP attached
# Détruit ce mail et le pdf après impression et fabrication des billets au code caché. echo "Commande #$NANODATE/$bpath
# Créer la monnaie implique une grande responsabilité! >> 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] mess="[G1SMS]
$NBbillets billet(s) de $VALbillet $UNIT ($TRANSAC G1) créé(s). $NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1) créé(s).
Contactez $ADMINPSEUDO au $ADMINPHONE pour les recevoir... Envoyés vers $MAIL, vérifiez vos SPAM...
http://g1sms.fr/g1sms/aide" Support: $ADMINPSEUDO ($ADMINPHONE)
"
sms_SEND "$phone" "$mess" 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 # 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" https://g1.duniter.fr/api/#/v1/payment/$PUBKEY?amount=$VIR"
fi fi
log "END sms_BILLET.sh" log "__SUB:sms_BILLET.sh: END sms_BILLET.sh"
log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~" log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
exit exit

View File

@ -7,8 +7,8 @@ source ./shell/functions.sh
log "X sms_BILLETCHK.sh $0" log "X sms_BILLETCHK.sh $0"
PHONE="$1" PHONE="$1"
CODE="$2 $3 $4 $5" CODE="$2 $3"
SEC="$6 $7 $8" SEC="$4 $5 $6 $7"
# Construct billet path # Construct billet path
bpath=$(echo "$CODE" | sed 's/ /_/g') bpath=$(echo "$CODE" | sed 's/ /_/g')
@ -41,24 +41,22 @@ https://www.g1sms.fr/contact"
# Account creation # Account creation
sms_INIT_ACCOUNT "$PHONE" sms_INIT_ACCOUNT "$PHONE"
fi 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" 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:$MASTERPUB: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 if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
# DESTROY BILLET # DESTROY BILLET
rm -f ./billets/$bpath/note.* rm -Rf ./billets/$bpath
rmdir ./billets/$bpath
# DESTROY PUBLIC CACHE in /tmp # DESTROY PUBLIC CACHE in /tmp
if [ -d "/tmp/billets_valides/$bpath" ]; then if [ -d "/tmp/billets_valides/$bpath" ]; then
rm -f /tmp/billets_valides/$bpath/* rm -Rf /tmp/billets_valides/$bpath
rmdir /tmp/billets_valides/$bpath
fi fi
SOLDE=$(./silkaj/silkaj amount "$PUBKEY") SOLDE=$(./silkaj/silkaj amount "$PUBKEY")
mess="[G1SMS] mess="[G1SMS]
ENCAISSEMENT de $VALbillet $UNIT ($AMOUNTG1 G1) ENCAISSEMENT de $VALbillet $UNIT ($AMOUNTG1 G1)
ds le porte-monnaie $PHONE ($PUBKEY) dans portefeuille $UIDNA ($PHONE)
OK! OK!
Solde: $SOLDE G1" Solde: $SOLDE G1"
sms_SEND "$PHONE" "$mess" sms_SEND "$PHONE" "$mess"
@ -66,7 +64,7 @@ Solde: $SOLDE G1"
log "=> $PUBKEY" log "=> $PUBKEY"
log_history $PHONE "BILLET_CHK, $AMOUNTG1, $bpath, $PUBKEY" log_history $PHONE "BILLET_CHK, $AMOUNTG1, $bpath, $PUBKEY"
else 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
fi fi
else else

View File

@ -17,11 +17,12 @@ NUMERO="$1"
SECRET="$2" SECRET="$2"
MONTANT="$3" MONTANT="$3"
UNIT="$4" UNIT="$4"
DUFACTOR="$5" JUNE="$5"
NOTERIB="$6" NOTERIB="$6"
MEMBER="$7" MEMBER="$7"
TRANSAC="$8" 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" == "" ]] if [[ "$NOTERIB" == "" || "$MEMBER" == "" ]]
then then
@ -43,17 +44,24 @@ fi
valid="0${valid:0:2}" valid="0${valid:0:2}"
# ADD VALIDITY to convert: -pointsize 20 -draw 'text 380,410 "'"A encaisser avant le 01/$valid/$year"'"' \ # ADD VALIDITY to convert: -pointsize 20 -draw 'text 380,410 "'"A encaisser avant le 01/$valid/$year"'"' \
# Add G1sms logo (250px) # ADD Avatar on G1 Logo SouthEast
composite -compose Over -gravity SouthWest -geometry +50+50 "./shell/G1sms.png" "./shell/Oeuro.jpg" "/tmp/$NUMERO.jpg" 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 # Prepare BILLET qrcode verification URL
#qrencode "$NOTERIB" -o "/tmp/$NUMERO_NOTERIB.png" qrencode -s 3 -o "/tmp/$NUMERO_NOTERIB.png" "$NOTERIB"
REQ=$(echo $NUMERO | sed 's/ /_/g')
qrencode "https://www.g1sms.fr/$ADMINPSEUDO/check.php?code=$REQ" -o "/tmp/$NUMERO_NOTERIB.png"
# BILL PUBKEY => Someone can Add amount to it !!! # BILL PUBKEY means Someone can Add amount to it !!!
# Add verification QRCode # 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 # Add June logo
case "$MONTANT" in case "$MONTANT" in
@ -82,7 +90,7 @@ case "$MONTANT" in
cp "./shell/g1.png" "/tmp/g1.png" cp "./shell/g1.png" "/tmp/g1.png"
;; ;;
esac 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") DUPART=$(bc -l <<< "scale=2; $MONTANT / 100")
# ADD 0 to <1 DUPART # ADD 0 to <1 DUPART
@ -90,16 +98,17 @@ testdu=$( echo "${DUPART} < 1" | bc -l )
if [[ "$testdu" -eq "1" ]]; then if [[ "$testdu" -eq "1" ]]; then
DUPART="0${DUPART}" DUPART="0${DUPART}"
fi fi
#SECRET=$(echo $SECRET | sed 's/ /\n/g')
SIMPLEPHONE=$(echo $MASTERPHONE | sed 's/\+33/0/g')
convert -font 'Liberation-Sans' \ convert -font 'Liberation-Sans' \
-pointsize 120 -fill black -draw 'text 200,220 "'"$DUPART DU"'"' \ -pointsize 120 -fill black -draw 'text 200,220 "'"$DUPART DU"'"' \
-pointsize 45 -draw 'text 550,270 "'"$MONTANT $UNIT"'"' \ -pointsize 45 -draw 'text 550,270 "'"$MONTANT $UNIT"'"' \
-pointsize 35 -draw 'text 50,60 "'"[G1sms] 06 66 80 57 20"'"' \ -pointsize 35 -draw 'text 50,60 "'"https://g1sms.fr _ G1Billet _ $JUNE G1"'"' \
-pointsize 30 -draw 'text 60,100 "'"CHK $NUMERO"'"' \ -pointsize 30 -draw 'text 60,100 "'"Identifiant: $NUMERO"'"' \
-pointsize 22 -fill black -draw 'text 520,340 "'"$SECRET"'"' \ -pointsize 22 -fill black -draw 'text 380,340 "'"Code Secret: $SECRET"'"' \
-pointsize 22 -fill black -draw 'text 400,410 "'"Encaisser avant le 01/$valid/$year"'"' \ -pointsize 22 -fill black -draw 'text 260,408 "'"Porte Monnaie Libre!! A utiliser 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 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" "/tmp/$NUMERO.jpg" "/tmp/BILL.$year.$valid.$NUMERO.$MONTANT.$UNIT.jpg"
# Payable par SMS en envoyant les codes grattant la case comportant le SECRET # Payable par SMS en envoyant les codes grattant la case comportant le SECRET

View File

@ -47,10 +47,11 @@ log "Solde = $AMOUNTG1 ($UNIT)"
if [ "$2" != "NOSMS" ]; then if [ "$2" != "NOSMS" ]; then
if [[ "$AMOUNT" != "" ]]; then if [[ "$AMOUNT" != "" ]]; then
mess="[G1sms+] mess="[G1sms+]
ID: $UIDNA <=> $MEMBER ID: $UIDNA
$AMOUNT $UNIT ($AMOUNTG1 G1) $AMOUNT $UNIT ($AMOUNTG1 G1)
=> $MEMBER
Recharger avec https://cesium.app" $MEMRIB
https://cesium.app"
# Send response SMS # Send response SMS
sms_SEND "$PHONE" "$mess" sms_SEND "$PHONE" "$mess"
sms_SEND "$PHONE" "$PUBKEY" sms_SEND "$PHONE" "$PUBKEY"

View File

@ -31,8 +31,8 @@ fi
sms_INIT_ACCOUNT "$PHONE" sms_INIT_ACCOUNT "$PHONE"
if [[ "$MEMBERUID" == "DON" || "$MEMBERUID" == "" || "$MEMBERUID" == "$MEMBER" ]]; then if [[ "$MEMBERUID" == "DON" || "$MEMBERUID" == "" || "$MEMBERUID" == "$MEMBER" ]]; then
# OK THAT GUYS KNOWS something (TODO Secure better with double authentification, with email or second phone number...) # 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 no Dest PubKey (no member) or DON, then NODE_G1PUBKEY is collecting LOVE money.
if [[ $MEMRIB == "" || "$MEMBERUID" == "DON" ]]; then MEMBER=$ADMINPSEUDO; MEMRIB=$MASTERPUB; fi if [[ $MEMRIB == "" || "$MEMBERUID" == "DON" ]]; then MEMBER=$ADMINPSEUDO; MEMRIB=$NODE_G1PUBKEY; fi
AMOUNTG1=$(./silkaj/silkaj amount "$PUBKEY") AMOUNTG1=$(./silkaj/silkaj amount "$PUBKEY")
GETLIMIT=$(bc <<< "$AMOUNTG1 - $LIMIT") GETLIMIT=$(bc <<< "$AMOUNTG1 - $LIMIT")

View File

@ -7,9 +7,10 @@
# sudo apt install ssmtp mpack # sudo apt install ssmtp mpack
# Configure in /etc/ssmtp # Configure in /etc/ssmtp
# Send email with file attachement: mpack -s "Logo G1Tag" /home/pi/G1sms+/G1Tag.png dest@email.ext # Send email with file attachement: mpack -s "Logo G1Tag" /home/pi/G1sms+/G1Tag.png dest@email.ext
source ./shell/init.sh source ./shell/init.sh
source ./shell/functions.sh source ./shell/functions.sh
log "__SUB:sms_EMAIL.sh.sh: START ($1=phone, $2=mail)" log "__SUB:sms_EMAIL.sh.sh: START ($1=phone, $2=mail)"
phone="$1" phone="$1"
@ -35,7 +36,7 @@ fi
# SEND EMAIL WITH ssmtp # SEND EMAIL WITH ssmtp
SUBJECT="[G1sms+] $MEMBER, message de votre portefeuille monnaie libre $UIDNA ($PHONE)" 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} 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 "__SUB:sms_EMAIL.sh.sh: Send welcome EMAIL to $mail via ssmtp"
log_history $PHONE "EMAIL, $mail" log_history $PHONE "EMAIL, $mail"
@ -43,7 +44,7 @@ log_history $PHONE "EMAIL, $mail"
mess="[G1sms+] mess="[G1sms+]
$MEMBER $MEMBER
Votre email est : $mail Votre email est : $mail
Mettez le à jour, quand cela est nécessaire..." Mettez le à jour, si cela est nécessaire..."
sms_SEND "$phone" "$mess" sms_SEND "$phone" "$mess"

View File

@ -82,7 +82,7 @@ if [[ ! $PASSENGER && ! $G1DAB ]]; then
if [[ -f ./wallets/$PHONE/ipfsid.G1TAGNODE ]]; then if [[ -f ./wallets/$PHONE/ipfsid.G1TAGNODE ]]; then
DABnode=$(cat ./wallets/$PHONE/ipfsid.G1TAGNODE) DABnode=$(cat ./wallets/$PHONE/ipfsid.G1TAGNODE)
if [[ "$DABnode" == "$IPFSNODEID" ]]; then 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!!" log "__SUB:sms_G1TAG.sh: IMPRIMANTE G1Tag non détectée!!"
exit exit
fi fi
@ -100,18 +100,18 @@ fi
########################################### ###########################################
# PAY VIR + PERCENT G1 # PAY VIR + PERCENT G1
ML=$(bc -l <<< "scale=2; $VIR + $PERCENT") 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 if [[ "$PAY" == "" || "$(echo $PAY | cut -d '|' -f 1)" == "KO" ]]; then
new=$(./shell/checknodes.sh "BAN") new=$(./shell/checknodes.sh "BAN")
sms_ERROR "$PHONE" "Il est survenu un problème lors de votre virement: $PAY / Silkaj: $new"; sms_ERROR "$PHONE" "Il est survenu un problème lors de votre virement: $PAY / Silkaj: $new";
exit exit
else else
cents=$(echo $(bc -l <<< "scale=0; $ML * 100") | cut -d '.' -f 1) cents=$(echo $(bc -l <<< "scale=0; $ML * 100") | cut -d '.' -f 1)
move_g1cents "$PHONE" "$MASTERPUB" "$cents" move_g1cents "$PHONE" "$NODE_G1PUBKEY" "$cents"
fi 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 c=0
while [[ $c -lt $NUMBER ]]; do while [[ $c -lt $NUMBER ]]; do
((c++)) ((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. # 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" ./shell/natools.py encrypt -p $PUBKEY -i "/home/$YOU/.ipfs/keystore/${RR}" -o "$TAGG1smsWKEY"
# GIVE SWARM ACCESS TO ZEN TAG # 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 # 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 -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" composite -compose Over -gravity SouthEast "./TAG/${RR}/TAG_WRITE.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
# ADD Avatar in the Center # ADD Avatar in the Center
if [[ $(file "./wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then # 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" # composite -compose Over -resize 150% -gravity Center "./wallets/$PHONE/$PHONE.avatar.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
else # else
composite -compose Over -resize 100% -gravity Center "./shell/Portefeuille.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png" # composite -compose Over -resize 100% -gravity Center "./shell/G1Anar.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
fi # fi
# WRITE G1Tag G1 amount # WRITE G1Tag G1 amount
convert -pointsize 150 -fill black -gravity Center -draw 'text 300,-140 "'"$2"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png" # if [[ $NUMBER -ne 1 ]]; then
convert -pointsize 50 -fill black -gravity North -draw 'text 20,0 "'"${PR}"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png" 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 # WRITE G1Tag RR
convert -pointsize 40 -fill black -gravity SouthWest -draw 'text 3,0 "'"${RR}"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png" 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_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 brother_ql_print "./TAG/${RR}/${RR}.bin" /dev/usb/lp0
else 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 " log "__SUB:sms_G1TAG.sh: Remote PRINT :: ./wallets/.$destnode/PRINT/${RR}.bin "
mkdir -p "./wallets/.$destnode/PRINT/" 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 fi
else else
# #
@ -258,13 +260,19 @@ done
if [[ "$destnode" == "" || "$destnode" == "$IPFSNODEID" ]]; then if [[ "$destnode" == "" || "$destnode" == "$IPFSNODEID" ]]; then
# PRINT $PHONE WALLET PUBKEY # PRINT $PHONE WALLET PUBKEY
qrencode -s 5 -o "/tmp/G1PubQR.$PHONE.png" "$(cat ./wallets/$PHONE/$PHONE.pub)" 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 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 fi
convert -pointsize 60 -fill black -gravity Center -draw 'text 340,-160 "'"$MEMBER"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" if [[ -f ./wallets/$PHONE/$PHONE.uidrib ]]; then
convert -pointsize 70 -fill black -gravity Center -draw 'text 345,-5 "'"$UIDNA"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" qrencode -s 6 -o "/tmp/G1MemQR.$PHONE.png" "$(cat ./wallets/$PHONE/$PHONE.uidrib)";
convert -pointsize 60 -fill black -gravity Center -draw 'text 350,80 "'"$PHONE"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" 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_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 brother_ql_print "/tmp/G1PubQR.$PHONE.bin" /dev/usb/lp0
rm -f /tmp/G1PubQR.* rm -f /tmp/G1PubQR.*

View File

@ -64,7 +64,7 @@ fi
sleep 2 sleep 2
# + G1SMS Commission # + 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 if [[ "$(echo $COM | cut -d '|' -f 1)" == "KO" || "$PAY" == "" ]]; then
new=$(./shell/checknodes.sh "BAN") new=$(./shell/checknodes.sh "BAN")
sms_ERROR "$phone" "Problème de payement avec silkaj (changement de serveur $new): $COM"; 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 else
# OK: Sync g1cents # OK: Sync g1cents
cents=$(echo $(bc -l <<< "scale=0; $PERCENT * 100") | cut -d '.' -f 1) cents=$(echo $(bc -l <<< "scale=0; $PERCENT * 100") | cut -d '.' -f 1)
move_g1cents "$phone" "$MASTERPUB" "$cents" move_g1cents "$phone" "$NODE_G1PUBKEY" "$cents"
fi fi
# LOG ACCOUNT HISTORY EVENTS # LOG ACCOUNT HISTORY EVENTS

View File

@ -79,20 +79,22 @@ else
log "__SUB:sms_REC.sh: SEARCH $VIRDEST related wallet!!! $DESTRIB " log "__SUB:sms_REC.sh: SEARCH $VIRDEST related wallet!!! $DESTRIB "
DESTMEM="$VIRDEST" DESTMEM="$VIRDEST"
# SEARCH IN WALLETS # 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 if [[ "$LOCAL" != "" ]]; then
# LOCAL G1sms account # LOCAL G1sms account
DESTRIB=$(cat ./wallets/$LOCAL/$LOCAL.pub) DESTRIB=$(cat ./wallets/$LOCAL/$LOCAL.pub)
DESTPHONE=$LOCAL DESTPHONE=$LOCAL
log "__SUB:sms_REC.sh: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)" log "__SUB:sms_REC.sh: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)"
else else
# SEARCH IN WALLETS SWARM # SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA)
SWARMNB=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/') INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
if [[ "$LOCAL" != "" ]]; then if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
REMOTENODE=$(cat ./wallets_swarm/$SWARMNB/MASTERPHONE.sms) if [[ "$INSWARM" != "" ]]; then
DESTRIB=$(cat ./wallets_swarm/$SWARMNB/$SWARMNB.pub) REMOTENODE=$(cat ./wallets_swarm/$INSWARM/MASTERPHONE.sms)
DESTPHONE=$SWARMNB DESTRIB=$(cat ./wallets_swarm/$INSWARM/$INSWARM.pub)
log "__SUB:sms_REC.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($SWARMNB)" DESTPHONE=$INSWARM
log "__SUB:sms_REC.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)"
else else
# SEARCH WITH SILKAJ # SEARCH WITH SILKAJ
DESTRIB=$(./silkaj/silkaj id "$DESTMEM" | grep -w "$DESTMEM" | awk '{print $2}') 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" log_history "$PHONE" "REC, $VIR, $DESTRIB, $DESTMEM, $PERIOD, $TIME"
# Send DESTPHONE sms # Send DESTPHONE sms
if [[ "$DESTPHONE" != "" ]]; then 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 fi
else else

View File

@ -33,7 +33,7 @@ testmin=${accounting[0]}
VIR=${accounting[1]} VIR=${accounting[1]}
PERCENT=${accounting[2]} PERCENT=${accounting[2]}
if [[ $testmin -eq 0 ]]; then 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 exit
fi fi
@ -48,15 +48,17 @@ else
log "__SUB:sms_VIR.sh: SEARCH $VIRDEST related wallet!!! $DESTRIB " log "__SUB:sms_VIR.sh: SEARCH $VIRDEST related wallet!!! $DESTRIB "
DESTMEM="$VIRDEST" DESTMEM="$VIRDEST"
# SEARCH IN WALLETS # 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 if [[ "$LOCAL" != "" ]]; then
# LOCAL G1sms account # LOCAL G1sms account
DESTRIB=$(cat ./wallets/$LOCAL/$LOCAL.pub) DESTRIB=$(cat ./wallets/$LOCAL/$LOCAL.pub)
DESTPHONE=$LOCAL DESTPHONE=$LOCAL
log "__SUB:sms_VIR.sh: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)" log "__SUB:sms_VIR.sh: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)"
else else
# SEARCH IN WALLETS SWARM # SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA)
INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/') 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 if [[ "$INSWARM" != "" ]]; then
REMOTENODE=$(cat ./wallets_swarm/$INSWARM/MASTERPHONE.sms) REMOTENODE=$(cat ./wallets_swarm/$INSWARM/MASTERPHONE.sms)
DESTRIB=$(cat ./wallets_swarm/$INSWARM/$INSWARM.pub) DESTRIB=$(cat ./wallets_swarm/$INSWARM/$INSWARM.pub)
@ -71,7 +73,7 @@ else
fi fi
if [[ "$DESTRIB" != "" ]]; then 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 if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" && "$PAY" != "" ]]; then
log "__SUB:sms_VIR.sh: VIREMENT VERS $DESTMEM OK" log "__SUB:sms_VIR.sh: VIREMENT VERS $DESTMEM OK"
mess="[G1sms+] $MEMBER mess="[G1sms+] $MEMBER
@ -83,7 +85,7 @@ $PAY"
log_history "$PHONE" "VIR, $VIR, $DESTRIB, $DESTMEM" log_history "$PHONE" "VIR, $VIR, $DESTRIB, $DESTMEM"
# Send DESTPHONE sms # Send DESTPHONE sms
if [[ "$DESTPHONE" != "" ]]; then 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 fi
cents=$(echo $(bc -l <<< "scale=0; $VIR * 100") | cut -d '.' -f 1) cents=$(echo $(bc -l <<< "scale=0; $VIR * 100") | cut -d '.' -f 1)
move_g1cents "$PHONE" "$DESTRIB" "$cents" move_g1cents "$PHONE" "$DESTRIB" "$cents"

View File

@ -125,8 +125,8 @@ IFILE=$(su $YOU -c "ipfs add \"${MUSICFILE}\" | tail -n 1")
if [[ ! $IFILE ]]; then exit; fi if [[ ! $IFILE ]]; then exit; fi
echo "$IFILE" > $TAGPASSENGER echo "$IFILE" > $TAGPASSENGER
# ONLY SWARM KEY CAN DECRYPT IPFS LINK TO FILE (TODO: Glue better) # ONLY SWARM KEY CAN DECRYPT IPFS LINK TO FILE (TODO: Glue better)
MASTERPUB=$(cat "./g1sms.pub.key") NODE_G1PUBKEY=$(cat "./g1sms.pub.key")
./shell/natools.py encrypt -p "$MASTERPUB" -i "$TAGPASSENGER" -o "$TAGPASSENGERCRYPT" ./shell/natools.py encrypt -p "$NODE_G1PUBKEY" -i "$TAGPASSENGER" -o "$TAGPASSENGERCRYPT"
echo "LOADED" > $TAGPASSENGER echo "LOADED" > $TAGPASSENGER
echo "$DEB" > $TAGPASSENGERDEBIT echo "$DEB" > $TAGPASSENGERDEBIT

View File

@ -12,9 +12,9 @@
READERID=$1 READERID=$1
JSOURCE=$2 JSOURCE=$2
KEYFILE="./g1sms.priv.key" 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 NODEG1TAG=$(cat "./wallets_swarm/.$READERID/TAG/$READERID") # Contains IPNS link to Node G1Tag
if [[ ! $NODEG1TAG ]]; then if [[ ! $NODEG1TAG ]]; then

View File

@ -155,8 +155,8 @@ cat /dev/ttyACM0 | while read line; do
# Make Silkaj TX # Make Silkaj TX
G1VAL=$(bc -l <<< "scale=2; $BVALUE / 100" | cut -d '.' -f 1) G1VAL=$(bc -l <<< "scale=2; $BVALUE / 100" | cut -d '.' -f 1)
log "__SUB:tag_READ.sh: Silkaj TX $MASTERKEYFILE ($G1VAL) -> $CASHBACK" log "__SUB:tag_READ.sh: Silkaj TX $NODE_G1PRIVKEYFILE ($G1VAL) -> $CASHBACK"
PAY=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=$G1VAL --output=$CASHBACK --comment="[G1sms+] CAPTURE G1Tag $RR" -y) 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" log "__SUB:tag_READ.sh: Silkaj output = $PAY"
if [[ "$(echo $PAY | cut -d '|' -f 1)" == "KO" ]]; then if [[ "$(echo $PAY | cut -d '|' -f 1)" == "KO" ]]; then
@ -221,7 +221,7 @@ cat /dev/ttyACM0 | while read line; do
else else
log "__SUB:tag_READ.sh: Transfert de G1 Tag à G1 Tag. $BVALUE $CUR" 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}" ./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 fi
CASHBACK="" CASHBACK=""
fi fi
@ -234,7 +234,7 @@ cat /dev/ttyACM0 | while read line; do
else else
log "__SUB:tag_READ.sh: Transformation du G1 Tag en Rec Tag. ${val[0]} = ${val[1]}" 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}..." ./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 fi
CASHBACK="" CASHBACK=""
fi fi

View File

@ -20,9 +20,9 @@ function log () {
$1" >> /tmp/tag_READ_X.log $1" >> /tmp/tag_READ_X.log
} }
MASTERKEYFILE="${MY_PATH}/../g1sms.priv.key" NODE_G1PRIVKEYFILE="${MY_PATH}/../g1sms.priv.key"
if [ ! -f $MASTERKEYFILE ]; then echo "ERREUR CLEF DECHIFFRAGE!"; exit; fi if [ ! -f $NODE_G1PRIVKEYFILE ]; then echo "ERREUR CLEF DECHIFFRAGE!"; exit; fi
# TODO G1TAG: USE CREATOR NODE KEY FILE INSTEAD OF MASTERKEYFILE SWARM KEY # TODO G1TAG: USE CREATOR NODE KEY FILE INSTEAD OF NODE_G1PRIVKEYFILE SWARM KEY
# DOUCHETTE ES TU LA? # DOUCHETTE ES TU LA?
if [ ! $G1TX ]; then echo "Branchez votre lecteur de QR code!"; exit; fi 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)}') FID=$(echo $ID | awk '{print toupper($1)}')
RR=$(echo $ID | sed s/\ //g) 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"); RVALUE=$(su $YOU -c "ipfs cat /ipns/$J/TAG_amount");
CURRENCY=$(su $YOU -c "ipfs cat /ipns/$J/TAG_currency" | awk '{print tolower($1)}') 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"); PASSENGER=$(su $YOU -c "ipfs cat /ipns/$J/TAG_passenger");
if [[ "$PASSENGER" != "" ]]; then if [[ "$PASSENGER" != "" ]]; then
./shell/tools/4LETTER.scroll.py "G1TAG PASSENGER $RVALUE ZEN" ./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)}') FID=$(echo $ID | awk '{print toupper($1)}')
RR=$(echo $ID | sed s/\ //g) 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") BVALUE=$(su $YOU -c "ipfs cat /ipns/$J/TAG_amount")
CURRENCY=$(su $YOU -c "ipfs cat /ipns/$J/TAG_currency" | awk '{print tolower($1)}') 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"); PASSENGER=$(su $YOU -c "ipfs cat /ipns/$J/TAG_passenger");
# DIG PUBLISHING KEY # DIG PUBLISHING KEY
if [[ -f /home/$YOU/.ipfs/keystore/$RR ]]; then if [[ -f /home/$YOU/.ipfs/keystore/$RR ]]; then
@ -122,7 +122,7 @@ cat /dev/ttyACM0 | while read line; do
*) *)
if [[ $lon -eq 44 ]]; then if [[ $lon -eq 44 ]]; then
./shell/tools/4LETTER.scroll.py "PORTEFEUILLE G1 >>>>>>>>" & ./shell/tools/4LETTER.scroll.py "PORTEFEUILLE G1 >>>>>>>> ${#act[@]}" &
J=$qrvalue J=$qrvalue
if [[ "$J" != "${obj[0]}" ]]; then if [[ "$J" != "${obj[0]}" ]]; then
VALUE=$(./shell/timeout.sh -t 25 ./silkaj/silkaj amount $J) VALUE=$(./shell/timeout.sh -t 25 ./silkaj/silkaj amount $J)
@ -177,8 +177,8 @@ cat /dev/ttyACM0 | while read line; do
# Make Silkaj TX # Make Silkaj TX
G1VAL=$(bc -l <<< "scale=2; $BVALUE / 100" | cut -d '.' -f 1) G1VAL=$(bc -l <<< "scale=2; $BVALUE / 100" | cut -d '.' -f 1)
log "__SUB:tag_READ_X.sh: Silkaj TX $MASTERKEYFILE ($G1VAL) -> $CASHBACK" log "__SUB:tag_READ_X.sh: Silkaj TX $NODE_G1PRIVKEYFILE ($G1VAL) -> $CASHBACK"
PAY=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=$G1VAL --output=$CASHBACK --comment="[G1sms+] G1Tag $RR ZEN -> G1" -y) 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" log "__SUB:tag_READ_X.sh: Silkaj output = $PAY"
# Stop 1LETTER.spinner.py # Stop 1LETTER.spinner.py
@ -251,8 +251,8 @@ cat /dev/ttyACM0 | while read line; do
COMBIENZEN=$(bc -l <<< "$COMBIEN * 100") COMBIENZEN=$(bc -l <<< "$COMBIEN * 100")
log "__SUB:tag_READ_X.sh: Transfert de G1 Tag à G1 Tag. $COMBIEN" 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" ./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" 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 "$MASTERKEYFILE" ./shell/tag_OP.sh ${obj[1]} ${obj[0]} $COMBIENZEN "$NODE_G1PRIVKEYFILE"
else else
./shell/tools/4LETTER.scroll.py "ERREUR $COMBIEN > VALEUR DE ${FID} *** ${val[1]} ZEN" ./shell/tools/4LETTER.scroll.py "ERREUR $COMBIEN > VALEUR DE ${FID} *** ${val[1]} ZEN"
fi fi
@ -268,7 +268,7 @@ cat /dev/ttyACM0 | while read line; do
else else
log "__SUB:tag_READ_X.sh: Transformation du G1 Tag en Rec Tag. ${val[0]} = ${val[1]}" 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}"; ./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 fi
CASHBACK="" CASHBACK=""
fi fi

View File

@ -2,4 +2,4 @@ SILKAJ_VERSION = "silkaj 0.5.0"
NO_MATCHING_ID = "No matching identity" NO_MATCHING_ID = "No matching identity"
G1_SYMBOL = "Ğ1" G1_SYMBOL = "Ğ1"
GTEST_SYMBOL = "ĞTest" GTEST_SYMBOL = "ĞTest"
G1_DEFAULT_ENDPOINT = "duniter.moul.re", "443" G1_DEFAULT_ENDPOINT = "duniter-g1.p2p.legal", "443"

View File

@ -27,14 +27,16 @@
# License: GPL (http://www.google.com/search?q=GPL) # 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 # Execute Kalkun daemon
[[ -f /var/www/kalkun/scripts/daemon.sh ]] && /var/www/kalkun/scripts/daemon.sh [[ -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 YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
export CHEMIN="/home/$YOU/G1sms+" cd $MY_PATH
cd $CHEMIN source $MY_PATH/shell/init.sh
source ./shell/init.sh source $MY_PATH/shell/functions.sh
source ./shell/functions.sh
################################################################## ##################################################################
# Get global variables from gammu-smsd # Get global variables from gammu-smsd
@ -70,7 +72,7 @@ if [[ ! -f "./wallets/$PHONE/MASTERPHONE.sms" && "$CMD" != "ADMIN" ]]
then then
NODEPHONE=$(cat "./wallets_swarm/$PHONE/MASTERPHONE.sms") NODEPHONE=$(cat "./wallets_swarm/$PHONE/MASTERPHONE.sms")
if [[ "$NODEPHONE" != "$MASTERPHONE" && "$NODEPHONE" != "" ]]; then 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)" log "ALERT!! $PHONE compte existant sur le NODE G1sms+ ($NODEPHONE)"
exit exit
fi fi
@ -155,10 +157,10 @@ case "$CMD" in
W5=$(echo "$TEXT" | awk '{print tolower($6)}' | grep -E "^[a-z0-9]+$") W5=$(echo "$TEXT" | awk '{print tolower($6)}' | grep -E "^[a-z0-9]+$")
W6=$(echo "$TEXT" | awk '{print tolower($7)}' | 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]+$") 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" & ./shell/sms_BILLETCHK.sh "$PHONE" "$W1" "$W2" "$W3" "$W4" "$W5" "$W6" "$W7" &
else 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 fi
;; ;;
TAG) TAG)

22
wait_actions/sync_ipfs.sh Executable file
View File

@ -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='<id>\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

View File

@ -1,11 +1,11 @@
<?php <?php
/* /*
DONE!!!? WRITE THAT CODE IN infobar2.js : arrount line 158 before "return lines;" DONE!!!? WRITE THAT CODE IN infobar2.js : arrount line 158 before "return lines;"
// ZEEBOX HACK ZONE // 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 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 = ' <a id="REC" title="Enregistrer sur Youtube" href="#" onclick=\'javascript:window.open("'+ reclink +'","REC","menubar=no, scrollbars=no, top=10, left=10, width=384, height=546");return false;\'>[REC]</a>'; var zcopylink = ' <a id="REC" title="Enregistrer sur Youtube" href="#" onclick=\'javascript:window.open("'+ reclink +'","REC","menubar=no, scrollbars=no, top=10, left=10, width=384, height=546");return false;\'>[REC]</a>';
zcopylink += ' <a title="RECHERCHE LIBRE" href="/REC/youtube-dl.php" target="youtube">*</a>'; zcopylink += ' <a title="RECHERCHE LIBRE" href="/REC/youtube-dl.php" target="youtube">*</a>';
lines[0].text += zcopylink; lines[0].text += zcopylink;
// ZEEBOX HACK ZONE // ZEEBOX HACK ZONE
*/ */
// RUN CLI if($argc>1) parse_str(implode('&',array_slice($argv, 1)), $_REQUEST); // RUN CLI if($argc>1) parse_str(implode('&',array_slice($argv, 1)), $_REQUEST);
@ -22,7 +22,7 @@ $len=strlen($artist.$title);
//$result='<a href="#null" onclick="javascript:window.close();"><img src="/REC/REC.png"></a><br>'; //$result='<a href="#null" onclick="javascript:window.close();"><img src="/REC/REC.png"></a><br>';
$result='<a href="https://www.copylaradio.com" target="copylaradio"><img src="/REC/REC.png"></a><br>'; $result='<a href="https://www.copylaradio.com" target="copylaradio"><img src="/REC/REC.png"></a><br>';
if( $radio == "" ) { $radio = "CopyLaRadio"; } if( $radio == "" ) { $radio = "CopyLaRadio"; }
if( $radio == "Nova zz" ) { if( $radio == "Nova zz" ) {
$artist = "undefined"; $artist = "undefined";
$title = "undefined"; $title = "undefined";
} }
@ -62,7 +62,7 @@ if( $search == "REC" ) {
} else { } else {
shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Aucun module"'); shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Aucun module"');
} }
} else { } else {
shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Identification imprécise. Podcast? Fichier local?"'); shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Identification imprécise. Podcast? Fichier local?"');
} }
@ -116,10 +116,10 @@ $lnkform.='<form action="/REC/youtube-dl.php" method="GET">
<ul> <ul>
<?php echo $ytform; ?> <?php echo $ytform; ?>
<hr> <hr>
<?php echo $lnkform; ?> <?php echo $lnkform; ?>
<hr> <hr>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>