Browse Source

get starsin/starsout from IPNS & correct friend_of_mine_count

pull/38/head
fred 2 months ago
parent
commit
c20da1a995
  1. 11
      zen/gchange_IPFS_swarm.sh

11
zen/gchange_IPFS_swarm.sh

@ -111,8 +111,8 @@ do
# SEND MESSAGE ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" send -d $whoisg1 -t 'Astroport' -m 'Aucun message de ta part https://copylaradio.com'"
## CHECKING STARS FROM IPNS
starsin=$(ipfs --timeout=10s cat /ipns/$ipfsnodeid/.$ipfsnodeid/FRIENDS/$G1PUB/stars.level)
starsout=$(ipfs --timeout=10s cat /ipns/$IPFSNODEID/.$IPFSNODEID/FRIENDS/$whoisg1/stars.level)
starsin=$(ipfs --timeout=10s cat /ipns/$ipfsnodeid/.$ipfsnodeid/FRIENDS/$G1PUB/stars.level || echo 0)
starsout=$(ipfs --timeout=10s cat /ipns/$IPFSNODEID/.$IPFSNODEID/FRIENDS/$whoisg1/stars.level || echo 0)
# REFRESH A_swarm_map.txt
echo $peerline >> ~/.zen/A_swarm_map.txt
@ -121,17 +121,18 @@ do
# FRIEND ADDRESS DISCOVERY
echo "Am I friend with my FRIEND friend $whoisg1 ?"
echo "starsin=$starsin * starsout=$starsout *"
# ipfs cat /ipns/$ipfsnodeid/.$ipfsnodeid/FRIENDS/$G1PUB/tryme.addr # IS my own /ipns/$IPFSNODEID/.$IPFSNODEID/tryme.addr
# GCHANGE : friend_of_mine=$(~/.zen/astrXbian/zen/tools/timeout.sh -t 12 ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" stars -p $whoisg1 | jq -r '.yours.pseudo'); # must contains my XZUID
## LOOKING IN SWARM CACHE
friend_of_mine=$(ls ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/$whoisg1 2>/dev/null)
if [[ $friend_of_mine ]]; then
# COUNTING MY FRIENDS
friend_of_mine_count=$((friend_of_mine_count+1))
if [[ ! $(grep "$ipfsnodeid" ~/.zen/A_my_swarm.txt) ]]
then
echo "OK FRIEND"
# COUNT UNIQ FRIENDS
friend_of_mine_count=$((friend_of_mine_count+1))
echo "$peerline" >> ~/.zen/A_my_swarm.txt
# ipfs bootstrap add "$peerline"
## NOW WILL BE USING Peering.Peers config
@ -143,7 +144,7 @@ do
else
## REMOVE FRIENDS DIRECTORY (should be removed from Astroport App)
echo "NOT FULL FRIEND $ipfsnodeid / $whoisg1"
[[ "$liking_me" != "" ]] && rm -Rf ~/.zen/ipfs/.${IPFSNODEID}/FRIENDS/$liking_me
[[ "$liking_me" != "" ]] && rm -Rf ~/.zen/ipfs/.${IPFSNODEID}/FRIENDS/$liking_me && rm -Rf ~/.zen/ipfs_swarm/.$ipfsnodeid && echo "REMOVING SWARM SYNC"
# SEND ME A MESSAGE TO DECIDE WHAT TO DO ?
# SEND MESSAGE ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" send -d $whoisg1 -t 'Astroport' -m 'Rejoins mon #Swarm0 https://copylaradio.com'"
fi

Loading…
Cancel
Save