ssb_IPFS_swarm

This commit is contained in:
qo-op 2020-04-27 23:26:51 +02:00
parent a5f4de87bc
commit 9212e27a48
2 changed files with 49 additions and 10 deletions

View File

@ -35,16 +35,6 @@ _|_| | __) __)\/\//--\| \| | | \|_| | \|___)| |
'
# GET /tmp/ssb-friends.json to choose SWARM peers
self=$(sbotc whoami | jq -r .id)
sbotc query.read '{"query":[{"$filter":{"value":{"author": "'"$self"'", "content":{"type":"contact"}}}}]}' | jq -r '.value?.content?.contact' > /tmp/ssb-friends.json || rm -f /tmp/ssb-friends.json
for SSBFRIEND in $(cat /tmp/ssb-friends.json); do
#echo "Searching $SSBFRIEND"
INSWARM=$(grep -Rwl "$SSBFRIEND" ~/.zen/ipfs_swarm/.Qm*/G1SSB/_ssb.whoami | tail -n 1 | cut -f 4 -d '/')
[[ $INSWARM ]] && echo $INSWARM && TRYME=$(~/.zen/ipfs_swarm/$INSWARM/tryme.addr) && echo $TRYME
done
# GET IPNS published wallets from ALL SWARM NODES ## TODO: IF NODES are MISSING, check ./wallets_swarm/.QmNODES...
ipfs get --output=$HOME/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
count=1

49
zen/ssb_IPFS_swarm.sh Normal file
View File

@ -0,0 +1,49 @@
#!/bin/bash
########################################################################
# Author: Fred (support@qo-op.com)
# Version: 2020.03.24
# 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##*/}"
echo '
########################################################################
# \\///
# qo-op
############# '$MY_PATH/$ME'
########################################################################
# ex: ./'$ME'
# SYNC IPFS SWARM PEERS SHARED DATA .Qm****
########################################################################'
########################################################################
# 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
########################################################################
[[ ! -f ~/.ssb/secret.dunikey ]] && $MY_PATH/tools/secret2dunikey.sh
g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
########################################################################
echo '
#####
#### #### ##### # # # ##### ###### ####
# # # # # # # # # #
#### #### ##### ##### # # # ##### ####
# # # # # # ##### # #
# # # # # # # # # # # #
#### #### ##### ####### # # # ####
'
# GET /tmp/ssb-friends.json to choose SWARM peers
self=$(sbotc whoami | jq -r .id)
sbotc query.read '{"query":[{"$filter":{"value":{"author": "'"$self"'", "content":{"type":"contact"}}}}]}' | jq -r '.value?.content?.contact' > /tmp/ssb-friends.json || rm -f /tmp/ssb-friends.json
for SSBFRIEND in $(cat /tmp/ssb-friends.json); do
#echo "Searching $SSBFRIEND"
INSWARM=$(grep -Rwl "$SSBFRIEND" ~/.zen/ipfs_swarm/.Qm*/G1SSB/_ssb.whoami | tail -n 1 | cut -f 4 -d '/')
[[ $INSWARM ]] && echo $INSWARM && TRYME=$(~/.zen/ipfs_swarm/$INSWARM/tryme.addr) && echo $TRYME
done