diff --git a/.gitignore b/.gitignore index b0f54db..0f40eaa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,14 @@ +authfile g1sms.bfproject g1sms.priv.key shell/init.sh -*~ -wallets/ +shell/bad.nodes.txt +shell/good.nodes.txt shell/trash/ +wallets/ wallets_swarm/ -history.* TAG/ +billets/ +history.* +*~ + diff --git a/_chain b/_chain index 788028c..f43502e 100755 --- a/_chain +++ b/_chain @@ -1 +1 @@ -QmYZA2BruxJBrv8sDtjCfwTeB4hCFGBJsCAyUEyktB3PYs +Qma8qnxgJ8rtCoo6grgzYb9d346pAFjm7vcvxpXVwAFYo7 diff --git a/_comments b/_comments index 594394b..7fd7e36 100755 --- a/_comments +++ b/_comments @@ -162,3 +162,5 @@ OK 2019-11-25: 2019-11-26: clean 2019-11-27: sms +2019-12-10: +2019-12-10: diff --git a/_nanodate b/_nanodate index 67cc4f7..46c44af 100755 --- a/_nanodate +++ b/_nanodate @@ -1 +1 @@ -1574863684133516892 +1575941136113508325 diff --git a/_publishkey.gpg b/_publishkey.gpg index 1f7959c..30b9790 100755 Binary files a/_publishkey.gpg and b/_publishkey.gpg differ diff --git a/shell/bad.nodes.txt b/shell/bad.nodes.txt deleted file mode 100644 index 4d45c3e..0000000 --- a/shell/bad.nodes.txt +++ /dev/null @@ -1 +0,0 @@ -duniter.moul.re:443 diff --git a/shell/cron_CODE.backup.sh b/shell/cron_CODE.backup.sh index eb398e7..713f044 100755 --- a/shell/cron_CODE.backup.sh +++ b/shell/cron_CODE.backup.sh @@ -50,7 +50,7 @@ echo $(date +%s%N) > "./$dir/_nanodate" echo "$now: $COMMENT" >> "./$dir/_comments" # TAR ALL ARCHIVE FILES -tar -cvzf G1sms+_backup_$now.tar.gz --exclude 'init.sh' --exclude 'constants.py' --exclude 'TAG' --exclude 'history*' --exclude 'trash' --exclude 'print' --exclude 'wallets' --exclude 'wallets_swarm' --exclude 'g1sms.priv.key' ./$dir +tar -cvzf G1sms+_backup_$now.tar.gz --exclude 'authfile' --exclude 'init.sh' --exclude '.git' --exclude 'billets' --exclude 'constants.py' --exclude 'TAG' --exclude 'history*' --exclude 'trash' --exclude 'print' --exclude 'wallets' --exclude 'wallets_swarm' --exclude 'g1sms.priv.key' ./$dir mkdir -p /tmp/CODE/ mv G1sms+_backup_$now.tar.gz /tmp/CODE/G1sms+.latest.tgz diff --git a/shell/functions.sh b/shell/functions.sh index aee4c61..029b79f 100755 --- a/shell/functions.sh +++ b/shell/functions.sh @@ -599,11 +599,11 @@ function move_g1cents (){ # MUST ASK MANAGER NODE TO CORRECT g1cents FOR $winnerphone WALLET # WRITE TASK TO .$NODEID CHANNEL mkdir -p ./wallets/.$NODEID/TASK/ - # USE natools with NODEG1PUB crypt + # USE natools with NODEPUB crypt echo "$zenvalue" > "/tmp/move_g1cents.$winnerphone" # GET NODE G1sms Wallet PUBKEY - NODEG1PUB=$(cat ./wallets_swarm/.$NODEID/$NODEID.pub) - ./shell/natools.py encrypt -p $NODEG1PUB -i "/tmp/move_g1cents.$winnerphone" -o "./wallets/.$NODEID/TASK/$NANODATE.move_g1cents.$winnerphone.NODEPUB.crypt" + NODEPUB=$(cat ./wallets_swarm/.$NODEID/$NODEID.pub) + ./shell/natools.py encrypt -p $NODEPUB -i "/tmp/move_g1cents.$winnerphone" -o "./wallets/.$NODEID/TASK/$NANODATE.move_g1cents.$winnerphone.NODEPUB.crypt" log "__SUB:move_g1cents: CREDIT: WRITE TASK TO ./wallets/.$NODEID/$NANODATE.move_g1cents.$winnerphone.NODEPUB.crypt " rm -f /tmp/move_g1cents.$winnerphone fi diff --git a/shell/good.nodes.txt b/shell/good.nodes.txt index 0bbbf61..b595471 100644 --- a/shell/good.nodes.txt +++ b/shell/good.nodes.txt @@ -1,5 +1,2 @@ -duniter.moul.re:443 -g1.duniter.fr:443 g1.duniter.org:443 g1.monnaielibreoccitanie.org:443 -g1.presles.fr:443 diff --git a/shell/init_keys.sh b/shell/init_keys.sh index ee6ca99..55d0735 100755 --- a/shell/init_keys.sh +++ b/shell/init_keys.sh @@ -103,7 +103,7 @@ fi ################################################################ #INFORM ABOUT NODE CAPACITIES -export NODEG1PUB=$(cat "./wallets/.$IPFSNODEID/$IPFSNODEID.pub") +export NODEPUB=$(cat "./wallets/.$IPFSNODEID/$IPFSNODEID.pub") ## IS IT A SMS NODE (gammu-smsd is installed)?? if [[ $G1SMS ]]; then diff --git a/shell/manual_BILLETS_PERIMES.sh b/shell/manual_BILLETS_PERIMES.sh new file mode 100755 index 0000000..feb04f3 --- /dev/null +++ b/shell/manual_BILLETS_PERIMES.sh @@ -0,0 +1,52 @@ +#!/bin/bash +################################################################################ +# Author: Fred (support@qo-op.com) +# Version: 0.1 +# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) +################################################################################ +# Search for old G1Billets to transfer G1 & destroy them +source ./shell/init.sh +source ./shell/functions.sh + +# Existence days number can be $1 +if [[ "$1" ]]; then vieux="$1"; else vieux=180; fi +if [[ "$2" ]]; then dest="$2"; else dest=$MASTERPUB; fi + +echo "Recherche de G1Billets plus vieux que $vieux jours." +Nbillets=$(find billets/ -daystart -mtime +$vieux -type f -name "*.pubkey" | wc -l) +echo "$Nbillets G1Billets trouvés..." + +for result in $(find billets/ -daystart -mtime +$vieux -type d -name "*"); do + billetname=$(echo $result | cut -d '/' -f 2) + ((Nbillets --)) + if [[ $billetname && "$billetname" != "MEMBERS" ]]; then + code=$(echo $billetname | sed s/_/\ /g ) + creator=$(cat $result/*.creator) + value=$(cat "$result/note.value") + unit=$(cat "$result/note.unit") + pubkey=$(cat "$result/note.pubkey") + salt=$(cat "$result/note.salt") + secret=$(cat "$result/note.secret") + + virement=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 balance $pubkey | grep Quantitative | cut -d '=' -f 2 | cut -d ' ' -f 2) + + echo ">>> $billetname $pubkey créé par $creator, valeur $virement G1." + echo ">>> Virer à $dest $virement G1 du G1billet !! ID / Pass:" + echo $code + echo $secret $salt + echo "/usr/local/bin/silkaj tx --amount=\"$virement\" --output=\"$dest\"" + + PAY=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 tx --amount="$virement" --output="$dest" -y) + + if [[ ! $(echo $PAY | grep "successfully sent") ]]; then + echo "!!!! ERREUR: Something Wrong happened with $result" + exit + else + echo "Tout s'est bien passé! On supprime $result et continue avec le billet $Nbillets" + rm -Rf $result + fi + else + echo "MEMBER:" $result + fi +done + diff --git a/shell/sms_DESTROY.sh b/shell/sms_DESTROY.sh index c036b4a..26bdece 100755 --- a/shell/sms_DESTROY.sh +++ b/shell/sms_DESTROY.sh @@ -38,7 +38,7 @@ if [[ "$MEMBERUID" == "DON" || "$MEMBERUID" == "" || "$MEMBERUID" == "$MEMBER" ] GETLIMIT=$(bc <<< "$AMOUNTG1 - $LIMIT") PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$GETLIMIT" --output="$MEMRIB" --comment="[G1sms+] Wallet DESTROY $MEMBER $MEMBERUID" -y) sleep 5 - back=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$LIMIT" --output="$NODEG1PUB" --comment="[G1sms+] Wallet DESTROY Send $LIMIT To NODE" -y) + back=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$LIMIT" --output="$NODEPUB" --comment="[G1sms+] Wallet DESTROY Send $LIMIT To NODE" -y) if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" && "$PAY" != "" && "$(echo $back | cut -d '|' -f 1)" != "KO" ]]; then # DESTROY FILESYSTEM AND G1sms WALLET SWARM REFERENCE @@ -48,7 +48,7 @@ if [[ "$MEMBERUID" == "DON" || "$MEMBERUID" == "" || "$MEMBERUID" == "$MEMBER" ] cents=$(echo $(bc -l <<< "scale=0; $GETLIMIT * 100") | cut -d '.' -f 1) move_g1cents "$PHONE" "$MEMRIB" "$cents" cents=$(echo $(bc -l <<< "scale=0; $LIMIT * 100") | cut -d '.' -f 1) - move_g1cents "$PHONE" "$NODEG1PUB" "$cents" + move_g1cents "$PHONE" "$NODEPUB" "$cents" I=$(ipfs_node_wallets_add) log "__SUB:sms_DESTROY.sh: WALLET DESTROYED : $PHONE / $UIDNA / $MEMBER : OK" fi diff --git a/shell/sms_EMAIL.sh b/shell/sms_EMAIL.sh index 8cc6d9d..2ebba7b 100755 --- a/shell/sms_EMAIL.sh +++ b/shell/sms_EMAIL.sh @@ -4,6 +4,10 @@ # Version: 0.1 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) ################################################################################ +# sudo apt install ssmtp mpack +# Configure in /etc/ssmtp +# Send email with file attachement: mpack -s "Logo G1Tag" /home/pi/G1sms+/G1Tag.png dest@email.ext + source ./shell/init.sh source ./shell/functions.sh log "__SUB:sms_EMAIL.sh.sh: START ($1=phone, $2=mail)" diff --git a/www/DUQR/index.html b/www/DUQR/index.html new file mode 100644 index 0000000..0d6946d --- /dev/null +++ b/www/DUQR/index.html @@ -0,0 +1,147 @@ + + + + + + + + + + \ No newline at end of file