forked from axiom-team/astroport
57 lines
1.9 KiB
Bash
Executable File
57 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
################################################################################
|
|
# Author: Fred (support@qo-op.com)
|
|
# Version: 0.1
|
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
################################################################################
|
|
# is there ADMINPSEUDO-UIDNATAIL in ./wallets_swarm/.*/*.uidna ?"
|
|
source ./shell/init.sh
|
|
source ./shell/functions.sh
|
|
log "__SUB:sms_WHERE.sh: START ($1=PHONE $2=askeduidna)"
|
|
|
|
phone="$1"
|
|
askeduidna="$2"
|
|
|
|
# Initialise PHONE, PIN, PUBKEY, UIDNA, UIDNAFILE ...
|
|
sms_INIT_ACCOUNT "$phone" "NOSMS"
|
|
if [[ "$UNKNOWN" == "unknown" ]]; then
|
|
sms_ERROR "$phone" "Porte-monnaie non identifié!
|
|
Envoyez N pour créer votre portefeuille G1sms"
|
|
exit
|
|
fi
|
|
|
|
if [[ "$askeduidna" == "" ]]; then #SELF
|
|
if [[ -f "./wallets/.$IPFSNODEID/$IPFSNODEID.uidna" ]]; then
|
|
nodeuidnafile="./wallets/.$IPFSNODEID/$IPFSNODEID.uidna"
|
|
uidna=$(cat $nodeuidnafile)
|
|
fi
|
|
else
|
|
nodeuidnafile=$(grep -Rwl "$askeduidna" ./wallets_swarm/.*/*.uidna)
|
|
uidna=$(cat $nodeuidnafile)
|
|
fi
|
|
|
|
if [[ -f $nodeuidnafile && "$uidna" != "" ]]; then
|
|
ipfsnodeid=$(echo $nodeuidnafile | cut -d '/' -f 3 | cut -d '.' -f 2 )
|
|
echo $uidna > ./wallets/$PHONE/uidna.G1TAGNODE
|
|
echo $ipfsnodeid > ./wallets/$PHONE/ipfsid.G1TAGNODE
|
|
log "__SUB:sms_WHERE.sh: Distributeur de G1Tag $uidna : $ipfsnodeid "
|
|
I=$(ipfs_node_wallets_add)
|
|
log_history $PHONE "G1TagNode, $uidna, $ipfsnodeid"
|
|
else
|
|
log "__SUB:sms_WHERE.sh: ERROR Distributeur de G1Tag $askeduidna inconnu ???"
|
|
sms_ERROR "$PHONE" "Désolé. Aucun Distributeur de G1Tag : $askeduidna !!!"
|
|
log "__SUB:sms_WHERE.sh: END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
|
exit
|
|
fi
|
|
|
|
mess="[G1sms+] $MEMBER
|
|
Votre distributeur de G1Tag par défaut est
|
|
$uidna ($ipfsnodeid), situé:
|
|
$(cat ./wallets_swarm/.$ipfsnodeid/$ipfsnodeid.where)"
|
|
|
|
sms_SEND "$PHONE" "$mess"
|
|
|
|
|
|
log "__SUB:sms_WHERE.sh: END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
|
exit
|