G1SMS REWRITE 80%
This commit is contained in:
parent
19a1950f96
commit
a8c1ee320b
|
@ -124,15 +124,17 @@ function ipfs_node_wallets_add (){
|
||||||
|
|
||||||
#################################################################################################################################
|
#################################################################################################################################
|
||||||
function sms_uid2key (){
|
function sms_uid2key (){
|
||||||
RIBFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.uidrib"
|
# sms_uid2key "$MEMBERUID" "$PHONE" "$PIN"
|
||||||
NAMEFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.uidname"
|
RIBFILE="~/.zen/g1sms_wallets/$PHONE/_uidrib"
|
||||||
UIDNAFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.uidna"
|
NAMEFILE="~/.zen/g1sms_wallets/$PHONE/_uidname"
|
||||||
|
UIDNAFILE="~/.zen/g1sms_wallets/$PHONE/_uidna"
|
||||||
# New related wallet asked
|
# New related wallet asked
|
||||||
ASKWALLET="$1"
|
ASKWALLET="$1"
|
||||||
#For micro payement
|
#For micro payement
|
||||||
PHONE="$2"
|
PHONE="$2"
|
||||||
PIN="$3"
|
PIN="$3"
|
||||||
if -f "$UIDNAFILE"; then UIDNA=$(cat "$UIDNAFILE"); else UIDNA=""; fi
|
|
||||||
|
[[ -f $UIDNAFILE ]] && UIDNA=$(cat $UIDNAFILE) || UIDNA=""
|
||||||
log "__SUB:sms_uid2key: $UIDNA Try to associate $ASKWALLET with $PHONE... SEARCHING..."
|
log "__SUB:sms_uid2key: $UIDNA Try to associate $ASKWALLET with $PHONE... SEARCHING..."
|
||||||
|
|
||||||
if [[ $UIDNA && "$ASKWALLET" == "$UIDNA" ]]; then
|
if [[ $UIDNA && "$ASKWALLET" == "$UIDNA" ]]; then
|
||||||
|
@ -151,7 +153,7 @@ function sms_uid2key (){
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Search fo duplicate
|
# Search fo duplicate
|
||||||
DUP=$(grep -Rwl "$ASKWALLET" ~/.zen/g1sms_wallets/*/*.uidname | cut -f 6 -d '/')
|
DUP=$(grep -Rwl "$ASKWALLET" ~/.zen/g1sms_wallets/*/_uidname | cut -f 6 -d '/')
|
||||||
if [[ "$DUP" != "" && "$DUP" != "$PHONE" ]]; then
|
if [[ "$DUP" != "" && "$DUP" != "$PHONE" ]]; then
|
||||||
sms_SEND "$ADMINPHONE" "ADMIN! INFO: $PHONE prend le même $ASKWALLET, que $DUP"
|
sms_SEND "$ADMINPHONE" "ADMIN! INFO: $PHONE prend le même $ASKWALLET, que $DUP"
|
||||||
sms_SEND "$DUP" "Vous devez savoir que $ASKWALLET est associé à un autre téléphone que le votre également!"
|
sms_SEND "$DUP" "Vous devez savoir que $ASKWALLET est associé à un autre téléphone que le votre également!"
|
||||||
|
@ -161,32 +163,34 @@ function sms_uid2key (){
|
||||||
# FIND ASKWALLET into wallets, wallest_swarm OR duniter (silkaj)
|
# FIND ASKWALLET into wallets, wallest_swarm OR duniter (silkaj)
|
||||||
DESTMEM="$VIRDEST"
|
DESTMEM="$VIRDEST"
|
||||||
# SEARCH IN WALLETS
|
# SEARCH IN WALLETS
|
||||||
LOCAL=$(grep -Rwl "$ASKWALLET" ~/.zen/g1sms_wallets/*/*.uidna | cut -f 6 -d '/')
|
LOCAL=$(grep -Rwl "$ASKWALLET" ~/.zen/g1sms_wallets/*/_uidna | cut -f 6 -d '/')
|
||||||
if [[ "$LOCAL" != "" ]]; then
|
if [[ "$LOCAL" != "" ]]; then
|
||||||
# LOCAL G1sms account
|
# LOCAL G1sms account
|
||||||
DESTRIB=$(cat ~/.zen/g1sms_wallets/$LOCAL/$LOCAL.pub)
|
DESTRIB=$(cat ~/.zen/g1sms_wallets/$LOCAL/_pub)
|
||||||
DESTPHONE=$LOCAL
|
DESTPHONE=$LOCAL
|
||||||
log "__SUB:sms_uid2key: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)"
|
log "__SUB:sms_uid2key: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)"
|
||||||
else
|
else
|
||||||
|
|
||||||
|
##################### REWRITE TODO
|
||||||
# SEARCH IN WALLETS SWARM
|
# SEARCH IN WALLETS SWARM
|
||||||
INSWARM=$(grep -Rwl "$ASKWALLET" ~/.zen/ipfs_swarm/.*/*/_uidna | cut -f 6 -d '/' )
|
# INSWARM=$(grep -Rwl "$ASKWALLET" ~/.zen/ipfs_swarm/*/_uidna | cut -f 6 -d '/' )
|
||||||
MYIPFS=$( echo $INSWARM | cut -f 6 -d '/' )
|
# MYCHAN=$( echo $INSWARM | cut -f 6 -d '/' )
|
||||||
MYHASH=$( echo $INSWARM | cut -f 7 -d '/' )
|
# MYHASH=$( echo $MYCHAN | cut -f 1 -d '@' )
|
||||||
if [[ "$INSWARM" != "" ]]; then
|
# if [[ "$INSWARM" != "" ]]; then
|
||||||
REMOTENODE=$(cat ~/.zen/ipfs_swarm/$MYIPFS/MASTERPHONE.sms)
|
# REMOTENODE=$(cat ~/.zen/ipfs_swarm/$MYIPFS/MASTERPHONE.sms)
|
||||||
DESTRIB=$(cat ~/.zen/ipfs_swarm/$MYHASH/_pub)
|
# DESTRIB=$(cat ~/.zen/ipfs_swarm/$MYHASH/_pub)
|
||||||
DESTPHONE=$INSWARM
|
# DESTPHONE=$INSWARM
|
||||||
log "__SUB:sms_uid2key: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)"
|
# log "__SUB:sms_uid2key: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)"
|
||||||
else
|
# else
|
||||||
|
##################### REWRITE TODO
|
||||||
# SEARCH WITH SILKAJ
|
# SEARCH WITH SILKAJ
|
||||||
log "__SUB:sms_uid2key: GETTING FROM SILKAJ MEMBER ID"
|
log "__SUB:sms_uid2key: GETTING FROM SILKAJ MEMBER ID"
|
||||||
DESTRIB=$(silkaj id "$ASKWALLET" | grep -w "$ASKWALLET" | awk '{print $2}' | tail -n 1)
|
DESTRIB=$(silkaj id "$ASKWALLET" | grep -w "$ASKWALLET" | awk '{print $2}' | tail -n 1)
|
||||||
log "__SUB:sms_uid2key: OUT OFF SWARM MEMBER wallet: $DESTRIB"
|
log "__SUB:sms_uid2key: OUT OFF SWARM MEMBER wallet: $DESTRIB"
|
||||||
# GET CESIUM+ geoPoint DATA (TODO: cron for GCHANGE SMS Alert)
|
# GET CESIUM+ geoPoint DATA (TODO: cron for GCHANGE SMS Alert)
|
||||||
curl -s ${CESIUM}/user/profile/${DESTRIB} | jq '._source.geoPoint' > "~/.zen/g1sms_wallets/$PHONE/$PHONE.uidgeo.json"
|
curl -s ${CESIUM}/user/profile/${DESTRIB} | jq '._source.geoPoint' > "~/.zen/g1sms_wallets/$PHONE/_uidgeo.json"
|
||||||
log "__SUB:sms_uid2key: GET CESIUM+ geoPoint and AVATAR : $(cat ~/.zen/g1sms_wallets/$PHONE/$PHONE.uidgeo.json)"
|
log "__SUB:sms_uid2key: GET CESIUM+ geoPoint and AVATAR : $(cat ~/.zen/g1sms_wallets/$PHONE/_uidgeo.json)"
|
||||||
curl -s ${CESIUM}/user/profile/${DESTRIB} | jq '._source.avatar._content' | sed 's/\"//g' | base64 -d > "~/.zen/g1sms_wallets/$PHONE/$PHONE.avatar.png"
|
curl -s ${CESIUM}/user/profile/${DESTRIB} | jq '._source.avatar._content' | sed 's/\"//g' | base64 -d > "~/.zen/g1sms_wallets/$PHONE/_avatar.png"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$DESTRIB" != "" ]; then
|
if [ "$DESTRIB" != "" ]; then
|
||||||
|
@ -194,7 +198,7 @@ function sms_uid2key (){
|
||||||
echo "$ASKWALLET" > "$NAMEFILE"
|
echo "$ASKWALLET" > "$NAMEFILE"
|
||||||
log "__SUB:sms_uid2key: NEW EXTERNAL RELATED $DESTRIB / FOR MEMBER OR WALLET = $ASKWALLET - INIT 0.1 TX"
|
log "__SUB:sms_uid2key: NEW EXTERNAL RELATED $DESTRIB / FOR MEMBER OR WALLET = $ASKWALLET - INIT 0.1 TX"
|
||||||
duniter_server=$(./tools/duniter_getnode.sh)
|
duniter_server=$(./tools/duniter_getnode.sh)
|
||||||
INIT=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output $DESTRIB --amount 0.1 --comment "[G1sms+] Porte Monnaie $(cat $UIDNAFILE) -> $(cat $NAMEFILE)" -y)
|
INIT=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output $DESTRIB --amount 1 --comment "[G1sms+] Porte Monnaie $(cat $UIDNAFILE) -> $(cat $NAMEFILE)" -y)
|
||||||
|
|
||||||
log "__SUB:sms_uid2key: INIT = $INIT | Create Connection with related Wallet."
|
log "__SUB:sms_uid2key: INIT = $INIT | Create Connection with related Wallet."
|
||||||
log_history "$PHONE" "MEMBER, $ASKWALLET"
|
log_history "$PHONE" "MEMBER, $ASKWALLET"
|
||||||
|
@ -217,23 +221,21 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
# Initiate PHONE settings files and values
|
# Initiate PHONE settings files and values
|
||||||
IPFSNODEIDFILE="~/.zen/g1sms_wallets/$PHONE/MASTERPHONE.ipfsid" # Contains G1sms+ NODE IPFS id
|
IPFSNODEIDFILE="~/.zen/g1sms_wallets/$PHONE/MASTERPHONE.ipfsid" # Contains G1sms+ NODE IPFS id
|
||||||
SMSNODE="~/.zen/g1sms_wallets/$PHONE/MASTERPHONE.sms" # Contains G1sms+ SMS phone number
|
SMSNODE="~/.zen/g1sms_wallets/$PHONE/MASTERPHONE.sms" # Contains G1sms+ SMS phone number
|
||||||
PINFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.pin" # Contains phone wallet diceware password
|
PINFILE="~/.zen/g1sms_wallets/$PHONE/_pin" # Contains phone wallet diceware password
|
||||||
GPGPINFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.pin.gpg" # Contains g1smsnode cypher phone wallet diceware password
|
GPGPINFILE="~/.zen/g1sms_wallets/$PHONE/_pin.gpg" # Contains g1smsnode cypher phone wallet diceware password
|
||||||
AUTHCRYPTFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.authfile.crypt" # Crypt with $NODE_G1PUBKEY
|
AUTHCRYPTFILE="~/.zen/g1sms_wallets/$PHONE/_authfile.crypt" # Crypt with $NODE_G1PUBKEY
|
||||||
PUBKEYFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.pub" # Contains phone wallet public key (RIB)
|
PUBKEYFILE="~/.zen/g1sms_wallets/$PHONE/_pub" # Contains phone wallet public key (RIB)
|
||||||
UNITFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.unit" # Contains phone wallet prefered unit (LOVE,G1,DU)
|
UNITFILE="~/.zen/g1sms_wallets/$PHONE/_unit" # Contains phone wallet prefered unit (LOVE,G1,DU)
|
||||||
|
|
||||||
RIBFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.uidrib" # Contains phone wallet related UID Pubkey
|
RIBFILE="~/.zen/g1sms_wallets/$PHONE/_uidrib" # Contains phone wallet related UID Pubkey
|
||||||
NAMEFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.uidname" # Contains the member UID related to wallet
|
NAMEFILE="~/.zen/g1sms_wallets/$PHONE/_uidname" # Contains the member UID related to wallet
|
||||||
MAILFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.email" # Contains the member EMAIL (Send BILLET)
|
MAILFILE="~/.zen/g1sms_wallets/$PHONE/_email" # Contains the member EMAIL (Send BILLET)
|
||||||
GPGMAILFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.email.gpg" # Contains the member EMAIL (Send BILLET)
|
GPGMAILFILE="~/.zen/g1sms_wallets/$PHONE/_email.gpg" # Contains the member EMAIL (Send BILLET)
|
||||||
UIDNAFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.uidna" # Contains the G1sms+ UID Name for recursive VIR
|
UIDNAFILE="~/.zen/g1sms_wallets/$PHONE/_uidna" # Contains the G1sms+ UID Name for recursive VIR
|
||||||
GEOFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.uidgeo.json" # Contains the member GeoPoint from member Cesium+ related to wallet
|
GEOFILE="~/.zen/g1sms_wallets/$PHONE/_uidgeo.json" # Contains the member GeoPoint from member Cesium+ related to wallet
|
||||||
|
|
||||||
RECFILE="~/.zen/g1sms_wallets/$PHONE/VIREMENTS" # File showing recurrent payements are left to be done with this G1sms Wallet
|
RECFILE="~/.zen/g1sms_wallets/$PHONE/VIREMENTS" # File showing recurrent payements are left to be done with this G1sms Wallet
|
||||||
GPGRECFILE="~/.zen/g1sms_wallets/$PHONE/VIREMENTS.gpg" # Cypher file with IPFSPrivKey (Node .Identity.PrivKey)
|
GPGRECFILE="~/.zen/g1sms_wallets/$PHONE/VIREMENTS.gpg" # Cypher file with IPFSPrivKey (Node .Identity.PrivKey)
|
||||||
G1COUNTFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.g1cents" # Last sms_COUNT.sh call value
|
|
||||||
CHAINFILE="~/.zen/g1sms_wallets/$PHONE/$PHONE.chain" # Contains wallet last IPFS hash before ZEN value change
|
|
||||||
|
|
||||||
DABUIDF="~/.zen/g1sms_wallets/$PHONE/uidna.G1TAGNODE" # Contains G1Dab Name
|
DABUIDF="~/.zen/g1sms_wallets/$PHONE/uidna.G1TAGNODE" # Contains G1Dab Name
|
||||||
# GET CURRENT NODE UIDNA (default DABUID)
|
# GET CURRENT NODE UIDNA (default DABUID)
|
||||||
|
@ -325,7 +327,6 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
echo $IPFSNODEID > $IPFSNODEIDFILE
|
echo $IPFSNODEID > $IPFSNODEIDFILE
|
||||||
PUBKEY=$(cat "$PUBKEYFILE" | xargs)
|
PUBKEY=$(cat "$PUBKEYFILE" | xargs)
|
||||||
UNIT=$(cat "$UNITFILE" | xargs)
|
UNIT=$(cat "$UNITFILE" | xargs)
|
||||||
if [ -f "$G1COUNTFILE" ]; then AMOUNTG1=$(bc <<< "scale=2; $(cat $G1COUNTFILE) / 100"); fi
|
|
||||||
if [ -f "$NAMEFILE" ]; then MEMBER=$(cat "$NAMEFILE"); else MEMBER=""; fi
|
if [ -f "$NAMEFILE" ]; then MEMBER=$(cat "$NAMEFILE"); else MEMBER=""; fi
|
||||||
if [ -f "$RIBFILE" ]; then MEMRIB=$(cat "$RIBFILE"); else MEMRIB=""; fi
|
if [ -f "$RIBFILE" ]; then MEMRIB=$(cat "$RIBFILE"); else MEMRIB=""; fi
|
||||||
if [ -f "$UIDNAFILE" ]; then UIDNA=$(cat "$UIDNAFILE"); else UIDNA=""; fi
|
if [ -f "$UIDNAFILE" ]; then UIDNA=$(cat "$UIDNAFILE"); else UIDNA=""; fi
|
||||||
|
@ -366,24 +367,31 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
log "__SUB:sms_INIT_ACCOUNT: END"
|
log "__SUB:sms_INIT_ACCOUNT: END"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function silkaj_balance () {
|
||||||
#################################################################################################################################
|
pubkey="$1"
|
||||||
function check_account (){
|
|
||||||
|
|
||||||
silkajQuantitativeAmountPattern='Total\sQuantitative\s+=\s+(.*)\s+Ğ1'
|
silkajQuantitativeAmountPattern='Total\sQuantitative\s+=\s+(.*)\s+Ğ1'
|
||||||
|
silkajExitCode=1
|
||||||
while [ $silkajExitCode -ne 0 ]
|
while [ $silkajExitCode -ne 0 ]
|
||||||
do
|
do
|
||||||
duniter_server=$(./tools/duniter_getnode.sh)
|
duniter_server=$(./tools/duniter_getnode.sh)
|
||||||
silkajOutput=$(silkaj -p "${duniter_server}" balance $PUBKEY 2>/dev/null)
|
silkajOutput=$(silkaj -p "${duniter_server}" balance $pubkey 2>/dev/null)
|
||||||
silkajExitCode=$?
|
silkajExitCode=$?
|
||||||
|
|
||||||
((i++))
|
((i++))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $silkajOutput =~ $silkajQuantitativeAmountPattern ]]
|
if [[ $silkajOutput =~ $silkajQuantitativeAmountPattern ]]
|
||||||
then
|
then
|
||||||
AMOUNTG1="${BASH_REMATCH[1]}"
|
echo "${BASH_REMATCH[1]}"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#################################################################################################################################
|
||||||
|
function check_account (){
|
||||||
|
|
||||||
|
AMOUNTG1=$(silkaj_balance $PUBKEY)
|
||||||
AMOUNTDU=$(bc <<< "scale=2; $AMOUNTG1 / $DUFACTOR")
|
AMOUNTDU=$(bc <<< "scale=2; $AMOUNTG1 / $DUFACTOR")
|
||||||
AMOUNTLOVE=$(bc <<< "$AMOUNTG1 * 100 / $DUFACTOR")
|
AMOUNTLOVE=$(bc <<< "$AMOUNTG1 * 100 / $DUFACTOR")
|
||||||
|
|
||||||
|
@ -427,21 +435,9 @@ esac
|
||||||
###########################################################
|
###########################################################
|
||||||
# GET G1sms wallet AMOUNTG1 and CHECK for right balance
|
# GET G1sms wallet AMOUNTG1 and CHECK for right balance
|
||||||
log "__SUB:make_accounting: LOCAL $VIR amount for $PHONE : $PUBKEY"
|
log "__SUB:make_accounting: LOCAL $VIR amount for $PHONE : $PUBKEY"
|
||||||
silkajQuantitativeAmountPattern='Total\sQuantitative\s+=\s+(.*)\s+Ğ1'
|
AMOUNTG1=$(silkaj_balance $PUBKEY)
|
||||||
|
|
||||||
while [ $silkajExitCode -ne 0 ]
|
|
||||||
do
|
|
||||||
duniter_server=$(./tools/duniter_getnode.sh)
|
|
||||||
silkajOutput=$(silkaj -p "${duniter_server}" balance $PUBKEY 2>/dev/null)
|
|
||||||
silkajExitCode=$?
|
|
||||||
|
|
||||||
((i++))
|
|
||||||
done
|
|
||||||
if [[ $silkajOutput =~ $silkajQuantitativeAmountPattern ]]
|
|
||||||
then
|
|
||||||
AMOUNTG1="${BASH_REMATCH[1]}"
|
|
||||||
fi
|
|
||||||
if [[ "$AMOUNTG1" == "" ]]; then AMOUNTG1=0; fi
|
if [[ "$AMOUNTG1" == "" ]]; then AMOUNTG1=0; fi
|
||||||
|
|
||||||
# TAX AND MINIMUM WALLET ACCOUNT CALCULATION
|
# TAX AND MINIMUM WALLET ACCOUNT CALCULATION
|
||||||
PERCENT=0$(bc -l <<< "scale=2; $VIR / $SWARMCOMM")
|
PERCENT=0$(bc -l <<< "scale=2; $VIR / $SWARMCOMM")
|
||||||
MIN=$(bc -l <<< "$AMOUNTG1 - $PERCENT - $LIMIT")
|
MIN=$(bc -l <<< "$AMOUNTG1 - $PERCENT - $LIMIT")
|
||||||
|
|
|
@ -6,20 +6,21 @@
|
||||||
##################################################################
|
##################################################################
|
||||||
# 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="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
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
|
NODE_G1PUBKEY=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||||
|
[[ $NODE_G1PUBKEY == "" ]] && echo "ERROR NODE_G1PUBKEY empty !! Please check it..." && exit 1
|
||||||
|
|
||||||
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)
|
||||||
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||||
NANODATE=$(date -u +%s%N) #1569692075385428020
|
NANODATE=$(date -u +%s%N) #1569692075385428020
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
# G1sms+ Node KEYS (G1wallet, gpg, IPNS)
|
# G1sms+ Node KEYS (G1wallet, gpg, IPNS)
|
||||||
##################################################################
|
##################################################################
|
||||||
export IPFSPrivKey=$(cat "~/.ipfs/config" | jq -r '.Identity.PrivKey') #"
|
IPFSPrivKey=$(cat ~/.ipfs/config | jq -r '.Identity.PrivKey') #"
|
||||||
|
export IPFSPrivKey="${IPFSPrivKey:0:24}" #
|
||||||
if [ ! $IPFSPrivKey ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey IPFSPrivKey EMPTY"; exit; fi
|
if [ ! $IPFSPrivKey ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey IPFSPrivKey EMPTY"; exit; fi
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
@ -27,19 +28,15 @@ if [ ! $IPFSPrivKey ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey IPFSP
|
||||||
##################################################################
|
##################################################################
|
||||||
# G1sms Service - G1Wallet
|
# G1sms Service - G1Wallet
|
||||||
#
|
#
|
||||||
# CLEF G1 DU SWARM
|
|
||||||
SWARM_G1PUBKEY=$(cat "${GPATH}/g1sms.pub.key")
|
|
||||||
SWARM_G1AUTHFILE="${GPATH}/g1sms.priv.key"
|
|
||||||
|
|
||||||
# ONE TIME GIVE NODE_UIDNA
|
# ONE TIME GIVE NODE_UIDNA
|
||||||
if [[ ! -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]]; then
|
if [[ ! -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]]; then
|
||||||
# CREATE NODE G1 KEYS AND FILES
|
# CREATE NODE G1 KEYS AND FILES
|
||||||
mkdir -p ~/.zen/ipfs/.$IPFSNODEID/TASK
|
mkdir -p ~/.zen/ipfs/.$IPFSNODEID/TASK
|
||||||
################################################
|
####################################################################
|
||||||
# GIVE NAME TO NODE G1 WALLET: "0000diceware"
|
# GIVE NAME TO NODE G1 WALLET: "6789diceware"
|
||||||
# CREATE "preoni" KeyS & ~/.zen/g1sms_wallets/.Qm***/_files
|
# And write ~/.zen/g1sms_wallets/.Qm***/G1SSB/(_files)
|
||||||
################################################
|
####################################################################
|
||||||
# 4 derniers chiffres du MASTERPHONE + diceware
|
|
||||||
PRE=${MASTERPHONE:8:4}
|
PRE=${MASTERPHONE:8:4}
|
||||||
ZUID=$(./diceware.sh 1 | xargs)
|
ZUID=$(./diceware.sh 1 | xargs)
|
||||||
# Check if already existing among all swarm wallets G1SSB or G1SMS
|
# Check if already existing among all swarm wallets G1SSB or G1SMS
|
||||||
|
@ -62,13 +59,12 @@ if [[ ! -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]]; then
|
||||||
[[ $USER == "pi" ]] && sudo echo "$NODE_UIDNA" > /etc/hostname
|
[[ $USER == "pi" ]] && sudo echo "$NODE_UIDNA" > /etc/hostname
|
||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
# BACKUP AUTHFILE FOR FOR SWARM USE (TODO: Refine Swarm, Node access): GIVES SMARM WITHDRAW ACTION
|
|
||||||
# TODO rewrite AUTO BACKUP / RESTORE
|
# TODO rewrite AUTO BACKUP / RESTORE
|
||||||
# tools/natools.py encrypt -p $SWARM_G1PUBKEY -i "./authfile" -o "~/.zen/ipfs/.$IPFSNODEID/G1SSB/_authfile.swarm.crypt"
|
# tools/natools.py encrypt -p $NODE_G1PUBKEY -i "./authfile" -o "~/.zen/ipfs/.$IPFSNODEID/G1SSB/_authfile.swarm.crypt"
|
||||||
|
|
||||||
# SILKAJ INIT G1 NODE WALLET TODO REWRITE silkaj call
|
# SILKAJ INIT G1 NODE WALLET TODO ACTIVATE
|
||||||
# TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$SWARM_G1AUTHFILE" --amount=3.24 --output=$NODE_G1PUBKEY --comment="[G1sms+] G1NODE ($ADMINPSEUDO) $NODE_UIDNA $IPFSNODEID" -y)
|
#duniter_server=$(./tools/duniter_getnode.sh)
|
||||||
# TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$NODE_UIDNA" -password="$NODE_PIN" --amount=0.1 --output=$SWARM_G1PUBKEY --comment="[G1sms+] G1NODE ($ADMINPSEUDO) $NODE_UIDNA $IPFSNODEID:ACK" -y)
|
#TX_IN=$(silkaj -p "$duniter_server" -af --file ~/.ssb/secret.dunikey tx --output $SWARM_G1PUBKEY --amount 3.24 --comment "[A.Station] G1SSBIPF ($ADMINPSEUDO) $NODE_UIDNA $IPFSNODEID" -y)
|
||||||
|
|
||||||
log "__SUB:initkeys.sh: [ADMIN] NODE G1sms+ $NODE_UIDNA : ls ~/.zen/ipfs/.$IPFSNODEID"
|
log "__SUB:initkeys.sh: [ADMIN] NODE G1sms+ $NODE_UIDNA : ls ~/.zen/ipfs/.$IPFSNODEID"
|
||||||
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "[ADMIN] G1sms+ NODE $NODE_UIDNA ($IPFSNODEID)" 1>&2
|
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "[ADMIN] G1sms+ NODE $NODE_UIDNA ($IPFSNODEID)" 1>&2
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# 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/)
|
||||||
################################################################################
|
################################################################################
|
||||||
# TODO: Before June 2020: Get "./billets/$bpath/note.authfile.IPFSPrivKey.gpg" for automatic Payback
|
# TODO: Before June 2020: Get "~/.zen/g1billets/$bpath/note.authfile.IPFSPrivKey.gpg" for automatic Payback
|
||||||
# Search for old G1Billets for final CHK : Forget & Transfer G1 ?
|
# Search for old G1Billets for final CHK : Forget & Transfer G1 ?
|
||||||
source ./init.sh
|
source ./init.sh
|
||||||
source ./functions.sh
|
source ./functions.sh
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 1.0
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
################################################################################
|
################################################################################
|
||||||
# Create and print 6 G1Billets de nn LOVE
|
# Create and print 6 G1Billets de nn LOVE
|
||||||
|
@ -44,8 +44,13 @@ if [ $VALbillet -gt 1000 ]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get AMOUNTG1, AMOUNTLOVE, AMOUNTDU
|
# Check account amount
|
||||||
AMOUNTG1=$(./silkaj/silkaj amount "$PUBKEY")
|
declare -a accounting
|
||||||
|
accounting=($(check_account))
|
||||||
|
log "$(declare -p accounting)"
|
||||||
|
AMOUNTG1=${accounting[0]}
|
||||||
|
AMOUNT=${accounting[1]}
|
||||||
|
UNIT=${accounting[2]}
|
||||||
AMOUNTDU=$(bc -l <<< "scale=2; $AMOUNTG1 / $DUFACTOR")
|
AMOUNTDU=$(bc -l <<< "scale=2; $AMOUNTG1 / $DUFACTOR")
|
||||||
AMOUNTLOVE=$(bc -l <<< "scale=0; $AMOUNTG1 * 100 / $DUFACTOR")
|
AMOUNTLOVE=$(bc -l <<< "scale=0; $AMOUNTG1 * 100 / $DUFACTOR")
|
||||||
|
|
||||||
|
@ -58,14 +63,10 @@ MIN=$(bc -l <<< "$AMOUNTG1 - $LIMIT - $BILLCOM")
|
||||||
testmin=$( echo "${VIR} < ${MIN}" | bc -l )
|
testmin=$( echo "${VIR} < ${MIN}" | bc -l )
|
||||||
log "__SUB:sms_BILLET.sh: TEST : $VIR < $MIN ? $testmin"
|
log "__SUB:sms_BILLET.sh: TEST : $VIR < $MIN ? $testmin"
|
||||||
|
|
||||||
# silkaj NODE CHANGE !!!
|
|
||||||
#SILKAJNODE=$(./checknodes.sh)
|
|
||||||
#log "NEW SILKAJ NODE: $SILKAJNODE"
|
|
||||||
|
|
||||||
if [[ "$testmin" -eq "1" ]]
|
if [[ "$testmin" -eq "1" ]]
|
||||||
then
|
then
|
||||||
# Clean MEMBER directory
|
# Clean MEMBER directory
|
||||||
rm -f ./billets/MEMBERS/$MEMBER/*.jpg
|
rm -f ~/.zen/g1billets/MEMBERS/$MEMBER/*.jpg
|
||||||
boucle=0;
|
boucle=0;
|
||||||
while [ $boucle -lt $NBbillets ]
|
while [ $boucle -lt $NBbillets ]
|
||||||
do
|
do
|
||||||
|
@ -74,7 +75,7 @@ then
|
||||||
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 "~/.zen/g1billets/$bpath" ]
|
||||||
do
|
do
|
||||||
NUMBER=$(./diceware.sh 2 | xargs)
|
NUMBER=$(./diceware.sh 2 | xargs)
|
||||||
bpath=$(echo $NUMBER | sed 's/ /_/g')
|
bpath=$(echo $NUMBER | sed 's/ /_/g')
|
||||||
|
@ -87,12 +88,15 @@ then
|
||||||
log "__SUB:sms_BILLET.sh: ->BILLET:$PHONE:$NUMBER:$VALbillet:$UNIT"
|
log "__SUB:sms_BILLET.sh: ->BILLET:$PHONE:$NUMBER:$VALbillet:$UNIT"
|
||||||
# CREATE "NUMBER SECRET" ACCOUNT for G1 transfert
|
# CREATE "NUMBER SECRET" ACCOUNT for G1 transfert
|
||||||
TRANSAC=$(bc -l <<< "scale=2; $VIR / $NBbillets")
|
TRANSAC=$(bc -l <<< "scale=2; $VIR / $NBbillets")
|
||||||
|
|
||||||
|
BILLETPUBKEY=$(python3 ./tools/key_create_dunikey.py "$NUMBER" "$SECRET"
|
||||||
|
mv /tmp/secret.dunikey ~/.zen/g1billets/$bpath/
|
||||||
BILLETPUBKEY=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$NUMBER" -password="$SECRET")
|
BILLETPUBKEY=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$NUMBER" -password="$SECRET")
|
||||||
# COPY authfile for Usage in 6 month...
|
# COPY authfile for Usage in 6 month...
|
||||||
log "__SUB:sms_BILLET.sh: authfile KEY : ./billets/$bpath/note.authfile.IPFSPrivKey.gpg"
|
log "__SUB:sms_BILLET.sh: authfile KEY : ~/.zen/g1billets/$bpath/note.authfile.IPFSPrivKey.gpg"
|
||||||
mkdir -p "./billets/$bpath"
|
mkdir -p "~/.zen/g1billets/$bpath"
|
||||||
echo "${IPFSPrivKey}" | gpg -q --output "./billets/$bpath/note.authfile.IPFSPrivKey.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "./authfile"
|
echo "${IPFSPrivKey}" | gpg -q --output "~/.zen/g1billets/$bpath/note.authfile.IPFSPrivKey.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "./authfile"
|
||||||
./natools.py encrypt -p $NODE_G1PUBKEY -i "./authfile" -o "./billets/$bpath/note.authfile.$NODE_UIDNA.crypt"
|
./natools.py encrypt -p $NODE_G1PUBKEY -i "./authfile" -o "~/.zen/g1billets/$bpath/note.authfile.$NODE_UIDNA.crypt"
|
||||||
rm -f "./authfile"
|
rm -f "./authfile"
|
||||||
|
|
||||||
log_history $PHONE "G1BILLET, $TRANSAC, $BILLETPUBKEY"
|
log_history $PHONE "G1BILLET, $TRANSAC, $BILLETPUBKEY"
|
||||||
|
@ -101,15 +105,15 @@ then
|
||||||
PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$TRANSAC" --output="$BILLETPUBKEY" --comment="G1Billet $NUMBER" -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
|
||||||
# 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 "$(date +%Y%m%d)" > "~/.zen/g1billets/$bpath/note.creationdate"
|
||||||
echo "$MEMBER" > "./billets/$bpath/note.creator"
|
echo "$MEMBER" > "~/.zen/g1billets/$bpath/note.creator"
|
||||||
echo "$MEMRIB" > "./billets/$bpath/note.memrib"
|
echo "$MEMRIB" > "~/.zen/g1billets/$bpath/note.memrib"
|
||||||
echo "$NUMBER" > "./billets/$bpath/note.number"
|
echo "$NUMBER" > "~/.zen/g1billets/$bpath/note.number"
|
||||||
echo "$PHONE" > "./billets/$bpath/note.phone"
|
echo "$PHONE" > "~/.zen/g1billets/$bpath/note.phone"
|
||||||
echo "$SECRET" > "./billets/$bpath/note.secret"
|
echo "$SECRET" > "~/.zen/g1billets/$bpath/note.secret"
|
||||||
echo "$VALbillet" > "./billets/$bpath/note.love"
|
echo "$VALbillet" > "~/.zen/g1billets/$bpath/note.love"
|
||||||
echo "$TRANSAC" > "./billets/$bpath/note.g1"
|
echo "$TRANSAC" > "~/.zen/g1billets/$bpath/note.g1"
|
||||||
echo "$BILLETPUBKEY" > "./billets/$bpath/note.pubkey"
|
echo "$BILLETPUBKEY" > "~/.zen/g1billets/$bpath/note.pubkey"
|
||||||
log "Remplissage: $TRANSAC G1... $BILLETPUBKEY = $PAY"
|
log "Remplissage: $TRANSAC G1... $BILLETPUBKEY = $PAY"
|
||||||
|
|
||||||
# CREATION FICHIER IMAGE BILLET
|
# CREATION FICHIER IMAGE BILLET
|
||||||
|
@ -122,8 +126,8 @@ then
|
||||||
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 produced files
|
# Copy & Send produced files
|
||||||
zip /tmp/$PHONE_Bills_$bpath.zip ./billets/MEMBERS/$MEMBER/*.*
|
zip /tmp/$PHONE_Bills_$bpath.zip ~/.zen/g1billets/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....."
|
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 ~/.zen/g1billets/MEMBERS/$MEMBER/ && log "__SUB:sms_BILLET.sh: ALERT sent....."
|
||||||
|
|
||||||
log "__SUB:sms_BILLET.sh: ERROR SILKAJ $(cat ./silkaj/src/constants.py)"
|
log "__SUB:sms_BILLET.sh: ERROR SILKAJ $(cat ./silkaj/src/constants.py)"
|
||||||
exit
|
exit
|
||||||
|
@ -137,7 +141,7 @@ then
|
||||||
# POUR IMPRIMER LES BILLETS! Brancher votre imprimante, configurer cups, activer code lp ;)
|
# POUR IMPRIMER LES BILLETS! Brancher votre imprimante, configurer cups, activer code lp ;)
|
||||||
num=$(date +%Y%m%d)
|
num=$(date +%Y%m%d)
|
||||||
log "__SUB:sms_BILLET.sh: 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 && rm -f ./billets/MEMBERS/$MEMBER/*.jpg && log "__SUB:sms_BILLET.sh: PDF made /tmp/$PHONE_Bills_$bpath.pdf"
|
montage ~/.zen/g1billets/MEMBERS/$MEMBER/*.jpg -tile 2x3 -geometry 964x459 /tmp/$PHONE_Bills_$bpath.pdf && rm -f ~/.zen/g1billets/MEMBERS/$MEMBER/*.jpg && log "__SUB:sms_BILLET.sh: PDF made /tmp/$PHONE_Bills_$bpath.pdf"
|
||||||
cd /tmp && zip $PHONE_Bills_$bpath.zip $PHONE_Bills_$bpath.pdf && log "__SUB:sms_BILLET.sh: Zip DONE :: /tmp$PHONE_Bills_$bpath.zip !!" && cd -
|
cd /tmp && zip $PHONE_Bills_$bpath.zip $PHONE_Bills_$bpath.pdf && log "__SUB:sms_BILLET.sh: Zip DONE :: /tmp$PHONE_Bills_$bpath.zip !!" && cd -
|
||||||
# rm -f /tmp/$PHONE_Bills_$bpath.pdf
|
# rm -f /tmp/$PHONE_Bills_$bpath.pdf
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
################################################################################
|
||||||
|
# Author: Fred (support@qo-op.com)
|
||||||
|
# Version: 1.0
|
||||||
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
|
################################################################################
|
||||||
# If 4 words provided => Check if Billet exists and return BILLET AMOUNT VALUE
|
# If 4 words provided => Check if Billet exists and return BILLET AMOUNT VALUE
|
||||||
# If 7 words provided => if Billet exists, transfer AMOUNT to PHONE & destroy BILLET
|
# If 7 words provided => if Billet exists, transfer AMOUNT to PHONE & destroy BILLET
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
|
@ -13,13 +18,13 @@ SEC="$4 $5 $6 $7"
|
||||||
# Construct billet path
|
# Construct billet path
|
||||||
bpath=$(echo "$CODE" | sed 's/ /_/g')
|
bpath=$(echo "$CODE" | sed 's/ /_/g')
|
||||||
|
|
||||||
if [ -d "./billets/$bpath" ]
|
if [ -d "~/.zen/g1billets/$bpath" ]
|
||||||
then
|
then
|
||||||
SECRET=$(cat "./billets/$bpath/note.secret")
|
SECRET=$(cat "~/.zen/g1billets/$bpath/note.secret")
|
||||||
SALT=$(cat "./billets/$bpath/note.salt")
|
SALT=$(cat "~/.zen/g1billets/$bpath/note.salt")
|
||||||
VALbillet=$(cat "./billets/$bpath/note.value")
|
VALbillet=$(cat "~/.zen/g1billets/$bpath/note.value")
|
||||||
UNIT=$(cat "./billets/$bpath/note.unit")
|
UNIT=$(cat "~/.zen/g1billets/$bpath/note.unit")
|
||||||
BILLETPUBKEY=$(cat "./billets/$bpath/note.pubkey")
|
BILLETPUBKEY=$(cat "~/.zen/g1billets/$bpath/note.pubkey")
|
||||||
|
|
||||||
AMOUNTG1=$(./silkaj/silkaj amount "$BILLETPUBKEY")
|
AMOUNTG1=$(./silkaj/silkaj amount "$BILLETPUBKEY")
|
||||||
log "Billet: $AMOUNTG1 ($VALbillet $UNIT): $BILLETPUBKEY"
|
log "Billet: $AMOUNTG1 ($VALbillet $UNIT): $BILLETPUBKEY"
|
||||||
|
@ -46,7 +51,7 @@ https://www.g1sms.fr/contact"
|
||||||
|
|
||||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
|
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
|
||||||
# DESTROY BILLET
|
# DESTROY BILLET
|
||||||
rm -Rf ./billets/$bpath
|
rm -Rf ~/.zen/g1billets/$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 -Rf /tmp/billets_valides/$bpath
|
rm -Rf /tmp/billets_valides/$bpath
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
################################################################################
|
||||||
|
# Author: Fred (support@qo-op.com)
|
||||||
|
# Version: 1.0
|
||||||
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
|
################################################################################
|
||||||
# Make Billet fabrique l'image de 6 billets de monnaie libre
|
# Make Billet fabrique l'image de 6 billets de monnaie libre
|
||||||
# Date de validité de 6 mois à compter du premier jour du mois courant
|
# Date de validité de 6 mois à compter du premier jour du mois courant
|
||||||
############################################################################
|
############################################################################
|
||||||
# INSTALLER convert et qrencode: sudo apt install imagemagick qrencode
|
# !!!! INSTALLER convert et qrencode: sudo apt install imagemagick qrencode
|
||||||
# IMPRIMANTE (http://smspi:631/) : sudo apt install printer-driver-all cups
|
# IMPRIMANTE (http://smspi:631/) : sudo apt install printer-driver-all cups
|
||||||
# https://junise.wordpress.com/2015/04/12/install-online-cups-printer-in-raspberry-pi/
|
# https://junise.wordpress.com/2015/04/12/install-online-cups-printer-in-raspberry-pi/
|
||||||
############################################################################
|
############################################################################
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
||||||
# TEST:
|
# TEST:
|
||||||
# ./sms_BILLET_MAKE.sh "nu me ro test" "se cr et" 100 LOVE 10.04 "https://g1sms.fr" G1SMS TEST
|
# ./sms_BILLET_MAKE.sh "nu me ro test" "se cr et" 100 LOVE 10.04 "https://g1sms.fr" G1SMS TEST
|
||||||
############################################################################
|
############################################################################
|
||||||
|
@ -45,9 +49,9 @@ 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 Avatar on G1 Logo SouthEast
|
# ADD Avatar on G1 Logo SouthEast
|
||||||
if [[ $(file "~/.zen/g1sms_wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then
|
if [[ $(file "~/.zen/g1sms_wallets/$PHONE/_avatar.png" | grep 'PNG') ]]; then
|
||||||
composite -compose Over -gravity East -geometry +15+0 -dissolve 33% "~/.zen/g1sms_wallets/$PHONE/$PHONE.avatar.png" "./Oeuro.jpg" "/tmp/$NUMERO.jpg"
|
composite -compose Over -gravity East -geometry +15+0 -dissolve 33% "~/.zen/g1sms_wallets/$PHONE/_avatar.png" "./Oeuro.jpg" "/tmp/$NUMERO.jpg"
|
||||||
composite -compose Over -gravity West -geometry +15+0 -dissolve 33% "~/.zen/g1sms_wallets/$PHONE/$PHONE.avatar.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
|
composite -compose Over -gravity West -geometry +15+0 -dissolve 33% "~/.zen/g1sms_wallets/$PHONE/_avatar.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
|
||||||
else
|
else
|
||||||
composite -compose Over -gravity East -geometry +15+0 -dissolve 33% "./G1Anar.png" "./Oeuro.jpg" "/tmp/$NUMERO.jpg"
|
composite -compose Over -gravity East -geometry +15+0 -dissolve 33% "./G1Anar.png" "./Oeuro.jpg" "/tmp/$NUMERO.jpg"
|
||||||
composite -compose Over -gravity West -geometry +15+0 -dissolve 33% "./G1Anar.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
|
composite -compose Over -gravity West -geometry +15+0 -dissolve 33% "./G1Anar.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
|
||||||
|
@ -118,8 +122,8 @@ if [[ "$TRANSAC" == "TEST" ]]; then
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
# Move billet to MEMBER folder 6 month later
|
# Move billet to MEMBER folder 6 month later
|
||||||
mkdir -p "./billets/MEMBERS/$MEMBER/"
|
mkdir -p "~/.zen/g1billets/MEMBERS/$MEMBER/"
|
||||||
mv "/tmp/BILL.$year.$valid.$NUMERO.$MONTANT.$UNIT.jpg" "./billets/MEMBERS/$MEMBER/"
|
mv "/tmp/BILL.$year.$valid.$NUMERO.$MONTANT.$UNIT.jpg" "~/.zen/g1billets/MEMBERS/$MEMBER/"
|
||||||
# Clean TEMP files
|
# Clean TEMP files
|
||||||
rm "/tmp/$NUMERO_NOTERIB.png"
|
rm "/tmp/$NUMERO_NOTERIB.png"
|
||||||
rm "/tmp/$NUMERO.jpg"
|
rm "/tmp/$NUMERO.jpg"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 1.0
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
################################################################################
|
################################################################################
|
||||||
source ./init.sh
|
source ./init.sh
|
||||||
|
@ -66,7 +66,7 @@ $(echo $todo | tail -n 1)";
|
||||||
fi
|
fi
|
||||||
log_history $PHONE "SOLDE, $AMOUNTG1"
|
log_history $PHONE "SOLDE, $AMOUNTG1"
|
||||||
else
|
else
|
||||||
sms_ERROR "$PHONE" "Problème de dialogue silkaj, Serveur $NEWDUNITER... Essayez dans 1 minute SVP..."
|
sms_ERROR "$PHONE" "Problème de dialogue silkaj... Essayez dans qq minutes SVP..."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo $AMOUNTG1
|
echo $AMOUNTG1
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 1.0
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
################################################################################
|
################################################################################
|
||||||
source ./init.sh
|
source ./init.sh
|
||||||
|
@ -34,13 +34,15 @@ if [[ "$MEMBERUID" == "DON" || "$MEMBERUID" == "" || "$MEMBERUID" == "$MEMBER" ]
|
||||||
# IF no Dest PubKey (no member) or DON, then NODE_G1PUBKEY 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=$NODE_G1PUBKEY; fi
|
if [[ $MEMRIB == "" || "$MEMBERUID" == "DON" ]]; then MEMBER=$ADMINPSEUDO; MEMRIB=$NODE_G1PUBKEY; fi
|
||||||
|
|
||||||
AMOUNTG1=$(./silkaj/silkaj amount "$PUBKEY")
|
AMOUNTG1=$(silkaj_balance $PUBKEY)
|
||||||
GETLIMIT=$(bc <<< "$AMOUNTG1 - $LIMIT")
|
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)
|
duniter_server=$(./tools/duniter_getnode.sh)
|
||||||
|
PAY=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$MEMRIB" --amount "$GETLIMIT" --comment "[G1sms+] Wallet DESTROY $MEMBER $MEMBERUID" -y)
|
||||||
sleep 5
|
sleep 5
|
||||||
back=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$LIMIT" --output="$NODEPUB" --comment="[G1sms+] Wallet DESTROY Send $LIMIT To NODE" -y)
|
back=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$NODEPUB" --amount "$LIMIT" --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
|
# TODO DEBUG :: echo $PAY
|
||||||
|
if [[ "$(echo $PAY | grep 'successful')" != "" && "$PAY" != "" && "$(echo $back | grep 'successful')" != "" ]]; then
|
||||||
# DESTROY FILESYSTEM AND G1sms WALLET SWARM REFERENCE
|
# DESTROY FILESYSTEM AND G1sms WALLET SWARM REFERENCE
|
||||||
if [[ "$PHONE" != "" ]]; then
|
if [[ "$PHONE" != "" ]]; then
|
||||||
# SEND SMS BEFORE DELETE FOLDER
|
# SEND SMS BEFORE DELETE FOLDER
|
||||||
|
@ -55,12 +57,11 @@ $back"
|
||||||
sms_SEND "$PHONE" "$mess"
|
sms_SEND "$PHONE" "$mess"
|
||||||
|
|
||||||
rm -Rf ~/.zen/g1sms_wallets/$PHONE;
|
rm -Rf ~/.zen/g1sms_wallets/$PHONE;
|
||||||
rm -Rf ~/.zen/g1sms_wallets_swarm/$PHONE;
|
rm -Rf ~/.zen/ipfs/$(echo -n $PHONE | sha256sum | cut -d ' ' -f 1)@$(echo -n $MASTERPHONE | sha256sum | cut -d ' ' -f 1)
|
||||||
log "__SUB:sms_DESTROY.sh: WALLET DESTROYED : $PHONE / $UIDNA / $MEMBER : ${c_green}OK$c_"
|
log "__SUB:sms_DESTROY.sh: WALLET DESTROYED : $PHONE / $UIDNA / $MEMBER : ${c_green}OK$c_"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
new=$(./checknodes.sh "BAN")
|
sms_ERROR "$PHONE" "Problème de payement $PAY";
|
||||||
sms_ERROR "$PHONE" "Problème de payement avec silkaj (changement de serveur $new): $PAY";
|
|
||||||
log "${c_red}__SUB:sms_DESTROY.sh: END WITH ERRORS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~$c_"
|
log "${c_red}__SUB:sms_DESTROY.sh: END WITH ERRORS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~$c_"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 1.0
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
################################################################################
|
################################################################################
|
||||||
# sudo apt install ssmtp mpack
|
# sudo apt install ssmtp mpack
|
||||||
|
@ -16,7 +16,7 @@ log "__SUB:sms_EMAIL.sh.sh: START ($1=phone, $2=mail)"
|
||||||
phone="$1"
|
phone="$1"
|
||||||
mail="$2"
|
mail="$2"
|
||||||
|
|
||||||
MAILFILE="~/.zen/g1sms_wallets/$phone/$phone.email" # Contains the member EMAIL (Send BILLET)
|
MAILFILE="~/.zen/g1sms_wallets/$phone/_email" # Contains the member EMAIL (Send BILLET)
|
||||||
|
|
||||||
# Initialise PHONE, PIN, PUBKEY, UNIT ...
|
# Initialise PHONE, PIN, PUBKEY, UNIT ...
|
||||||
sms_INIT_ACCOUNT "$phone" "NOSMS"
|
sms_INIT_ACCOUNT "$phone" "NOSMS"
|
||||||
|
@ -30,8 +30,7 @@ if [[ "$mail" != "" ]]; then
|
||||||
echo "$mail" > "$MAILFILE"
|
echo "$mail" > "$MAILFILE"
|
||||||
./natools.py encrypt -p $NODE_G1PUBKEY -i "$MAILFILE" -o "$MAILFILE.node.crypt"
|
./natools.py encrypt -p $NODE_G1PUBKEY -i "$MAILFILE" -o "$MAILFILE.node.crypt"
|
||||||
echo "" > "$MAILFILE"
|
echo "" > "$MAILFILE"
|
||||||
log "__SUB:sms_EMAIL.sh.sh: EMAIL $MEMBER ($PHONE) NOUVEAU: $mail... Publishing to IPFS"
|
log "__SUB:sms_EMAIL.sh.sh: EMAIL $MEMBER ($PHONE) NOUVEAU: $mail..."
|
||||||
ipfs_node_wallets_add
|
|
||||||
else
|
else
|
||||||
mail=$MAIL
|
mail=$MAIL
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 1.0
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
################################################################################
|
################################################################################
|
||||||
source ./init.sh
|
source ./init.sh
|
||||||
source ./functions.sh
|
source ./functions.sh
|
||||||
log "X sms_ERROR.sh ($1=phone, $2=message)"
|
log "X sms_ERROR.sh ($1=phone, $2=message)"
|
||||||
|
|
||||||
MESS="Commande inconnue $2."
|
MESS="BAD CMD $2."
|
||||||
|
|
||||||
# Send response SMS
|
# Send response SMS
|
||||||
$(sms_ERROR "$1" "$MESS")
|
$(sms_ERROR "$1" "$MESS")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.2020
|
# 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/)
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
# == G1tag ==
|
# == G1tag ==
|
||||||
|
@ -94,10 +94,10 @@ fi
|
||||||
###########################################
|
###########################################
|
||||||
# PAY VIR + PERCENT G1
|
# PAY VIR + PERCENT G1
|
||||||
ML=$(bc -l <<< "scale=2; $VIR + $PERCENT")
|
ML=$(bc -l <<< "scale=2; $VIR + $PERCENT")
|
||||||
PAY=$(./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)
|
duniter_server=$(./tools/duniter_getnode.sh)
|
||||||
if [[ "$PAY" == "" || "$(echo $PAY | cut -d '|' -f 1)" == "KO" ]]; then
|
PAY=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$NODE_G1PUBKEY" --amount "$ML" --comment "[G1sms+] ACHAT $3 G1Tag(s) - $2 $UNIT" -y)
|
||||||
# new=$(./checknodes.sh "BAN")
|
if [[ "$(echo $PAY | grep 'successful')" == "" || "$PAY" == "" ]]; then
|
||||||
sms_ERROR "$PHONE" "Il est survenu un problème lors de votre virement: $PAY / Silkaj: $new";
|
sms_ERROR "$PHONE" "$PAY";
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -110,9 +110,12 @@ while [[ $c -lt $NUMBER ]]; do
|
||||||
AA=$(./diceware.sh 6 | xargs); # Nom = Diceware de 6 mots
|
AA=$(./diceware.sh 6 | xargs); # Nom = Diceware de 6 mots
|
||||||
RR=$(echo ${AA} | sed s/\ //g ); # Nom concaténé
|
RR=$(echo ${AA} | sed s/\ //g ); # Nom concaténé
|
||||||
PR=$(echo ${AA} | cut -d ' ' -f 1 ); # Prénom du G1Tag
|
PR=$(echo ${AA} | cut -d ' ' -f 1 ); # Prénom du G1Tag
|
||||||
# Create Unique G1tag in all SWARM!
|
# Create Unique G1tag in all SWARM! TODO hash256
|
||||||
while [[ $(ls ~/.zen/g1sms_wallets_swarm/.Qm*/TAG/${RR}) ]]; do
|
# ~/.zen/ipfs/$(echo -n $PHONE | sha256sum | cut -d ' ' -f 1)@$(echo -n $MASTERPHONE | sha256sum | cut -d ' ' -f 1)
|
||||||
|
SHAA=$(echo -n $AA | sha256sum | cut -d ' ' -f 1)
|
||||||
|
while [[ $(ls ~/.zen/ipfs_swarm/${SHAA}@*/_uidna) ]]; do
|
||||||
AA=$(./diceware.sh 6 | xargs); RR=$(echo ${AA} | sed s/\ //g ); PR=$(echo ${AA} | cut -d ' ' -f 1 );
|
AA=$(./diceware.sh 6 | xargs); RR=$(echo ${AA} | sed s/\ //g ); PR=$(echo ${AA} | cut -d ' ' -f 1 );
|
||||||
|
SHAA=$(echo -n $AA | sha256sum | cut -d ' ' -f 1)
|
||||||
done
|
done
|
||||||
# Clef de chiffrage PGP imprimée sur le QRCode BJ
|
# Clef de chiffrage PGP imprimée sur le QRCode BJ
|
||||||
BB=$(date +%N | sha256sum | base64 | head -c 32) #YjY4MDc3OTVjNmUxN2JhYWVjYmU3MDcy
|
BB=$(date +%N | sha256sum | base64 | head -c 32) #YjY4MDc3OTVjNmUxN2JhYWVjYmU3MDcy
|
||||||
|
|
|
@ -17,7 +17,7 @@ if [[ "$MEMBERUID" != "" && "$MEMBERUID" != "N" && "$MEMBERUID" != "D" && "$MEMB
|
||||||
# UID RECEIVED in SMS
|
# UID RECEIVED in SMS
|
||||||
VIRDEST=$MEMBERUID
|
VIRDEST=$MEMBERUID
|
||||||
MEMRIB=$(sms_uid2key "$MEMBERUID" "$PHONE" "$PIN")
|
MEMRIB=$(sms_uid2key "$MEMBERUID" "$PHONE" "$PIN")
|
||||||
if [[ $MEMRIB == "" ]]; then exit; fi
|
[[ $MEMRIB == "" ]] && exit 1
|
||||||
MEMBER="$MEMBERUID"
|
MEMBER="$MEMBERUID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -31,24 +31,15 @@ UNIT=${countvalues[2]}
|
||||||
|
|
||||||
mess="[G1sms+]
|
mess="[G1sms+]
|
||||||
Id: $UIDNA
|
Id: $UIDNA
|
||||||
|
$PIN
|
||||||
|
|
||||||
Solde: $AMOUNT $UNIT
|
Solde: $AMOUNT $UNIT
|
||||||
DAB: $DABID
|
(DAB: $DABID)
|
||||||
---
|
"
|
||||||
https://cesium.app
|
|
||||||
* Identifiant ="
|
|
||||||
sms_SEND "$PHONE" "$mess"
|
sms_SEND "$PHONE" "$mess"
|
||||||
sleep 2
|
sleep 2
|
||||||
sms_SEND "$PHONE" "$PHONE"
|
|
||||||
sleep 2
|
|
||||||
sms_SEND "$PHONE" "* Mot de passe ="
|
|
||||||
sleep 2
|
|
||||||
sms_SEND "$PHONE" "$PIN"
|
|
||||||
sleep 2
|
|
||||||
sms_SEND "$PHONE" "* Clef Publique (RIB) ="
|
|
||||||
sleep 2
|
|
||||||
sms_SEND "$PHONE" "$PUBKEY"
|
sms_SEND "$PHONE" "$PUBKEY"
|
||||||
sleep 2
|
[[ $MEMRIB != "" ]] && sms_SEND "$PHONE" "Compte Atttaché: $MEMBER $MAIL
|
||||||
[[ $MEMRIB != "" ]] && sms_SEND "$PHONE" "Compte relié? $MEMBER $MAIL
|
|
||||||
$MEMRIB"
|
$MEMRIB"
|
||||||
|
|
||||||
# Add contact to database
|
# Add contact to database
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 1.0
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
################################################################################
|
################################################################################
|
||||||
source ./init.sh
|
source ./init.sh
|
||||||
|
@ -16,7 +16,7 @@ sms_INIT_ACCOUNT "$phone" "NOSMS"
|
||||||
pin=$PIN
|
pin=$PIN
|
||||||
if [[ $UNKNOWN == "unknown" ]]; then
|
if [[ $UNKNOWN == "unknown" ]]; then
|
||||||
sms_ERROR "$phone" "Porte-monnaie inconnu. Envoyez N (suivi de votre Pseudo membre) pour le créer."
|
sms_ERROR "$phone" "Porte-monnaie inconnu. Envoyez N (suivi de votre Pseudo membre) pour le créer."
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
|
@ -29,8 +29,8 @@ VIR=${accounting[1]}
|
||||||
PERCENT=${accounting[2]}
|
PERCENT=${accounting[2]}
|
||||||
CHARGE=${accounting[3]}
|
CHARGE=${accounting[3]}
|
||||||
if [[ $testmin -eq 0 ]]; then
|
if [[ $testmin -eq 0 ]]; then
|
||||||
sms_ERROR "$phone" "Solde de votre Porte-monnaie G1sms insuffisant. Minimum: $CHARGE G1! Rechargez avec https://Cesium.app"
|
sms_ERROR "$phone" "Solde de votre Porte-monnaie G1sms insuffisant. Minimum: $CHARGE G1! Rechargez avec https://cesium.app"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add COUNTRY code to PHONEDEST + PHONEDEST INIT
|
# Add COUNTRY code to PHONEDEST + PHONEDEST INIT
|
||||||
|
@ -38,10 +38,10 @@ PHONEDEST="$COUNTRY${PHONEDEST:1:10}"
|
||||||
|
|
||||||
HPHONE=$(echo -n $PHONEDEST | sha256sum | cut -d ' ' -f 1)
|
HPHONE=$(echo -n $PHONEDEST | sha256sum | cut -d ' ' -f 1)
|
||||||
# CHECK if PHONEDEST have an account in IPFS G1sms+ SWARM
|
# CHECK if PHONEDEST have an account in IPFS G1sms+ SWARM
|
||||||
if [[ -f ~/.zen/ipfs_swarm/.Qm*/G1SMS/$HPHONE/_pub ]]
|
if [[ -f ~/.zen/ipfs_swarm/G1SMS/$HPHONE@*/_pub ]]
|
||||||
then
|
then
|
||||||
PUBKEYDEST=$(cat ~/.zen/ipfs_swarm/.Qm*/G1SMS/$HPHONE/_pub)
|
PUBKEYDEST=$(cat ~/.zen/ipfs_swarm/G1SMS/$HPHONE@*/_pub)
|
||||||
UNITDEST=$(cat ~/.zen/ipfs_swarm/.Qm*/G1SMS/$HPHONE/_unit)
|
UNITDEST=$(cat ~/.zen/ipfs_swarm/G1SMS/$HPHONE@*/_unit)
|
||||||
else
|
else
|
||||||
# NO, then create NEW Wallet
|
# NO, then create NEW Wallet
|
||||||
sms_INIT_ACCOUNT "$PHONEDEST"
|
sms_INIT_ACCOUNT "$PHONEDEST"
|
||||||
|
@ -50,22 +50,22 @@ else
|
||||||
UNITDEST="$UNIT"
|
UNITDEST="$UNIT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
duniter_server=$(./tools/duniter_getnode.sh)
|
||||||
# Payement
|
# Payement
|
||||||
PAY=$(./timeout.sh -t 20 ./silkaj/silkaj transaction --auth-scrypt -salt="$phone" -password="$pin" --amount="$VIR" --output="$PUBKEYDEST" --comment="[G1sms+] PAY" -y)
|
PAY=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$PUBKEYDEST" --amount "$VIR" --comment "[G1sms+] PAY" -y)
|
||||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" == "KO" || "$PAY" == "" ]]; then
|
if [[ "$(echo $PAY | grep 'successful')" == "" || "$PAY" == "" ]]; then
|
||||||
sms_ERROR "$phone" "Problème de payement avec silkaj (changement de serveur $new): $PAY";
|
sms_ERROR "$phone" "Problème de payement $PAY";
|
||||||
log "__SUB:sms_PAY.sh: Problème de payement avec silkaj $new : $PAY"
|
log "__SUB:sms_PAY.sh: Problème $PAY"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# + G1SMS Commission
|
# + G1SMS Commission
|
||||||
COM=$(./timeout.sh -t 20 ./silkaj/silkaj transaction --auth-scrypt -salt="$phone" -password="$pin" --amount="$PERCENT" --output="$NODE_G1PUBKEY" --comment="[G1sms+] Commission" -y)
|
COM=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$NODE_G1PUBKEY" --amount "$PERCENT" --comment "[G1sms+] Commission" -y)
|
||||||
if [[ "$(echo $COM | cut -d '|' -f 1)" == "KO" || "$PAY" == "" ]]; then
|
if [[ "$(echo $COM | grep 'successful')" == "" || "$PAY" == "" ]]; then
|
||||||
new=$(./checknodes.sh "BAN")
|
sms_ERROR "$phone" "Problème de payement $COM";
|
||||||
sms_ERROR "$phone" "Problème de payement avec silkaj (changement de serveur $new): $COM";
|
log "__SUB:sms_PAY.sh: Problème $COM"
|
||||||
log "__SUB:sms_PAY.sh: Problème de payement avec silkaj $new : $COM"
|
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ sms_SEND "$phone" "$mess_src"
|
||||||
|
|
||||||
# Send dest SMS
|
# Send dest SMS
|
||||||
mess_dest="[G1sms+] Bonjour.
|
mess_dest="[G1sms+] Bonjour.
|
||||||
Un(e) ami(e) ($phone) vient de vous envoyer $VIR G1 sur votre portefeuille G1sms!
|
Un(e) ami(e) ($phone) vient de vous envoyer $VIR G1 sur votre portefeuille G1SMS!
|
||||||
Envoyez D pour (D)étail.
|
Envoyez D pour (D)étail.
|
||||||
A pour (A)ide..."
|
A pour (A)ide..."
|
||||||
sms_SEND "$PHONEDEST" "$mess_dest"
|
sms_SEND "$PHONEDEST" "$mess_dest"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 1.0
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
# RECORD RECURRENT PAYEMENTS WITH "Cesium+ ID" Pubkey TODO cron ~/.zen/g1sms_wallets/$PHONE/VIREMENTS, Fusion avec sms_VIR.sh
|
# RECORD RECURRENT PAYEMENTS WITH "Cesium+ ID" Pubkey TODO cron ~/.zen/g1sms_wallets/$PHONE/VIREMENTS, Fusion avec sms_VIR.sh
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -74,44 +74,47 @@ if [[ "$VIRDEST" == "" || "$VIRDEST" == "$MEMBER" ]]; then
|
||||||
# VIR TO MEMBER PHONE OWNER
|
# VIR TO MEMBER PHONE OWNER
|
||||||
DESTMEM="$MEMBER"
|
DESTMEM="$MEMBER"
|
||||||
DESTRIB="$MEMRIB"
|
DESTRIB="$MEMRIB"
|
||||||
log "__SUB:sms_REC.sh: SEND TO MEMBER related wallet!!! $DESTRIB "
|
log "__SUB:sms_VIR.sh: SEND TO MEMBER related wallet!!! $DESTRIB "
|
||||||
else
|
else
|
||||||
log "__SUB:sms_REC.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" ~/.zen/g1sms_wallets/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
|
LOCAL=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets/*/_uidname | tail -n 1 | cut -f 6 -d '/')
|
||||||
if [[ "$LOCAL" == "" ]]; then LOCAL=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
|
if [[ "$LOCAL" == "" ]]; then LOCAL=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets/*/_uidna | tail -n 1 | cut -f 6 -d '/'); fi
|
||||||
if [[ "$LOCAL" != "" ]]; then
|
if [[ "$LOCAL" != "" ]]; then
|
||||||
# LOCAL G1sms account
|
# LOCAL G1sms account
|
||||||
DESTRIB=$(cat ~/.zen/g1sms_wallets/$LOCAL/$LOCAL.pub)
|
DESTRIB=$(cat ~/.zen/g1sms_wallets/$LOCAL/_pub)
|
||||||
DESTPHONE=$LOCAL
|
DESTPHONE=$LOCAL
|
||||||
log "__SUB:sms_REC.sh: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)"
|
log "__SUB:sms_VIR.sh: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)"
|
||||||
else
|
else
|
||||||
|
|
||||||
|
##################### REWRITE TODO
|
||||||
# SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA)
|
# SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA)
|
||||||
INSWARM=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
|
# INSWARM=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
|
||||||
if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
|
# if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
|
||||||
if [[ "$INSWARM" != "" ]]; then
|
# if [[ "$INSWARM" != "" ]]; then
|
||||||
REMOTENODE=$(cat ~/.zen/g1sms_wallets_swarm/$INSWARM/MASTERPHONE.sms)
|
# REMOTENODE=$(cat ~/.zen/g1sms_wallets_swarm/$INSWARM/MASTERPHONE.sms)
|
||||||
DESTRIB=$(cat ~/.zen/g1sms_wallets_swarm/$INSWARM/$INSWARM.pub)
|
# DESTRIB=$(cat ~/.zen/g1sms_wallets_swarm/$INSWARM/$INSWARM.pub)
|
||||||
DESTPHONE=$INSWARM
|
# DESTPHONE=$INSWARM
|
||||||
log "__SUB:sms_REC.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)"
|
# log "__SUB:sms_VIR.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)"
|
||||||
else
|
# else
|
||||||
|
##################### REWRITE TODO
|
||||||
# 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}')
|
||||||
log "__SUB:sms_REC.sh: OUT OFF SWARM MEMBER wallet: $DESTRIB"
|
log "__SUB:sms_VIR.sh: OUT OFF SWARM MEMBER wallet: $DESTRIB"
|
||||||
fi
|
# fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ADD DATES TO VIREMENTS
|
# ADD DATES TO VIREMENTS
|
||||||
if [[ "$DESTRIB" != "" ]]; then
|
if [[ "$DESTRIB" != "" ]]; then
|
||||||
|
duniter_server=$(./tools/duniter_getnode.sh)
|
||||||
log "__SUB:sms_REC.sh: TRAITEMENT DU VIREMENT DE $AMOUNT $UNIT = 1ER VIREMENT de $VIR G1 vers $VIRDEST ($DESTRIB) $TIME FOIS. OK..."
|
log "__SUB:sms_REC.sh: TRAITEMENT DU VIREMENT DE $AMOUNT $UNIT = 1ER VIREMENT de $VIR G1 vers $VIRDEST ($DESTRIB) $TIME FOIS. OK..."
|
||||||
PAY=$(./timeout.sh -t 20 ./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$VIR" --output="$DESTRIB" --comment="[G1sms+] REC 1/$TIME ($PERIOD)" -y)
|
PAY=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$DESTRIB" --amount "$VIR" --comment "[G1sms+] REC 1/$TIME ($PERIOD)" -y)
|
||||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" == "KO" || "$PAY" == "" ]]; then
|
if [[ "$(echo $PAY | grep 'successful')" == "" || "$PAY" == "" ]]; then
|
||||||
new=$(./checknodes.sh "BAN")
|
sms_ERROR "$PHONE" "Problème de payement $PAY";
|
||||||
sms_ERROR "$PHONE" "Problème de payement avec silkaj (changement de serveur $new): $PAY";
|
|
||||||
log "__SUB:sms_REC.sh: END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
log "__SUB:sms_REC.sh: END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
log "__SUB:sms_REC.sh: UPDATE ~/.zen/g1sms_wallets/$PHONE/VIREMENTS with FUTURE PAYEMENTS? $PAY"
|
log "__SUB:sms_REC.sh: UPDATE ~/.zen/g1sms_wallets/$PHONE/VIREMENTS with FUTURE PAYEMENTS? $PAY"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 1.0
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
################################################################################
|
################################################################################
|
||||||
source ./init.sh
|
source ./init.sh
|
||||||
|
@ -10,7 +10,7 @@ log "X sms_SETUNIT.sh ($1=phone, $2=unit)"
|
||||||
|
|
||||||
phone="$1"
|
phone="$1"
|
||||||
unit="$2"
|
unit="$2"
|
||||||
UNITFILE="~/.zen/g1sms_wallets/$phone/$phone.unit"
|
UNITFILE="~/.zen/g1sms_wallets/$phone/_unit"
|
||||||
|
|
||||||
# Initialise PHONE, PIN, PUBKEY, UNIT, HIST
|
# Initialise PHONE, PIN, PUBKEY, UNIT, HIST
|
||||||
sms_INIT_ACCOUNT "$phone" "NOSMS"
|
sms_INIT_ACCOUNT "$phone" "NOSMS"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 1.0
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
################################################################################
|
################################################################################
|
||||||
source ./init.sh
|
source ./init.sh
|
||||||
|
@ -20,8 +20,8 @@ if [[ "$AMOUNT" == "" ]]; then
|
||||||
sms_ERROR "$phone" "Montant incorrect!!
|
sms_ERROR "$phone" "Montant incorrect!!
|
||||||
Ex:
|
Ex:
|
||||||
VIR 100, pour virer 100 $UNIT vers votre compte relié.
|
VIR 100, pour virer 100 $UNIT vers votre compte relié.
|
||||||
VIR 100 $ADMINPSEUDO, pour virer 100 $UNIT au membre administrateur de ce NODE G1sms+ ;)"
|
VIR 100 $ADMINPSEUDO, pour virer 100 $UNIT à $ADMINPSEUDO"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
|
@ -48,38 +48,40 @@ 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" ~/.zen/g1sms_wallets/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
|
LOCAL=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets/*/_uidname | tail -n 1 | cut -f 6 -d '/')
|
||||||
if [[ "$LOCAL" == "" ]]; then LOCAL=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
|
if [[ "$LOCAL" == "" ]]; then LOCAL=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets/*/_uidna | tail -n 1 | cut -f 6 -d '/'); fi
|
||||||
if [[ "$LOCAL" != "" ]]; then
|
if [[ "$LOCAL" != "" ]]; then
|
||||||
# LOCAL G1sms account
|
# LOCAL G1sms account
|
||||||
DESTRIB=$(cat ~/.zen/g1sms_wallets/$LOCAL/$LOCAL.pub)
|
DESTRIB=$(cat ~/.zen/g1sms_wallets/$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
|
||||||
|
|
||||||
|
##################### REWRITE TODO
|
||||||
# SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA)
|
# SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA)
|
||||||
INSWARM=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
|
# INSWARM=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
|
||||||
if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
|
# if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
|
||||||
if [[ "$INSWARM" != "" ]]; then
|
# if [[ "$INSWARM" != "" ]]; then
|
||||||
REMOTENODE=$(cat ~/.zen/g1sms_wallets_swarm/$INSWARM/MASTERPHONE.sms)
|
# REMOTENODE=$(cat ~/.zen/g1sms_wallets_swarm/$INSWARM/MASTERPHONE.sms)
|
||||||
DESTRIB=$(cat ~/.zen/g1sms_wallets_swarm/$INSWARM/$INSWARM.pub)
|
# DESTRIB=$(cat ~/.zen/g1sms_wallets_swarm/$INSWARM/$INSWARM.pub)
|
||||||
DESTPHONE=$INSWARM
|
# DESTPHONE=$INSWARM
|
||||||
log "__SUB:sms_VIR.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)"
|
# log "__SUB:sms_VIR.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)"
|
||||||
else
|
# else
|
||||||
|
##################### REWRITE TODO
|
||||||
# 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}')
|
||||||
log "__SUB:sms_VIR.sh: OUT OFF SWARM MEMBER wallet: $DESTRIB"
|
log "__SUB:sms_VIR.sh: OUT OFF SWARM MEMBER wallet: $DESTRIB"
|
||||||
fi
|
# fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ "$DESTRIB" != "" ]]; then
|
if [[ "$DESTRIB" != "" ]]; then
|
||||||
PAY=$(./timeout.sh -t 30 ./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$VIR" --output="$DESTRIB" --comment="[G1sms+] VIR $VIR G1" -y)
|
duniter_server=$(./tools/duniter_getnode.sh)
|
||||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" && "$PAY" != "" ]]; then
|
PAY=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$DESTRIB" --amount "$VIR" --comment "[G1sms+] VIR $VIR G1" -y)
|
||||||
|
if [[ "$(echo $PAY | grep 'successful')" != "" && "$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
|
||||||
Virement de $AMOUNT $UNIT ($VIR G1)
|
|
||||||
vers $DESTMEM ($DESTRIB)
|
|
||||||
OK!
|
|
||||||
$PAY"
|
$PAY"
|
||||||
sms_SEND "$PHONE" "$mess"
|
sms_SEND "$PHONE" "$mess"
|
||||||
log_history "$PHONE" "VIR, $VIR, $DESTRIB, $DESTMEM"
|
log_history "$PHONE" "VIR, $VIR, $DESTRIB, $DESTMEM"
|
||||||
|
@ -88,8 +90,7 @@ $PAY"
|
||||||
sms_SEND "$DESTPHONE" "Bonjour $DESTMEM. Vous venez de recevoir un virement de $AMOUNT $UNIT ($VIR G1) de la part de $member portefeuille $UIDNA"
|
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
|
||||||
else
|
else
|
||||||
new=$(./checknodes.sh "BAN")
|
sms_SEND "$ADMINPHONE" "$PAY";
|
||||||
sms_SEND "$ADMINPHONE" "ADMIN! Problème de payement avec silkaj (changement de serveur $new): $PAY";
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log "__SUB:sms_VIR.sh: ERROR $MEMBER: $DESTMEM DESTRIB NOT FOUND"
|
log "__SUB:sms_VIR.sh: ERROR $MEMBER: $DESTMEM DESTRIB NOT FOUND"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 1.0
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
################################################################################
|
################################################################################
|
||||||
# is there ADMINPSEUDO-UIDNATAIL in ~/.zen/g1sms_wallets_swarm/.*/*.uidna ?"
|
# is there ADMINPSEUDO-UIDNATAIL in ~/.zen/g1sms_wallets_swarm/.*/*.uidna ?"
|
||||||
|
@ -21,17 +21,17 @@ Envoyez N pour créer votre portefeuille G1sms"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$askeduidna" == "" ]]; then #SELF
|
if [[ "$askeduidna" == "" ]]; then #SELF
|
||||||
if [[ -f "~/.zen/ipfs/.$IPFSNODEID/$IPFSNODEID.uidna" ]]; then
|
if [[ -f "~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna" ]]; then
|
||||||
nodeuidnafile="~/.zen/ipfs/.$IPFSNODEID/$IPFSNODEID.uidna"
|
nodeuidnafile="~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna"
|
||||||
uidna=$(cat $nodeuidnafile)
|
uidna=$(cat $nodeuidnafile)
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
nodeuidnafile=$(grep -Rwl "$askeduidna" ~/.zen/ipfs_swarm/.*/G1*/_uidna)
|
nodeuidnafile=$(grep -Rwl "$askeduidna" ~/.zen/ipfs_swarm/.*/G1SSB/_uidna)
|
||||||
uidna=$(cat $nodeuidnafile)
|
uidna=$(cat $nodeuidnafile)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f $nodeuidnafile && "$uidna" != "" ]]; then
|
if [[ -f $nodeuidnafile && "$uidna" != "" ]]; then
|
||||||
ipfsnodeid=$(echo $nodeuidnafile | cut -d '/' -f 3 | cut -d '.' -f 2 )
|
ipfsnodeid=$(echo $nodeuidnafile | cut -d '/' -f 6 | cut -d '.' -f 2 )
|
||||||
echo $uidna > ~/.zen/g1sms_wallets/$PHONE/uidna.G1TAGNODE
|
echo $uidna > ~/.zen/g1sms_wallets/$PHONE/uidna.G1TAGNODE
|
||||||
echo $ipfsnodeid > ~/.zen/g1sms_wallets/$PHONE/ipfsid.G1TAGNODE
|
echo $ipfsnodeid > ~/.zen/g1sms_wallets/$PHONE/ipfsid.G1TAGNODE
|
||||||
log "__SUB:sms_WHERE.sh: Distributeur de G1Tag $uidna : $ipfsnodeid "
|
log "__SUB:sms_WHERE.sh: Distributeur de G1Tag $uidna : $ipfsnodeid "
|
||||||
|
@ -44,9 +44,9 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mess="[G1sms+] $MEMBER
|
mess="[G1sms+] $MEMBER
|
||||||
Votre distributeur de G1Tag par défaut est
|
Votre distributeur G1DAB est
|
||||||
$uidna ($ipfsnodeid), situé:
|
$uidna ($ipfsnodeid), situé:
|
||||||
$(cat ~/.zen/g1sms_wallets_swarm/.$ipfsnodeid/$ipfsnodeid.where)"
|
$(cat ~/.zen/ipfs_swarm/.$ipfsnodeid/G1SSB/_where)"
|
||||||
|
|
||||||
sms_SEND "$PHONE" "$mess"
|
sms_SEND "$PHONE" "$mess"
|
||||||
|
|
||||||
|
|
|
@ -1,164 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
################################################################################
|
|
||||||
# Author: Fred (support@qo-op.com)
|
|
||||||
# Version: 0.1
|
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
||||||
###########################################################################################
|
|
||||||
# LOAD MUSIC FILE IN G1TAG... + SHELL OPCODE INJECTED INTO G1TAG
|
|
||||||
# sudo pip3 install duniterpy
|
|
||||||
###########################################################################################
|
|
||||||
# ipfs ls /ipns/QmY6ooFcsGXY4VSindqKMz9GvrprFXY32RrsTmqvVTYQX5
|
|
||||||
# QmZ3RfWk1u5LEGYLHA633B5TNJy3Du27K6Fny9wcxpowGS 4 TAG_amount
|
|
||||||
# QmXizDydPuiBd1V7JBVY5kdppShm9xdk2aoYj7c8V8Foxe 47 TAG_chain
|
|
||||||
# QmeHHBZKtLJHr11rwXKeimwDE4i3nLMy2VPkWZsNaFasg1 4 TAG_currency
|
|
||||||
# QmSjBDpjnoxnQT5RWRnyLxqwE3ovSRVb7xjwZoiufZAv3E 39 TAG_id
|
|
||||||
# QmUQcSjQx2bg4cSe2rUZyQi6F8QtJFJb74fWL7D784UWf9 2 TAG_n
|
|
||||||
# QmdbdBWv4SygqaaeWHAvABiQAa3faf4ncfSyzRnx8BDdCc 20 TAG_nanodate
|
|
||||||
# QmbN6gNM2vjLj7yaJ6xJcySDxmuSK2eB9ZDv5dpj2bo5pM 47 TAG_nodeid
|
|
||||||
# QmXaMzRqhEs4cQMRN18FWaCeqGmrDBfV8hTkbfQuBCXnnA 1243 TAG_publishkey.swarm.crypt
|
|
||||||
# QmWHsRZCTSjSxnp1Qm8WcmHNNQTJwDS2ukLE7NTccc3Kp9 1304 TAG_publishkey.B.gpg
|
|
||||||
# TAG_passenger, TAG_file is used to attach G1Tag to file.
|
|
||||||
# ADD A PASSENGER FILE (Web2.0ID) INTO a G1Tag + Add INIT credit/debit values to live in SWARM.
|
|
||||||
# GRAB a G1Tag CAPSULE + PUT A PASSENGER MUSIC FILE IN IT
|
|
||||||
#### TODO USE "ipfs dag" + json
|
|
||||||
# {
|
|
||||||
# "type": "REC_YOUTUBE",
|
|
||||||
# "search": "${MUSICFILE}",
|
|
||||||
# "id": "vLXHXGoXuBU",
|
|
||||||
# "title": "Tale Of Us - Oliver Koletzki - Miss Monique - More Artist • New Life III (DifferentSound Mix)",
|
|
||||||
# "size": 123,
|
|
||||||
# "debit": 10,
|
|
||||||
# "credit": 1,
|
|
||||||
# "file": {
|
|
||||||
# "ld": "LDhashIPFS",
|
|
||||||
# "sd": "SDhashIPFS",
|
|
||||||
# "hd": "HDhashIPFS"
|
|
||||||
# },
|
|
||||||
# "g1tag": "RR",
|
|
||||||
# "ipns": "J",
|
|
||||||
# "ld": "ZEN",
|
|
||||||
# "sd": "ZEN",
|
|
||||||
# "hd": "EUR"
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
#############################################################################################################
|
|
||||||
# ./tag_LOAD_passenger.sh G1TagIPNS FileID MusicFile MASTERKEY
|
|
||||||
JSOURCE=$1
|
|
||||||
TUBEID=$2
|
|
||||||
MUSICFILE=$3
|
|
||||||
KEYFILE=$4
|
|
||||||
# EXTENSION (Define Debit for Hosting / Credit for Reading)
|
|
||||||
DEB=$5
|
|
||||||
CRED=$6
|
|
||||||
if [[ ! $DED ]]; then DED=10; fi
|
|
||||||
if [[ ! $CRED ]]; then CRED=1; fi
|
|
||||||
if [[ ! -f "$KEYFILE" || ! -f "$MUSICFILE" || ! -f "./g1sms.pub.key" ]]; then "Do you know what you are doing? MUSICFILE=$MUSICFILE? KEYFILE=$KEYFILE?"; exit; fi
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
############## INIT & root check
|
|
||||||
NANODATE=$(date -u +%s%N)
|
|
||||||
echo "__SUB:tag_LOAD_passenger.sh: LOAD \"$MUSICFILE\" into REC G1Tag $JSOURCE indexed by $TUBEID (using $KEYFILE)... $NANODATE"
|
|
||||||
if [[ "$USER" != "root" ]]; then echo "__SUB:tag_LOAD_passenger.sh: Hey, $USER you must be root. 'sudo ./tag_LOAD_passenger.sh ...' ?"; exit; fi
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
############## CHECK ipfs daemon user
|
|
||||||
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
|
||||||
if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "__SUB:tag_LOAD_passenger.sh: BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $YOU !"; exit; fi
|
|
||||||
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
|
||||||
|
|
||||||
######################################################
|
|
||||||
############## EXTRACT $JSOURCERR key, amount, nodeid
|
|
||||||
JSOURCERR=$(su $YOU -c "ipfs cat /ipns/$JSOURCE/TAG_id | sed s/\ //g");
|
|
||||||
if [[ "$JSOURCERR" == "" ]]; then echo "__SUB:tag_LOAD_passenger.sh: G1TAG DETRUIT. Aucun G1Tag /ipns/$JSOURCERR ici... Ciao."; exit; fi
|
|
||||||
mkdir -p ./TAG/${JSOURCERR}; rm -f ./TAG/${JSOURCERR}/*
|
|
||||||
echo "__SUB:tag_LOAD_passenger.sh: LOG. Hey You get a G1Tag!! GET IT now: ipfs get --output=./TAG/${JSOURCERR}/ /ipns/$JSOURCE"
|
|
||||||
chown -R $YOU ./TAG/${JSOURCERR}/
|
|
||||||
su $YOU -c "ipfs get --output=./TAG/${JSOURCERR}/ /ipns/$JSOURCE" 2>&1
|
|
||||||
JSOURCEPUBLISHKEY="./TAG/${JSOURCERR}/TAG_publishkey.swarm.crypt"
|
|
||||||
JSOURCEVALUE=$(cat ./TAG/${JSOURCERR}/TAG_amount)
|
|
||||||
TAGNODEID=$(cat ./TAG/${JSOURCERR}/TAG_nodeid)
|
|
||||||
TAGPASSENGER="./TAG/${JSOURCERR}/TAG_passenger" # contains HASH for PASSENGER FILE (CRYPT & PUBLISH)
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# CAN IT LOAD PASSENGER ?
|
|
||||||
if [[ ! -f $TAGPASSENGER ]]; then
|
|
||||||
echo "__SUB:tag_LOAD_passenger.sh: G1TAG transmis pas encore transformé en REC TAG... Ciao $YOU !";
|
|
||||||
exit
|
|
||||||
else
|
|
||||||
passenger=$(cat $TAGPASSENGER)
|
|
||||||
if [[ "$passenger" != "READY" ]]; then echo "__SUB:tag_LOAD_passenger.sh: REC TAG not READY ($passenger)!"; exit; # COMMENT TO ALLOW REWRITE
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# ONLY CREATOR NODE CAN LOAD G1TAG
|
|
||||||
if [[ "$IPFSNODEID" != "$TAGNODEID" ]]; then
|
|
||||||
echo "__SUB:tag_LOAD_passenger.sh: Ce G1Tag est géré par $TAGNODEID (vous êtes $IPFSNODEID)"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
############## EXTRACT $JSOURCERR PUBLISH KEY
|
|
||||||
if [[ -f "$KEYFILE" ]]; then
|
|
||||||
./natools.py decrypt -k "$KEYFILE" -i "$JSOURCEPUBLISHKEY" -o "~/.ipfs/keystore/$JSOURCERR"
|
|
||||||
else
|
|
||||||
echo "__SUB:tag_LOAD_passenger.sh: KO. La clef $KEYFILE fournie pour ce G1Tag $JSOURCERR est inexistante. Procurez-vous un portefeuille monnaie libre sur https://g1sms.fr"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
############## G1TAG OPERATION
|
|
||||||
NN=$(cat ./TAG/${JSOURCERR}/TAG_n); ((NN++)); echo "$NN" > "./TAG/${JSOURCERR}/TAG_n"
|
|
||||||
|
|
||||||
TAGTYPE="./TAG/${JSOURCERR}/TAG_type" # contains PASSENGER TYPE ("" = G1, YOUTUBE, any "REC SRC")
|
|
||||||
TAGPASSENGERID="./TAG/${JSOURCERR}/TAG_passenger_id" # contains PASSENGER ID (depending TYPE) YoutubeID,
|
|
||||||
|
|
||||||
TAGPASSENGERCRYPT="./TAG/${JSOURCERR}/TAG_passenger.crypt" # contains HASH for PASSENGER FILE natools crypt with MASTERKEY
|
|
||||||
TAGPASSENGERDEBIT="./TAG/${JSOURCERR}/TAG_passenger_debit" # Countains amount Passenger is Paying Daily to SWARM IPFS Nodes (PIN)
|
|
||||||
TAGPASSENGERCREDIT="./TAG/${JSOURCERR}/TAG_passenger_credit" # Countains amount Node G1Tag must pay to PLAY file passenger
|
|
||||||
TAGPASSENGERSIZE="./TAG/${JSOURCERR}/TAG_passenger_size" # contains File Size in Mo
|
|
||||||
|
|
||||||
echo "REC" > $TAGTYPE
|
|
||||||
echo "$TUBEID" > $TAGPASSENGERID
|
|
||||||
|
|
||||||
IFILE=$(su $YOU -c "ipfs add \"${MUSICFILE}\" | tail -n 1")
|
|
||||||
if [[ ! $IFILE ]]; then exit; fi
|
|
||||||
echo "$IFILE" > $TAGPASSENGER
|
|
||||||
# ONLY SWARM KEY CAN DECRYPT IPFS LINK TO FILE (TODO: Glue better)
|
|
||||||
NODE_G1PUBKEY=$(cat "./g1sms.pub.key")
|
|
||||||
./natools.py encrypt -p "$NODE_G1PUBKEY" -i "$TAGPASSENGER" -o "$TAGPASSENGERCRYPT"
|
|
||||||
echo "LOADED" > $TAGPASSENGER
|
|
||||||
|
|
||||||
echo "$DEB" > $TAGPASSENGERDEBIT
|
|
||||||
echo "$CRED" > $TAGPASSENGERCREDIT
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
echo "${NANODATE}" > "./TAG/${JSOURCERR}/TAG_nanodate"
|
|
||||||
I=$(su $YOU -c "ipfs add -qr ./TAG/${JSOURCERR} | tail -n 1")
|
|
||||||
# RECORD TAG_chain And HASH again before publish
|
|
||||||
echo "$I" > "./TAG/${JSOURCERR}/TAG_chain"
|
|
||||||
I=$(su $YOU -c "ipfs add -qr ./TAG/${JSOURCERR} | tail -n 1")
|
|
||||||
# IPNS $JSOURCERR PUBLISH
|
|
||||||
J=$(su $YOU -c "ipfs name publish -k ${JSOURCERR} --quieter /ipfs/${I}")
|
|
||||||
# TODO rm "~/.ipfs/keystore/$JSOURCERR"
|
|
||||||
|
|
||||||
# WRITE FILE REC INDEX IN NODE G1TAG REF.
|
|
||||||
mkdir -p ~/.zen/ipfs/.$IPFSNODEID/TAG/
|
|
||||||
echo "$TUBEID" > "~/.zen/ipfs/.$IPFSNODEID/TAG/${J}.youtubeid"
|
|
||||||
|
|
||||||
##########################
|
|
||||||
# REFRESH SWARM
|
|
||||||
##########################
|
|
||||||
IWALLETS=$(su $YOU -c "ipfs add -rHq '~/.zen/g1sms_wallets' | tail -n 1")
|
|
||||||
|
|
||||||
# CHAIN STATE FOR $IPFSNODEID
|
|
||||||
echo $IWALLETS > ~/.zen/ipfs/.$IPFSNODEID.wallets.chain
|
|
||||||
echo "__SUB:tag_LOAD_passenger.sh: NEW '~/.zen/g1sms_wallets' HASH ipfs ls $IWALLETS"
|
|
||||||
|
|
||||||
# PUBLISH IPNS NODE WALLETS
|
|
||||||
NODEWALLETS=$(su $YOU -c "ipfs name publish --quieter /ipfs/$IWALLETS")
|
|
||||||
echo "__SUB:tag_LOAD_passenger.sh: YOUTUBE REC G1 TAG LOADED ($TAGPASSENGERCRYPT) <<<<<< https://youtube.com/watch?v=$TUBEID"
|
|
||||||
echo "__SUB:tag_LOAD_passenger.sh: ipfs cat /ipns/$NODEWALLETS/.$IPFSNODEID/TAG/${J}.youtubeid"
|
|
||||||
exit
|
|
||||||
echo "__SUB:tag_LOAD_passenger.sh: ZEN BALANCE: $JSOURCEVALUE Zen. HEB: $DEB / PLAY: $CRED"
|
|
||||||
exit
|
|
|
@ -1,68 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
################################################################################
|
|
||||||
# Author: Fred (support@qo-op.com)
|
|
||||||
# Version: 0.1
|
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
||||||
###########################################################################################
|
|
||||||
# Find and PLAY (cat) passenger File OF G1Tag / REC TAG
|
|
||||||
# sudo pip3 install duniterpy
|
|
||||||
# READERID is PHONE or IPFSNODEID (G1 ~/.zen/g1sms_wallets/* )
|
|
||||||
# JSOURCE is G1Tag IPNS link with PASSENGER
|
|
||||||
###########################################################################################
|
|
||||||
READERID=$1
|
|
||||||
JSOURCE=$2
|
|
||||||
KEYFILE="./g1sms.priv.key"
|
|
||||||
NODE_G1PUBKEY=$(cat "./g1sms.pub.key")
|
|
||||||
|
|
||||||
if [[ ! $READERID || ! $JSOURCE || ! -f "$KEYFILE" || ! $NODE_G1PUBKEY ]]; then "Something is wrong! Do you know what you are doing?"; exit; fi
|
|
||||||
|
|
||||||
NODEG1TAG=$(cat "~/.zen/g1sms_wallets_swarm/.$READERID/TAG/$READERID") # Contains IPNS link to Node G1Tag
|
|
||||||
if [[ ! $NODEG1TAG ]]; then
|
|
||||||
# INIT NODE G1TAG WITH 1000 zen
|
|
||||||
echo "__SUB:tag_PLAY_passenger.sh: $READERID ne possède pas de G1Tag sudo ./sms_G1TAG.sh \"$READERID\" \"10\" \"1\" \"NODE\" \"$READERID\" "
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
############## INIT & root check
|
|
||||||
NANODATE=$(date -u +%s%N)
|
|
||||||
echo "__SUB:tag_PLAY_passenger.sh: $READERID IS READING $JSOURCE"
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
############## CHECK ipfs daemon user
|
|
||||||
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
|
||||||
if [[ "$USER" != "root" ]]; then echo "__SUB:tag_PLAY_passenger.sh: Hey, $USER you must able to be root for now (try if sudo access is ok)"; fi
|
|
||||||
if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "__SUB:tag_PLAY_passenger.sh: BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $USER !"; exit; fi
|
|
||||||
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
JSOURCERR=$(su $YOU -c "ipfs cat /ipns/$JSOURCE/TAG_id | sed s/\ //g");
|
|
||||||
if [[ "$JSOURCERR" == "" ]]; then echo "__SUB:tag_PLAY_passenger.sh: G1TAG DETRUIT. Aucun G1Tag /ipns/$JSOURCERR ici... Ciao."; exit; fi
|
|
||||||
mkdir -p ./TAG/${JSOURCERR}; rm -f ./TAG/${JSOURCERR}/*
|
|
||||||
echo "__SUB:tag_PLAY_passenger.sh: FOUND G1Tag... GETTING IT: ipfs get --output=./TAG/${JSOURCERR}/ /ipns/$JSOURCE"
|
|
||||||
chown -R $YOU ./TAG/${JSOURCERR}/
|
|
||||||
su $YOU -c "ipfs get --output=./TAG/${JSOURCERR}/ /ipns/$JSOURCE"
|
|
||||||
JSOURCEPUBLISHKEY="./TAG/${JSOURCERR}/TAG_publishkey.swarm.crypt"
|
|
||||||
|
|
||||||
TAGZEN=$(cat "./TAG/${JSOURCERR}/TAG_amount");
|
|
||||||
DEB=$(cat "./TAG/${JSOURCERR}/TAG_passenger_debit")
|
|
||||||
CRED=$(cat "./TAG/${JSOURCERR}/TAG_passenger_credit")
|
|
||||||
|
|
||||||
##############################################
|
|
||||||
# MAKE TRANSACTIONS
|
|
||||||
NODEZEN=$(cat "~/.zen/g1sms_wallets/$READERID/$READERID.g1cents")
|
|
||||||
uidna=$(cat "~/.zen/g1sms_wallets/$READERID/$READERID.uidna")
|
|
||||||
if [[ $ZEN -gt $CRED ]]; then
|
|
||||||
REZ=$((TAGZEN + CRED))
|
|
||||||
|
|
||||||
#echo "$REZ" > "./TAG/${JSOURCERR}/TAG_amount"
|
|
||||||
# TODO READER NEEDS ITS G1TAG
|
|
||||||
#./tag_OP.sh "$READERIDTAG" "J2TAG" "$CRED" $KEYFILE
|
|
||||||
else
|
|
||||||
echo "Désolé ;( $READERID vous manquez de ZEN ($ZEN) pour vous payer la lecture de $JSOURCE ($CRED)"
|
|
||||||
echo "Rechargez avec un VIREMENT vers $uidna"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# READ PASSENGER
|
|
||||||
|
|
|
@ -23,6 +23,6 @@ path = "/tmp/secret.dunikey"
|
||||||
key = SigningKey.from_credentials(argv[1], argv[2], None)
|
key = SigningKey.from_credentials(argv[1], argv[2], None)
|
||||||
key.save_pubsec_file(path)
|
key.save_pubsec_file(path)
|
||||||
print(
|
print(
|
||||||
"G1 Wallet: ",
|
"",
|
||||||
key.pubkey,
|
key.pubkey,
|
||||||
)
|
)
|
||||||
|
|
|
@ -158,7 +158,7 @@
|
||||||
var currentDate = new Date();
|
var currentDate = new Date();
|
||||||
|
|
||||||
// Set some date in the future.
|
// Set some date in the future.
|
||||||
var futureDate = new Date(2020, 6, 6, 12, 12);
|
var futureDate = new Date(2020, 5, 6, 12, 12);
|
||||||
|
|
||||||
// Calculate the difference in seconds between the future and current date
|
// Calculate the difference in seconds between the future and current date
|
||||||
var diff = futureDate.getTime() / 1000 - currentDate.getTime() / 1000;
|
var diff = futureDate.getTime() / 1000 - currentDate.getTime() / 1000;
|
||||||
|
|
Loading…
Reference in New Issue