bootstrap ipfs / ssb friends sync

This commit is contained in:
qo-op 2020-04-28 14:27:25 +02:00
parent 11359ee329
commit 6eb1eb1d40
4 changed files with 19 additions and 11 deletions

View File

@ -7,16 +7,13 @@
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}" ME="${0##*/}"
echo "
######################################################################## ########################################################################
# \\/// # \\///
# qo-op # qo-op
############# $ME DELAY ############# $ME DELAY
######################################################################## ########################################################################
# ex: ./$ME \"10 days\" echo "
# Survey Node G1 Wallet for TX/IN Commands in received comments ...
########################################################################
_(_)_ _(_)_ _(_)_ _(_)_
@@@@ (_)@(_) @@@@ (_)@(_) @@@@ @@@@ (_)@(_) @@@@ (_)@(_) @@@@
@@()@@ wWWWw (_)\ @@()@@ wWWWw (_)\ @@()@@ wWWWw @@()@@ wWWWw (_)\ @@()@@ wWWWw (_)\ @@()@@ wWWWw
@ -25,7 +22,9 @@ echo "
\ | \ |/ | / \ | \ |/ | / \ | \ |/ \ | \ |/ | / \ | \ |/ | / \ | \ |/
\\|// \\|/// \\\|// \\|// \\|/// \\\|// \\|// \\|/// \\|// \\|/// \\\|// \\|// \\|/// \\\|// \\|// \\|///
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# [ASTROPORT](https://astroport.com) # [ASTROPORT](https://astroport.com)
# ex: ./$ME \"10 days\"
# Survey Node G1 Wallet for TX/IN Commands in received comments ...
######################################################################## ########################################################################
" "
DELAY="$1" DELAY="$1"

View File

@ -51,6 +51,8 @@ do
echo "ZenTag $count : $ipnskey ($zenvalue Zen) $passengername" echo "ZenTag $count : $ipnskey ($zenvalue Zen) $passengername"
# TODO: Add control to alert ZenTags strange behaviour # TODO: Add control to alert ZenTags strange behaviour
# TODO :SECURITY BREACH: DO NOT PUBLISH _QRCODE.write.png !!!
I=$(ipfs add -qr ${id} | tail -n 1) I=$(ipfs add -qr ${id} | tail -n 1)
# ZenTag IPNS name publish # ZenTag IPNS name publish
J=$(ipfs name publish -k ${ipnskey}.key --quieter /ipfs/${I}) J=$(ipfs name publish -k ${ipnskey}.key --quieter /ipfs/${I})

View File

@ -38,7 +38,7 @@ ipfsnodeid=$(ipfs id -f='<id>\n')
[[ $ipfsnodeid == "" ]] && echo "ERROR missing IPFS Node id !! IPFS is not installed !?" && exit 1 [[ $ipfsnodeid == "" ]] && echo "ERROR missing IPFS Node id !! IPFS is not installed !?" && exit 1
######################################################################## ########################################################################
ssbpub=$(sbotc whoami 2>/dev/null | jq -r .id) ssbpub=$(sbotc whoami 2>/dev/null | jq -r .id)
[[ $ssbpub == "" ]] && echo "ERROR ssb-server NOT running !! Please check it..." && exit 1 [[ $ssbpub == "" ]] && echo "ERROR sbotc NOT running !! Please check it..." && exit 1
######################################################################## ########################################################################
[[ ! -f ~/.ssb/secret.dunikey ]] && $MY_PATH/tools/secret2dunikey.sh [[ ! -f ~/.ssb/secret.dunikey ]] && $MY_PATH/tools/secret2dunikey.sh
g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
@ -96,17 +96,24 @@ $ssbpub
" "
sbot publish --type about --about $ssbpub --description "[Astroport Node](https://astroport.com) [$ipfsnodeid](http://localhost:8080/ipns/$ipfsnodeid) - Wallet $g1pub - Use your KEY ~/.ssb/secret.dunikey in [Cesium](https://cesium.app)" --name "$title" --image "$id" sbot publish --type about --about $ssbpub --description "[Astroport Node](https://astroport.com) [$ipfsnodeid](http://localhost:8080/ipns/$ipfsnodeid) - Wallet $g1pub - Use your KEY ~/.ssb/secret.dunikey in [Cesium](https://cesium.app)" --name "$title" --image "$id"
# REQUEST DUNITER G1 Wallet balance
DUNITERNODE=$($MY_PATH/tools/duniter_getnode.sh)
g1balance=$(silkaj -p $DUNITERNODE balance $g1pub 2>&1)
# SSB PUBLISH G1 wallet silkaj balance
sbotc publish '{"type":"post","text":"'"$g1balance"'"}'
echo " echo "
_ _ _ _
/ \|_) _ _ _| _ / \|_) _ _ _| _
\_X| \ (_(_)(_|(/_ ! AVATAR \_X| \ (_(_)(_|(/_ ! AVATAR
$g1pub $g1balance
~/.zen/ipfs/.$ipfsnodeid/G1SSB/_g1.qrcode.png ~/.zen/ipfs/.$ipfsnodeid/G1SSB/_g1.qrcode.png
-- sbotc publish -- -- sbotc publish --
" "
# IF no AVATAR, publish message with QRCode
[[ ! $(file "/tmp/avatar.png" | grep 'PNG') ]] && sbotc publish '{"type":"post","text":"[My G1 Wallet QRCode]('"$id"')\nUse [Cesium](https://cesium.app) to send payment to it.\nComment your transaction with '"'Zen'"' to create ZenTags...","mentions":[{"link":"'"$id"'","name":"'"$name"'","size":'"$size"',"type":"'"$type"'"}]}' [[ ! $(file "/tmp/avatar.png" | grep 'PNG') ]] && sbotc publish '{"type":"post","text":"[My G1 Wallet QRCode]('"$id"')\nUse [Cesium](https://cesium.app) to send payment to it.\nComment your transaction with '"'Zen'"' to create ZenTags...","mentions":[{"link":"'"$id"'","name":"'"$name"'","size":'"$size"',"type":"'"$type"'"}]}'
@ -135,7 +142,7 @@ IWALLETS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
NODEIPNS=$(ipfs name publish --allow-offline --quieter /ipfs/$IWALLETS) NODEIPNS=$(ipfs name publish --allow-offline --quieter /ipfs/$IWALLETS)
echo " echo "
ipfs ls /ipns/$NODEIPNS ipfs ls /ipns/$ipfsnodeid
_ _ _ _ _ _ _ _ _ _
(_)_ ____ _(_) |_ __ _| |_(_) ___ _ __ (_)_ ____ _(_) |_ __ _| |_(_) ___ _ __
| | _ \ \ / / | __/ _| | __| |/ _ \| _ \ | | _ \ \ / / | __/ _| | __| |/ _ \| _ \

View File

@ -36,7 +36,7 @@ echo '
# # # # # # # # # # # # # # # # # # # # # # # #
#### #### ##### ####### # # # #### #### #### ##### ####### # # # ####
' Get ipfs addresses from SSB friends and add to bootstrap & swarm peers'
# GET /tmp/ssb-friends.json to choose SWARM peers # GET /tmp/ssb-friends.json to choose SWARM peers
self=$(sbotc whoami | jq -r .id) self=$(sbotc whoami | jq -r .id)
@ -48,7 +48,7 @@ for SSBFRIEND in $(cat /tmp/ssb-friends.json); do
# #
### GET SSB "ipfstryme" message type !!! ### GET SSB "ipfstryme" message type !!!
TRYME=$(sbotc query.read '{"query":[{"$filter":{"value":{"author": "'"$SSBFRIEND"'", "content":{"type":"ipfstryme"}}}}]}' | jq -r .value?.content?.text | tail -n 1) TRYME=$(sbotc query.read '{"query":[{"$filter":{"value":{"author": "'"$SSBFRIEND"'", "content":{"type":"ipfstryme"}}}}]}' | jq -r .value?.content?.text | tail -n 1)
[[ $TRYME ]] && ipfs swarm connect $TRYME [[ $TRYME ]] && ipfs swarm connect $TRYME && ipfs bootstrap add $TRYME
# Modify ipfs swarm peers related to ssb friends # Modify ipfs swarm peers related to ssb friends
done done