diff --git a/zen/gchange_IPFS_swarm.sh b/zen/gchange_IPFS_swarm.sh index 98a4b50..b6cf9a5 100755 --- a/zen/gchange_IPFS_swarm.sh +++ b/zen/gchange_IPFS_swarm.sh @@ -41,11 +41,17 @@ do ## Get "/tmp/ipfstryme.$liking_me" from Gchange "ipfstryme" message ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" read -n300 -j | jq -r --arg friendKEY "$liking_me" '.[] | select(.pubkey == $friendKEY)' | jq 'select(.title == "ipfstryme")' | jq -r '.content' > /tmp/ipfstryme.$liking_me - ## ZOMBIE NODE sends more that 300 ipfstryme ? + # CLEAN /tmp/ipfstryme.$liking_me + for line in $(cat /tmp/ipfstryme.$liking_me); + do + [[ $line == "" ]] && break + echo $line >> /tmp/ipfstryme.clean + done + cat /tmp/ipfstryme.clean | sort | uniq > /tmp/ipfstryme.$liking_me + ## ZOMBIE NODE sends more that 300 ipfstryme ? [[ $(cat /tmp/ipfstryme.$liking_me | sort | uniq | wc -l) -gt 300 ]] && echo "THIS NODE IS A ZOMBIE..." && rm -f /tmp/ipfstryme.$liking_me && continue - + cat /tmp/ipfstryme.$liking_me echo "__________________________________________" - done for peerline in $(cat /tmp/ipfstryme.* | sort | uniq); @@ -59,8 +65,8 @@ do # GET $whoisg1 FROM $peerline ## Remove Qm ipfs nodes [[ "${ipfsnodeid:0:2}" != "Qm" ]] && whoisg1=$(~/.zen/astrXbian/zen/tools/ipfs_to_g1.py $ipfsnodeid) - [[ ! $whoisg1 ]] && continue - + [[ ! $whoisg1 ]] && continue + # KEEPING LAST ipfstryme MESSAGES only nbmessage=0 for messageid in $(~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" read -n300 -j | jq -r --arg friendKEY "$whoisg1" '.[] | select(.pubkey == $friendKEY)' | jq 'select(.title == "ipfstryme")' | jq -r '.id') @@ -83,13 +89,13 @@ do if [[ "$friend_of_mine" != "null" ]]; then 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" + 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" else - echo "ALREADY RECORDED FRIEND" + echo "ALREADY RECORDED FRIEND" fi ipfs --timeout=20s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid else