~/.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
|
for swarm_frof in $(ls ~/.zen/ipfs_swarm/.*/FRIENDS/$G1PUB/stars.level | cut -d '/' -f 6 | cut -d '.' -f 2); ## FROM IPFS
|
||||||
do
|
do
|
||||||
liking_me=$(~/.zen/astrXbian/zen/tools/ipfs_to_g1.py $swarm_frof)
|
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)
|
# 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
|
# [[ ! -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
|
#for liking_me in $(cat /tmp/liking_me | sort | uniq); ## FROM GCHANGE
|
||||||
|
@ -49,7 +49,7 @@ do
|
||||||
liking_me_count=$((liking_me_count+1))
|
liking_me_count=$((liking_me_count+1))
|
||||||
echo ">>>>>> CHECKING liking_me n° $liking_me_count "
|
echo ">>>>>> CHECKING liking_me n° $liking_me_count "
|
||||||
## IPFS WAY TO DO IT (LESS STRESS ON GCHANGE)
|
## 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)
|
ipfsnodeid=$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $liking_me)
|
||||||
echo "Getting /ipns/$ipfsnodeid/.$ipfsnodeid/tryme.addr ..."
|
echo "Getting /ipns/$ipfsnodeid/.$ipfsnodeid/tryme.addr ..."
|
||||||
ipfs --timeout=30s cat /ipns/$ipfsnodeid/.$ipfsnodeid/tryme.addr > /tmp/ipfstryme.$liking_me
|
ipfs --timeout=30s cat /ipns/$ipfsnodeid/.$ipfsnodeid/tryme.addr > /tmp/ipfstryme.$liking_me
|
||||||
|
@ -113,8 +113,11 @@ do
|
||||||
# FRIEND ADDRESS DISCOVERY
|
# FRIEND ADDRESS DISCOVERY
|
||||||
echo "Am I friend with my FRIEND friend $whoisg1 ?"
|
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
|
# 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) ]]
|
if [[ ! $(grep "$ipfsnodeid" ~/.zen/A_my_swarm.txt) ]]
|
||||||
then
|
then
|
||||||
echo "OK FRIEND"
|
echo "OK FRIEND"
|
||||||
|
@ -129,7 +132,7 @@ do
|
||||||
## Sync ipfs_swarm
|
## Sync ipfs_swarm
|
||||||
ipfs --timeout=60s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
|
ipfs --timeout=60s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
|
||||||
else
|
else
|
||||||
## REMOVE FRIENDS DIRECTORY
|
## REMOVE FRIENDS DIRECTORY (should be removed from Astroport App)
|
||||||
echo "NOT FULL FRIEND $ipfsnodeid / $whoisg1"
|
echo "NOT FULL FRIEND $ipfsnodeid / $whoisg1"
|
||||||
[[ "$liking_me" != "" ]] && rm -Rf ~/.zen/ipfs/.${IPFSNODEID}/FRIENDS/$liking_me
|
[[ "$liking_me" != "" ]] && rm -Rf ~/.zen/ipfs/.${IPFSNODEID}/FRIENDS/$liking_me
|
||||||
# SEND ME A MESSAGE TO DECIDE WHAT TO DO ?
|
# 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
|
I have $friend_of_mine_count friends amoung $liking_me_count liking me people
|
||||||
__________________________________________
|
__________________________________________
|
||||||
My actual #SWARM0"
|
My actual #SWARM0"
|
||||||
ipfs swarm peers
|
# ipfs swarm peers
|
||||||
echo $(date)
|
echo $(date)
|
||||||
|
|
||||||
echo "####################################################"
|
echo "####################################################"
|
||||||
|
|
|
@ -56,9 +56,8 @@ ipfs bootstrap > /tmp/ipfs_swarm_peers
|
||||||
ipfs swarm peers >> /tmp/ipfs_swarm_peers
|
ipfs swarm peers >> /tmp/ipfs_swarm_peers
|
||||||
|
|
||||||
rm ~/.zen/A_peering_peers.txt
|
rm ~/.zen/A_peering_peers.txt
|
||||||
# cp ~/.ipfs/config ~/.ipfs/config.bak
|
|
||||||
[[ -f ~/.ipfs/config.bak ]] && cp ~/.ipfs/config.bak ~/.ipfs/config
|
[[ -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 /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);
|
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)
|
IsAlreadythere=$(cat ~/.ipfs/config.new | grep $ipfsnodeid)
|
||||||
if [[ ! $IsAlreadythere ]]; then
|
if [[ ! $IsAlreadythere ]]; then
|
||||||
echo '{ "ID": "'$ipfsnodeid'", "Addrs": [] }' >> ~/.zen/A_peering_peers.txt
|
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
|
||||||
fi
|
fi
|
||||||
else # if [[ "$myfriendpeer" != "" ]];
|
else # if [[ "$myfriendpeer" != "" ]];
|
||||||
|
@ -207,8 +206,8 @@ done
|
||||||
|
|
||||||
## PUBLISH PEERING.PEERS
|
## PUBLISH PEERING.PEERS
|
||||||
## Create json format 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
|
# 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
|
# jq -c ~/.ipfs/config.new
|
||||||
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
Loading…
Reference in New Issue