#!/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' # GET GCHANGE FRIENDS AND FIND THEIR IPFS ID TO "ipfs swarm connect" THEM ########################################################################' ## TODO: REMOVE DUPLICATES ## TODO: MODE : COOL, STRAIGHT, ARMORED ######################################################################## ## CONNECT GLOBAL "ipfs.io" ## DANGEROUS DATA LEAK only for short time... ######################################################################## # 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='\n') [[ $IPFSNODEID == "" ]] && echo "ERROR missing IPFS Node id !! IPFS is not installed !?" && exit 1 ######################################################################## #TODO: # 1. Get gchange in-friends list # 2. Read gchange+ message from them and find their IPFS tryme address # 3. Compare with out-friends list and add their address to bootstrap, connect swarm peers # 4. Send message to not yet in-friends to install Astroport. count=1 ######################################################################## # Let's look if our SSB Friends ARE "IPFS swarm connected" ######################################################################## echo "" > /tmp/This_NOTfriends_are_astroport echo "" > /tmp/This_friends_connect_astroport echo "" > /tmp/This_friends_should_install_astroport ### TODO -> send gchange message (private or zip attached?) with this reports for SSBFRIEND in $(uniq /tmp/ssb-friends.txt); do # Force Strict #swarm0 !! [[ $count == 1 ]] && ipfs bootstrap rm --all ### sbotc $SSBFRIEND name MYFRIEND=$(sbotc query.read '{"query":[{"$filter":{"value":{"author": "'"$SSBFRIEND"'", "content":{"type":"about", "about": "'"$SSBFRIEND"'"}}}}]}' | jq -r .value?.content?.name | grep -v null | tail -n 1) ### GET SSB "ipfstryme" message type !!! Astroport Node should have publish it during "ssb_INIT.sh" TRYME=$(sbotc query.read '{"query":[{"$filter":{"value":{"author": "'"$SSBFRIEND"'", "content":{"type":"ipfstryme"}}}}]}' | jq -r .value?.content?.text | tail -n 1) ## !! REMOVE NOTfriends from IPFS swarm [[ $TRYME ]] && [[ $(grep -Rwl "$SSBFRIEND" /tmp/ssb-NOTfriends.txt) ]] && MES="($count) HUMMMM $MYFRIEND ($SSBFRIEND) IS NOT my friend disconnecting" && ipfs swarm disconnect $TRYME && ipfs bootstrap rm $TRYME && echo $MES >> /tmp/This_NOTfriends_are_astroport && continue ## Ici, on peut décider de demander à faire supprimer la couche astroport à son PAS AMI ## ADD Friend to our IPFS swarm [[ $TRYME ]] && MES="($count) $MYFRIEND ($SSBFRIEND) connect OK $TRYME" && ipfs swarm connect $TRYME && ipfs bootstrap add $TRYME && echo $MES >> /tmp/This_friends_connect_astroport ## Ce pote est connecté IPFS avec moi ## This_friends_should_install_astroport [[ ! $TRYME ]] && MES="($count) $MYFRIEND ($SSBFRIEND) is NOT running ASTROPORT !!!" && echo $MES >> /tmp/This_friends_should_install_astroport ### WHAT HAPPENED this loop on my ssb friends echo $MES echo "_________________________________________________" count=$((count+1)) done echo "__________________________________________ $WHOAMI ipfs peers are:" ipfs swarm peers