Today tweeks
This commit is contained in:
parent
89144aad96
commit
e9ad4a7f0e
|
@ -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.*
|
||||
*~
|
||||
|
||||
|
|
2
_chain
2
_chain
|
@ -1 +1 @@
|
|||
QmYZA2BruxJBrv8sDtjCfwTeB4hCFGBJsCAyUEyktB3PYs
|
||||
Qma8qnxgJ8rtCoo6grgzYb9d346pAFjm7vcvxpXVwAFYo7
|
||||
|
|
|
@ -162,3 +162,5 @@ OK
|
|||
2019-11-25:
|
||||
2019-11-26: clean
|
||||
2019-11-27: sms
|
||||
2019-12-10:
|
||||
2019-12-10:
|
||||
|
|
BIN
_publishkey.gpg
BIN
_publishkey.gpg
Binary file not shown.
|
@ -1 +0,0 @@
|
|||
duniter.moul.re:443
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,2 @@
|
|||
duniter.moul.re:443
|
||||
g1.duniter.fr:443
|
||||
g1.duniter.org:443
|
||||
g1.monnaielibreoccitanie.org:443
|
||||
g1.presles.fr:443
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
@ -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)"
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
<style>
|
||||
body {
|
||||
display: grid;
|
||||
height: 97%;
|
||||
grid-template:
|
||||
"search qr" 2em
|
||||
"list main" auto
|
||||
/ 20em auto;
|
||||
grid-gap: .5em;
|
||||
}
|
||||
body:before {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 2em;
|
||||
/* background: red; */
|
||||
z-index: 2;
|
||||
padding: .5em;
|
||||
box-shadow: 0 0 11px #0000004d;
|
||||
}
|
||||
|
||||
body > input { grid-area: search; z-index: 3; }
|
||||
body > ul { grid-area: list; z-index: 1; }
|
||||
body > qr { grid-area: qr; z-index: 3; }
|
||||
body > img { grid-area: main; z-index: 1; }
|
||||
|
||||
ul {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
li {
|
||||
list-style: none;
|
||||
padding: .3em .5em;
|
||||
}
|
||||
li:hover { background: lightgrey }
|
||||
uid { display: block; }
|
||||
pubkey { display: block; color: grey; }
|
||||
|
||||
qr {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
qr label:after {
|
||||
content: " :";
|
||||
}
|
||||
qr input {
|
||||
max-width: 70px;
|
||||
}
|
||||
qr input[name=data] {
|
||||
height: 32px;
|
||||
width: 350px;
|
||||
max-width: initial;
|
||||
}
|
||||
</style>
|
||||
|
||||
<input type="text" name="search"/>
|
||||
<ul></ul>
|
||||
<qr><input type="text" name="data"/></qr>
|
||||
<img />
|
||||
|
||||
<!--<script src="./wot.membres.json.js"></script>-->
|
||||
|
||||
<script>
|
||||
const ss_pp = (ss,...pp)=> ss.map( (s,i)=> s + (pp[i] || '') ).join('')
|
||||
const $ = (ss,...pp)=> [...document.querySelectorAll( ss_pp(ss,...pp) )]
|
||||
const DOM = (ss,...pp)=> (new DOMParser).parseFromString( ss_pp(ss,...pp), 'text/html' ).body.children
|
||||
|
||||
const search = $`input`[0]
|
||||
const members = $`ul`[0]
|
||||
const QRform = $`qr`[0]
|
||||
const QRimg = $`img`[0]
|
||||
|
||||
search.onkeyup = e=> [...members.children]
|
||||
.map( li=> (li.style.display = 'block',li) )
|
||||
.filter( li=> !(new RegExp(search.value,'i')).test( li.querySelector('uid').textContent ) )
|
||||
.map( li=> li.style.display = 'none' )
|
||||
|
||||
|
||||
const QR = {
|
||||
api: "https://api.qrserver.com/v1/create-qr-code/",
|
||||
config: {
|
||||
format: ["svg","png","gif","jpeg","jpg","eps"],
|
||||
size: "300x300",
|
||||
color: "#000",
|
||||
bgcolor: "#ffffff",
|
||||
qzone: 1,
|
||||
ecc: ["Q","H","M","L"]
|
||||
/*
|
||||
"L (low, ~7% destroyed data may be corrected)",
|
||||
"M (middle, ~15% destroyed data may be corrected)",
|
||||
"Q (quality, ~25% destroyed data may be corrected)",
|
||||
"H (high, ~30% destroyed data may be corrected)"
|
||||
]
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QRform.append( ...
|
||||
Object.keys( QR.config )
|
||||
.map( opt=> DOM`<label for="">${opt}</label>${
|
||||
Array.isArray(QR.config[opt]) ?
|
||||
`<select name="${opt}">${QR.config[opt].map(item=>`<option value="${item}">${item}</option>`).join('')}</select>`
|
||||
: QR.config[opt][0] == "#" ?
|
||||
`<input type="color" name="${opt}" value="${QR.config[opt]}" />`
|
||||
: `<input type="text" name="${opt}" value="${QR.config[opt]}" />`
|
||||
}`
|
||||
)
|
||||
.reduce((a,o)=>a.concat(...o), [])
|
||||
)
|
||||
|
||||
const QRnames = $`qr [name]`
|
||||
QRnames.map( n=>
|
||||
n.onchange = e=>
|
||||
QRimg.src = QR.api + QRnames.reduce( (s,n)=> s + n.name + "=" + n.value.replace(/^#/,'') + "&", "?")
|
||||
)
|
||||
|
||||
|
||||
;(
|
||||
typeof wot != 'undefined' &&
|
||||
Promise.resolve( wot.members )
|
||||
||
|
||||
fetch('https://g1.duniter.org/wot/members')
|
||||
.then( res=> res.json() )
|
||||
)
|
||||
.then( json=> json.results.map(o=>DOM`<li><uid>${o.uid}</uid><pubkey>${o.pubkey}</pubkey></li>`[0]) )
|
||||
.then( items=> items.map( li=>
|
||||
(li.onclick = e=> {
|
||||
$`qr [name=data]`[0].value = e.currentTarget.querySelector('pubkey').textContent
|
||||
$`qr [name=data]`[0].dispatchEvent(new Event('change'))
|
||||
}
|
||||
/*$`img`[0].src = `https://api.qrserver.com/v1/create-qr-code/?
|
||||
format=svg&size=300x300&
|
||||
data=${e.currentTarget.querySelector('pubkey').textContent}&qzone=1&
|
||||
ecc=H`
|
||||
.replace(/\s* /mg,'')*/
|
||||
,li)
|
||||
) )
|
||||
.then( items=> members.append(...items) )
|
||||
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue