~/.ipfs/config
This commit is contained in:
parent
703b30a9af
commit
e3d1085191
|
@ -37,7 +37,7 @@ echo $(date)
|
|||
for swarm_frof in $(ls ~/.zen/ipfs_swarm/.*/FRIENDS/$G1PUB/stars.level | cut -d '/' -f 6 | cut -d '.' -f 2); ## FROM IPFS
|
||||
do
|
||||
liking_me=$(~/.zen/astrXbian/zen/tools/ipfs_to_g1.py $swarm_frof)
|
||||
do_I_like=$(ls ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/$liking_me)
|
||||
do_I_like=$(ls ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/$liking_me 2>/dev/null)
|
||||
# Get Gchange "liking_me" people list (made by gchange_INIT.sh)
|
||||
# [[ ! -f /tmp/liking_me ]] && ~/.zen/astrXbian/zen/tools/timeout.sh -t 12 ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" stars | jq -r '.likes[].issuer' > /tmp/liking_me.try && [ ! -s /tmp/liking_me.try ] && cp /tmp/liking_me.try /tmp/liking_me && rm /tmp/liking_me.try
|
||||
#for liking_me in $(cat /tmp/liking_me | sort | uniq); ## FROM GCHANGE
|
||||
|
@ -49,7 +49,7 @@ do
|
|||
liking_me_count=$((liking_me_count+1))
|
||||
echo ">>>>>> CHECKING liking_me n° $liking_me_count "
|
||||
## IPFS WAY TO DO IT (LESS STRESS ON GCHANGE)
|
||||
rm /tmp/ipfstryme.$liking_me
|
||||
rm /tmp/ipfstryme.$liking_me 2>/dev/null
|
||||
ipfsnodeid=$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $liking_me)
|
||||
echo "Getting /ipns/$ipfsnodeid/.$ipfsnodeid/tryme.addr ..."
|
||||
ipfs --timeout=30s cat /ipns/$ipfsnodeid/.$ipfsnodeid/tryme.addr > /tmp/ipfstryme.$liking_me
|
||||
|
@ -113,8 +113,11 @@ do
|
|||
# FRIEND ADDRESS DISCOVERY
|
||||
echo "Am I friend with my FRIEND friend $whoisg1 ?"
|
||||
# ipfs cat /ipns/$ipfsnodeid/.$ipfsnodeid/FRIENDS/$G1PUB/tryme.addr # IS my own /ipns/$IPFSNODEID/.$IPFSNODEID/tryme.addr
|
||||
friend_of_mine=$(~/.zen/astrXbian/zen/tools/timeout.sh -t 12 ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" stars -p $whoisg1 | jq -r '.yours.pseudo'); # must contains my XZUID
|
||||
if [[ "$friend_of_mine" != "null" ]]; then
|
||||
|
||||
# GCHANGE : friend_of_mine=$(~/.zen/astrXbian/zen/tools/timeout.sh -t 12 ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" stars -p $whoisg1 | jq -r '.yours.pseudo'); # must contains my XZUID
|
||||
## LOOKING IN SWARM CACHE
|
||||
friend_of_mine=$(ls ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/$whoisg1 2>/dev/null)
|
||||
if [[ $friend_of_mine ]]; then
|
||||
if [[ ! $(grep "$ipfsnodeid" ~/.zen/A_my_swarm.txt) ]]
|
||||
then
|
||||
echo "OK FRIEND"
|
||||
|
@ -129,7 +132,7 @@ do
|
|||
## Sync ipfs_swarm
|
||||
ipfs --timeout=60s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
|
||||
else
|
||||
## REMOVE FRIENDS DIRECTORY
|
||||
## REMOVE FRIENDS DIRECTORY (should be removed from Astroport App)
|
||||
echo "NOT FULL FRIEND $ipfsnodeid / $whoisg1"
|
||||
[[ "$liking_me" != "" ]] && rm -Rf ~/.zen/ipfs/.${IPFSNODEID}/FRIENDS/$liking_me
|
||||
# SEND ME A MESSAGE TO DECIDE WHAT TO DO ?
|
||||
|
@ -148,7 +151,7 @@ echo "####################################################
|
|||
I have $friend_of_mine_count friends amoung $liking_me_count liking me people
|
||||
__________________________________________
|
||||
My actual #SWARM0"
|
||||
ipfs swarm peers
|
||||
# ipfs swarm peers
|
||||
echo $(date)
|
||||
|
||||
echo "####################################################"
|
||||
|
|
|
@ -56,9 +56,8 @@ ipfs bootstrap > /tmp/ipfs_swarm_peers
|
|||
ipfs swarm peers >> /tmp/ipfs_swarm_peers
|
||||
|
||||
rm ~/.zen/A_peering_peers.txt
|
||||
# cp ~/.ipfs/config ~/.ipfs/config.bak
|
||||
[[ -f ~/.ipfs/config.bak ]] && cp ~/.ipfs/config.bak ~/.ipfs/config
|
||||
rm ~/.ipfs/config.new
|
||||
cp ~/.ipfs/config ~/.ipfs/config.new
|
||||
|
||||
# for ipfsnodeid in $( (cat /tmp/ipfs_swarm_peers | grep -o '[^/]*$' && cat /tmp/A_swarm | grep -o '[^/]*$' ) | sort | uniq); ## TODO ACTIVATE IN DEFCON 4
|
||||
for ipfsnodeid in $(cat ~/.zen/ipfs_swarm/.*/tryme.addr | grep -o '[^/]*$' | sort | uniq);
|
||||
|
@ -149,7 +148,7 @@ do
|
|||
IsAlreadythere=$(cat ~/.ipfs/config.new | grep $ipfsnodeid)
|
||||
if [[ ! $IsAlreadythere ]]; then
|
||||
echo '{ "ID": "'$ipfsnodeid'", "Addrs": [] }' >> ~/.zen/A_peering_peers.txt
|
||||
jq '.Peering.Peers? += { "Addrs": [], "ID": "'$ipfsnodeid'" }' ~/.ipfs/config > ~/.ipfs/config.new # && cp ~/.ipfs/config.new ~/.ipfs/config
|
||||
jq '.Peering.Peers? += { "Addrs": [], "ID": "'$ipfsnodeid'" }' ~/.ipfs/config.new > ~/.ipfs/config.wew && cp ~/.ipfs/config.wew ~/.ipfs/config.new
|
||||
fi
|
||||
fi
|
||||
else # if [[ "$myfriendpeer" != "" ]];
|
||||
|
@ -207,8 +206,8 @@ done
|
|||
|
||||
## PUBLISH PEERING.PEERS
|
||||
## Create json format Peering.Peers
|
||||
echo "{ \"Peering\": {\"Peers\": [ $(cat ~/.zen/A_peering_peers.txt | jq -c | sed 's/}/},/g' | sed '$ s/.$//') ] } }" | jq -c > ~/.zen/ipfs/.$IPFSNODEID/.peering.peers.json
|
||||
jq -c --arg new "$(cat ~/.zen/ipfs/.$IPFSNODEID/.peering.peers.json)" '.Peering.Peers? += [$new]' ~/.ipfs/config
|
||||
# echo "{ \"Peering\": {\"Peers\": [ $(cat ~/.zen/A_peering_peers.txt | jq -c | sed 's/}/},/g' | sed '$ s/.$//') ] } }" | jq -c > ~/.zen/ipfs/.$IPFSNODEID/.peering.peers.json
|
||||
# jq -c ~/.ipfs/config.new
|
||||
|
||||
|
||||
########################################################################
|
||||
|
|
Loading…
Reference in New Issue