From abb7ccbdc74e13c1257ef3b97540adf29c67d734 Mon Sep 17 00:00:00 2001 From: qo-op Date: Sat, 21 Dec 2019 01:25:10 +0100 Subject: [PATCH] REC VIR AIDE --- _chain | 2 +- _comments | 1 + _nanodate | 2 +- _publishkey.gpg | Bin 1288 -> 1288 bytes shell/cron_MINUTE.sh | 132 ++++++++++++++++++-------------- shell/manual_BILLETS_PERIMES.sh | 20 +++-- shell/sms_AIDE.sh | 19 +++-- shell/sms_REC.sh | 18 +++-- shell/sms_VIR.sh | 8 +- 9 files changed, 114 insertions(+), 88 deletions(-) diff --git a/_chain b/_chain index 953407d..08f5b4c 100755 --- a/_chain +++ b/_chain @@ -1 +1 @@ -QmbRvGMpwZws4ii5xe5x8EgK1SSxNBaNNjinwdWjhye3TR +QmaN3w2NGxejb8yNN1sP4fvnfDV3YDghStcjbyLr7zchCC diff --git a/_comments b/_comments index 7842c23..8d6d3ca 100755 --- a/_comments +++ b/_comments @@ -175,3 +175,4 @@ OK 2019-12-17: Better G1Tx 2019-12-17: G1TAG REFRESH & more 2019-12-18: RAZ +2019-12-20: NOW diff --git a/_nanodate b/_nanodate index 7778f6d..1a8bd2e 100755 --- a/_nanodate +++ b/_nanodate @@ -1 +1 @@ -1576627244479575204 +1576803110070568420 diff --git a/_publishkey.gpg b/_publishkey.gpg index 619e3dc50687c359bc2dc032d3aeb90658ecfee3..69ba96ad3a4a3b7aea51459ca6324f9636c1f003 100755 GIT binary patch literal 1288 zcmV+j1^4=l4Fm}T0#dPD1^vd&Kfu!J0VN?Mifkt0(tPXi(9-SVH1eKajpLawz{yO_ zID?Vug0nE30@SVK!Qptyo)_e(8MtrpKLpwHQ^%i>r&P_;k)WrwJLyJ(ca<)>Zs0d= zH`Sln==5$)hi^YVp1E4J#h4iS8~yA5G|yhMd|atd z!1D&K^EALuU(g=H84u5wgQmfzQUTSCJ1hMvu>8w=O&uFPxY@QwAO=V%BuuD&oM}7miHZE>8RtQ~XhgDGTMui*BHcbiI7S+YprnfVY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5V`b*Bz%{ncK&MMXO*hK>KDf0h_Z#(X%`lKSs7UVX?93qEO>-gCFBleLwDw%} zt^87Y*mw(=Dn7gTiyZ|0^0U3J)bcbYzJSw&w0JQ6O0||N=;ix?rk;Vw#7`i8vQE`- zESK?mi~7STKw%R89}uS6)eRNdxEs 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 "$MASTERKEYFILE" -i "${qrrtag}" -o "/tmp/G1Tag.png" - log "__SUB:cron_MINUTE.sh: natools.py decrypt - $(date)" - brother_ql_create --model QL-700 "/tmp/G1Tag.png" --label-size 62 > "/tmp/G1Tag.bin" - log "__SUB:cron_MINUTE.sh: brother_ql_create - $(date)" - brother_ql_print "/tmp/G1Tag.bin" /dev/usb/lp0 - log "__SUB:cron_MINUTE.sh: brother_ql_print - $(date)" - # INFORM PRINT DONE - echo "OK" > ./wallets/.$IPFSNODEID/PRINT/done.$rr - 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) - done - - rm "/tmp/G1Tag.bin" - rm "/tmp/G1Tag.png" -fi - - - -################################################################## -if [[ "$timebar" == "0300" ]]; then -################################################################## - echo "It is 3 in the morning, or in the night? It depends on your day..." + echo "It is $timebar in the morning, or in the night? It depends on your day..." + exit fi ################################################################## + +################################################################## +if [[ "$1" == "PRINT" ]]; then +################################################################## + ################################################################## + # Refresh All peers SWARM Wallets. + ################################################################## + ipfs_swarm_wallets_refresh "SIMPLE" + + ################################################################################ + # PRINT G1Tag PRINTED FROM ANOTHER NODE + # CREATE and REMOVE rr.bin -> done.rr + if [[ -d "./wallets_swarm/.$IPFSNODEID/PRINT/" ]]; then + log "__SUB:cron_MINUTE.sh: SEARCH NEW PRINT FOR ME .$IPFSNODEID" + mkdir -p ./wallets/.$IPFSNODEID/PRINT/ + + for qrrtag in ./wallets_swarm/.$IPFSNODEID/PRINT/*.bin; do + rr=$(echo $qrrtag | cut -d '/' -f 5 | cut -d '.' -f 1) + if [[ ! -f "./wallets/.$IPFSNODEID/PRINT/done.$rr" ]]; then + log "__SUB:cron_MINUTE.sh: PRINT G1Tag $rr - START: $(date)" + ./shell/natools.py decrypt -k "$MASTERKEYFILE" -i "${qrrtag}" -o "/tmp/G1Tag.png" + log "__SUB:cron_MINUTE.sh: natools.py decrypt - $(date)" + brother_ql_create --model QL-700 "/tmp/G1Tag.png" --label-size 62 > "/tmp/G1Tag.bin" + log "__SUB:cron_MINUTE.sh: brother_ql_create - $(date)" + brother_ql_print "/tmp/G1Tag.bin" /dev/usb/lp0 + log "__SUB:cron_MINUTE.sh: brother_ql_print - $(date)" + # INFORM PRINT DONE + echo "OK" > ./wallets/.$IPFSNODEID/PRINT/done.$rr + 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) + done + + rm "/tmp/G1Tag.bin" + rm "/tmp/G1Tag.png" + fi +fi +################################################################## + +################################################################## +if [[ "$1" == "KALKUN" ]]; then +################################################################## + 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 +################################################################## diff --git a/shell/manual_BILLETS_PERIMES.sh b/shell/manual_BILLETS_PERIMES.sh index 8b202c0..79d4e21 100755 --- a/shell/manual_BILLETS_PERIMES.sh +++ b/shell/manual_BILLETS_PERIMES.sh @@ -36,14 +36,20 @@ for result in $(find billets/ -daystart -mtime +$vieux -type d -name "*"); do echo $secret $salt echo "/usr/local/bin/silkaj tx --amount=\"$virement\" --output=\"$dest\"" - PAY=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 tx --amount="$virement" --output="$dest" -y) - - if [[ ! $(echo $PAY | grep "successfully sent") ]]; then - echo "!!!! ERREUR: $virement Something Wrong happened with $result" - if [[ ! $virement ]]; then mv $result /tmp/$result; fi + if [[ "$virement" == "0.0" ]]; then + echo "G1Billet déjà vide, suppression de $result"; rm -Rf $result; else - echo "Tout s'est bien passé! On supprime $result et continue avec le billet $Nbillets" - rm -Rf $result + PAY=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 tx --amount="$virement" --output="$dest" -y) + if [[ ! $(echo $PAY | grep "successfully sent") ]]; then + echo "!!!! ERREUR: $virement Something Wrong happened with $result. Moving to /tmp/$billetname" + mkdir -p /tmp/$billetname + mv $result /tmp/$billetname + else + echo $PAY + echo "OK! On supprime $result et continue avec le billet $Nbillets" + echo + rm -Rf $result + fi fi else echo "MEMBER:" $result diff --git a/shell/sms_AIDE.sh b/shell/sms_AIDE.sh index 404691d..36ca4de 100755 --- a/shell/sms_AIDE.sh +++ b/shell/sms_AIDE.sh @@ -11,21 +11,20 @@ log "X sms_AIDE.sh ($1=phone)" sms_INIT_ACCOUNT "$1" "NOSMS" MESS="[Aide] -N Id-M (Relier au portefeuille Id-M) -U G1/DU/LOVE (UNIT) -S (Solde) -P 06nnnnnnnn 300 (Envoyer 300 UNIT à 06nnnnnnnn)" +N Pseudo (membre ou nom de portefeuille) : Création portefeuille +U G1/DU/LOVE : Unité +S : Solde +P 06nnnnnnnn 300 : Payer 300 à 06nnnnnnnn" # Send response SMS sms_SEND "$1" "$MESS" -MESS="EMAIL moi@email.tld (Recevoir vos commandes par email) -TAG 10 5 (Créer 5 G1Tag de 10 G1) -VIR 50 Idw (Virer 50 UNIT vers Idw)" +MESS="EMAIL moi@email.tld : Commander G1billets +VIR 50 Pseudo : Virer 50 à Pseudo (membre ou portefeuille)" sms_SEND "$1" "$MESS" -MESS="REC (Pour un payement récurrent) -D (Détail de votre compte) -A votre service. +MESS="REC 50 Dest S 4: Virer 50 à Dest pendant 4 Semaines (J/S/M/A) +RAZ : clôturer compte (vidé vers Pseudo) +OU Dab3241 : Imprimante ses G1Tag sur Dab3241 $ADMINPSEUDO / G1sms+ / $ADMINPHONE https://g1sms.fr" sms_SEND "$1" "$MESS" diff --git a/shell/sms_REC.sh b/shell/sms_REC.sh index 7ec15d1..dab19b3 100755 --- a/shell/sms_REC.sh +++ b/shell/sms_REC.sh @@ -79,20 +79,22 @@ else log "__SUB:sms_REC.sh: SEARCH $VIRDEST related wallet!!! $DESTRIB " DESTMEM="$VIRDEST" # SEARCH IN WALLETS - LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidna | tail -n 1 | cut -f 3 -d '/') + LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidname | tail -n 1 | cut -f 3 -d '/') + if [[ "$LOCAL" == "" ]]; then LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi if [[ "$LOCAL" != "" ]]; then # LOCAL G1sms account DESTRIB=$(cat ./wallets/$LOCAL/$LOCAL.pub) DESTPHONE=$LOCAL log "__SUB:sms_REC.sh: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)" else - # SEARCH IN WALLETS SWARM - SWARMNB=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/') - if [[ "$LOCAL" != "" ]]; then - REMOTENODE=$(cat ./wallets_swarm/$SWARMNB/MASTERPHONE.sms) - DESTRIB=$(cat ./wallets_swarm/$SWARMNB/$SWARMNB.pub) - DESTPHONE=$SWARMNB - log "__SUB:sms_REC.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($SWARMNB)" + # SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA) + INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/') + if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi + if [[ "$INSWARM" != "" ]]; then + REMOTENODE=$(cat ./wallets_swarm/$INSWARM/MASTERPHONE.sms) + DESTRIB=$(cat ./wallets_swarm/$INSWARM/$INSWARM.pub) + DESTPHONE=$INSWARM + log "__SUB:sms_REC.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)" else # SEARCH WITH SILKAJ DESTRIB=$(./silkaj/silkaj id "$DESTMEM" | grep -w "$DESTMEM" | awk '{print $2}') diff --git a/shell/sms_VIR.sh b/shell/sms_VIR.sh index ea97204..1f78b73 100755 --- a/shell/sms_VIR.sh +++ b/shell/sms_VIR.sh @@ -48,15 +48,17 @@ else log "__SUB:sms_VIR.sh: SEARCH $VIRDEST related wallet!!! $DESTRIB " DESTMEM="$VIRDEST" # SEARCH IN WALLETS - LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidna | tail -n 1 | cut -f 3 -d '/') + LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidname | tail -n 1 | cut -f 3 -d '/') + if [[ "$LOCAL" == "" ]]; then LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi if [[ "$LOCAL" != "" ]]; then # LOCAL G1sms account DESTRIB=$(cat ./wallets/$LOCAL/$LOCAL.pub) DESTPHONE=$LOCAL log "__SUB:sms_VIR.sh: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)" else - # SEARCH IN WALLETS SWARM - INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/') + # SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA) + INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/') + if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi if [[ "$INSWARM" != "" ]]; then REMOTENODE=$(cat ./wallets_swarm/$INSWARM/MASTERPHONE.sms) DESTRIB=$(cat ./wallets_swarm/$INSWARM/$INSWARM.pub)