Browse Source

better

master
qo-op 2 years ago
parent
commit
9447aa053d
  1. 19
      zen/gchange_IPFS_swarm.sh

19
zen/gchange_IPFS_swarm.sh

@ -8,9 +8,9 @@ MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
# create swarm_map and my_swam files
echo "" > ~/.zen/A_my_swarm.txt
echo "" > ~/.zen/A_swarm_map.txt
# CLEAN "A_my_swarm.txt" and "A_swarm_map.txt"
rm -f ~/.zen/A_my_swarm.txt && touch ~/.zen/A_my_swarm.txt
rm -f ~/.zen/A_swarm_map.txt && touch ~/.zen/A_swarm_map.txt
########################################################################
# ENVIRONEMENT DETECTION + IPFS ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_info
@ -32,8 +32,8 @@ friend_of_mine_count=0
# 1. Get Gchange "liking_me" people list
for liking_me in $(~/.zen/astrXbian/zen/jaklis/jaklis.py like | jq -r '.likes[].issuer');
do
[[ "$liking_me" == "" ]] && continue
# DE TOUS CEUX QUI M'AIMENT JE VAIS LIRE LES MESSAGES pour collecter les ipfstryme vers ~/.zen/A_swarm_map.txt
[[ "$liking_me" == "" || "$liking_me" == "$G1PUB" ]] && continue
# DE TOUS CEUX QUI M'AIMENT JE VAIS LIRE LES MESSAGES pour collecter leurs ipfstryme vers ~/.zen/A_swarm_map.txt
# SI JE SUIS LEUR AMI EN RETOUR, je conserve leur ID dans ~/.zen/A_my_swarm.txt
# Check if my like is reverse
liking_me_count=$((liking_me_count+1))
@ -42,20 +42,21 @@ do
for peerline in $(~/.zen/astrXbian/zen/jaklis/jaklis.py read -n50 -j | jq -r --arg friendKEY "$liking_me" '.[] | select(.pubkey == $friendKEY)' | jq 'select(.title == "ipfstryme")' | jq -r '.content');
do
echo "PEERLINE: $peerline"
# KEEP A_swarm_map.txt uniq "$peerline" line
# REFERSH A_swarm_map.txt
echo $peerline >> ~/.zen/A_swarm_map.txt
cat ~/.zen/A_swarm_map.txt | sort | uniq > /tmp/A_swarm_map.txt
cp -f /tmp/A_swarm_map.txt ~/.zen/A_swarm_map.txt
# Get ipfsnodeid
# GET $ipfsnodeid AND $whoisg1 FROM $peerline
ipfsnodeid=$(echo "$peerline" | awk -F '/' '{print $8}')
[[ "$ipfsnodeid" == "" ]] && continue
whoisg1=$(~/.zen/astrXbian/zen/tools/ipfs_to_g1.py $ipfsnodeid)
echo "Am I friend whith $whoisg1 ?"
echo "AM I FRIEND WITH MY FRIEND FRIEND $whoisg1 ?"
friend_of_mine=$(~/.zen/astrXbian/zen/jaklis/jaklis.py like -p $whoisg1 | jq -r '.yours.pseudo'); # must contains my XZUID
if [[ "$friend_of_mine" != "null" ]]; then
friend_of_mine_count=$((friend_of_mine_count+1))
echo "YEAH FRIEND ° $friend_of_mine_count !!!"
echo "YEAH IT IS ALSO MY FRIEND !!!"
# TODO: SHOULD CHECK ~/.zen/ipfs/.${IPFSNODEID}/FRIENDS/$whoisg1/tryme.addr
echo $peerline >> ~/.zen/A_my_swarm.txt
# REMOVING OLD ipfstryme MESSAGES
nbmessage=0

Loading…
Cancel
Save