add nonmbr to geoloc script

This commit is contained in:
poka 2021-10-14 21:56:20 +02:00
parent f2d925f139
commit b5f41b3c4c
1 changed files with 22 additions and 3 deletions

View File

@ -9,8 +9,8 @@ FILE="/tmp/geoloc-members.json"
FINAL_LOCATION="$WEBPATH/data/geoloc-members.json"
DATA_MBR=$($JAKLIS listWallets --brut --mbr)
DATA_LARF=$($JAKLIS listWallets --brut --non_mbr)
DATA_LARF+=$($JAKLIS listWallets --brut --larf)
DATA_NONMBR=$($JAKLIS listWallets --brut --non_mbr)
DATA_LARF=$($JAKLIS listWallets --brut --larf)
echo "$DATA_LARF" > /tmp/tatata
@ -18,6 +18,7 @@ echo "[" > $FILE
oldIFS=$IFS;
IFS=$'\n';
j=0
for i in $DATA_MBR; do
IFS=$oldIFS
pubkey=$(echo $i | awk '{ print $1 }')
@ -34,7 +35,25 @@ for i in $DATA_MBR; do
echo "$resultWithMbr," >> $FILE
fi
done
IFS=$oldIFS
IFS=$'\n'
for i in $DATA_NONMBR; do
IFS=$oldIFS
pubkey=$(echo $i | awk '{ print $1 }')
userId=\"$(echo $i | awk '{ print $2 }')\"
result=$($JAKLIS get -p $pubkey)
geoPoint=$(echo "$result" | jq .geoPoint 2>/dev/null)
if [[ "$geoPoint" == "null" || "$result" == "Profile vide" ]]; then
continue
else
isMbr='"isMember": false,'
userIdFormat="\"userId\": $userId,"
resultWithMbr=$(echo "$result" | sed "s/\"geoPoint\": {/$userIdFormat $isMbr \"geoPoint\": {/g")
echo "$resultWithMbr," >> $FILE
fi
done
for i in $DATA_LARF; do
result=$($JAKLIS get -p $i)