2020-11-30 19:21:30 +01:00
#!/bin/bash
########################################################################
# Author: Fred (support@qo-op.com)
# Version: 2020.04.27
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
MY_PATH = " `dirname \" $0 \"` " # relative
MY_PATH = " `( cd \" $MY_PATH \" && pwd )` " # absolutized and normalized
ME = " ${ 0 ##*/ } "
########################################################################
# \\///
# qo-op
############# '$MY_PATH/$ME'
########################################################################
# ex: ./'$ME'
2020-12-02 15:18:00 +01:00
# GET GCHANGE FRIENDS AND FIND THEIR IPFS ID TO "ipfs swarm connect" THEM
2020-11-30 19:21:30 +01:00
########################################################################'
## TODO: REMOVE DUPLICATES
## TODO: MODE : COOL, STRAIGHT, ARMORED
########################################################################
2020-12-02 15:18:00 +01:00
## CONNECT GLOBAL "ipfs.io" ## DANGEROUS DATA LEAK only for short time...
2020-11-30 19:21:30 +01:00
########################################################################
# ADD ipfs.io public bootstrap into your swarm peers
# RUN: cat ~/.zen/astroport/ipfs.swarm.ipfs.io | ipfs swarm connect
# SOON ipfs swarm peers will GROW!!! YOU ARE VSIBLE !!!
# RUN: sudo systemctl restart ipfs # GOES BACK TO SWARM0
########################################################################
########################################################################
# ENVIRONEMENT DETECTION + IPFS ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_info
########################################################################
IPFSNODEID = $( ipfs id -f= '<id>\n' )
[ [ $IPFSNODEID = = "" ] ] && echo "ERROR missing IPFS Node id !! IPFS is not installed !?" && exit 1
########################################################################
2020-12-03 13:37:24 +01:00
# Force Strict #swarm0 !!?
# ipfs bootstrap rm --all
2020-11-30 19:21:30 +01:00
2020-12-03 13:37:24 +01:00
liking_me_count = 0
friend_of_mine_count = 0
2020-11-30 19:21:30 +01:00
########################################################################
2020-12-03 13:37:24 +01:00
# Let's look for Friends and "IPFS swarm connect" with them
2020-11-30 19:21:30 +01:00
########################################################################
2020-12-03 13:37:24 +01:00
cd ~/.zen/astroport/zen/cesium-messaging
# 1. Get Gchange "liking_me" list
for liking_me in $( ./jaklis.py like | jq -r '.likes[].issuer' ) ;
do
friend_of_mine = $( ./jaklis.py like -p $liking_me | jq -r '.yours' ) ;
# 2. Searching "ipfstryme" message from friend_of_mine
[ [ $friend_of_mine != null ] ] && echo " Try to connect to my friend $liking_me " && friend_of_mine_count = $(( friend_of_mine_count+1)) && ipfsadd = 0 \
&& for adresse in $( ./jaklis.py read -n50 -j | jq -r --arg friendKEY " $liking_me " '.[] | select(.pubkey == $friendKEY)' | jq 'select(.title == "ipfstryme")' | jq -r '.content' ) ;
do
# 3. liking_me friend_of_mine can join my swarm & bootstrap
ipfs swarm connect $adresse ;
ipfs bootstrap add $adresse ;
ipfsadd = $(( ipfsadd+1))
done ;
[ [ $ipfsadd = = 0 ] ] && echo "My friend did not sent ipfstryme message..." # && ./jaklis.py send -d $liking_me -t "Gchange IPFS" -m "Rejoins moi sur https://qo-op.com"
# 4. liking_me IS NOT a friend_of_mine!!
[ [ $friend_of_mine = = null ] ] && echo " I am NOT LIKING $liking_me " ;
liking_me_count = $(( liking_me_count+1))
2020-11-30 19:21:30 +01:00
done
2020-12-03 13:37:24 +01:00
cd -
2020-11-30 19:21:30 +01:00
2020-12-03 13:37:24 +01:00
echo " I have $friend_of_mine_count friends amoung $liking_me_count liking me people
__________________________________________
HERE IS MY #SWARM0"
2020-11-30 19:21:30 +01:00
ipfs swarm peers
2020-12-03 13:37:24 +01:00