optimize
This commit is contained in:
parent
aec8bfc7ba
commit
572fdd0ece
|
@ -41,11 +41,17 @@ do
|
||||||
## Get "/tmp/ipfstryme.$liking_me" from Gchange "ipfstryme" message
|
## 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
|
~/.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 | 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 "__________________________________________"
|
echo "__________________________________________"
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
for peerline in $(cat /tmp/ipfstryme.* | sort | uniq);
|
for peerline in $(cat /tmp/ipfstryme.* | sort | uniq);
|
||||||
|
@ -59,8 +65,8 @@ do
|
||||||
# GET $whoisg1 FROM $peerline
|
# GET $whoisg1 FROM $peerline
|
||||||
## Remove Qm ipfs nodes
|
## Remove Qm ipfs nodes
|
||||||
[[ "${ipfsnodeid:0:2}" != "Qm" ]] && whoisg1=$(~/.zen/astrXbian/zen/tools/ipfs_to_g1.py $ipfsnodeid)
|
[[ "${ipfsnodeid:0:2}" != "Qm" ]] && whoisg1=$(~/.zen/astrXbian/zen/tools/ipfs_to_g1.py $ipfsnodeid)
|
||||||
[[ ! $whoisg1 ]] && continue
|
[[ ! $whoisg1 ]] && continue
|
||||||
|
|
||||||
# KEEPING LAST ipfstryme MESSAGES only
|
# KEEPING LAST ipfstryme MESSAGES only
|
||||||
nbmessage=0
|
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')
|
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 [[ "$friend_of_mine" != "null" ]]; then
|
||||||
if [[ ! $(grep "$ipfsnodeid" ~/.zen/A_my_swarm.txt) ]]
|
if [[ ! $(grep "$ipfsnodeid" ~/.zen/A_my_swarm.txt) ]]
|
||||||
then
|
then
|
||||||
echo "OK FRIEND"
|
echo "OK FRIEND"
|
||||||
# COUNT UNIQ FRIENDS
|
# COUNT UNIQ FRIENDS
|
||||||
friend_of_mine_count=$((friend_of_mine_count+1))
|
friend_of_mine_count=$((friend_of_mine_count+1))
|
||||||
echo "$peerline" >> ~/.zen/A_my_swarm.txt
|
echo "$peerline" >> ~/.zen/A_my_swarm.txt
|
||||||
ipfs bootstrap add "$peerline"
|
ipfs bootstrap add "$peerline"
|
||||||
else
|
else
|
||||||
echo "ALREADY RECORDED FRIEND"
|
echo "ALREADY RECORDED FRIEND"
|
||||||
fi
|
fi
|
||||||
ipfs --timeout=20s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
|
ipfs --timeout=20s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue