ipfs_swarm_wallets

This commit is contained in:
qo-op 2020-04-13 19:12:20 +02:00
parent de9c623fc7
commit 9e9f46fb7a
3 changed files with 64 additions and 28 deletions

View File

@ -16,31 +16,6 @@ g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
timebar=$(date +%H:%M)
function ipfs_swarm_wallets_refresh (){
mkdir -p "~/.zen/ipfs_swarm"
echo '
___ _ _ __ __ _ _ _ _ _ _ __
| |_)|_(_ (_\ //\ |_)|\/| |_)|_|_|_)|_(_ |_|
_|_| | __) __)\/\//--\| \| | | \|_| | \|___)| |
'
# GET IPNS published wallets from ALL SWARM NODES / TODO: IF NODES MISSING, check ./wallets_swarm/.QmNODES...
#log "__SUB:ipfs_swarm_wallets_refresh: IPFS: ipfs get --output=./wallets_swarm/ /ipns/$IPFSNODEID"
su $YOU -c "ipfs get --output=./wallets_swarm/ /ipns/$IPFSNODEID"
count=1
# Search for All peers Nodes. TODO: To be changed when Swarm is too bug or not expendanding
#for id in ./wallets/.Qm*/;
for id in $(su $YOU -c "ipfs swarm peers" | awk -F '/' '{print $7}');
do
count=$((count+1))
id=$(echo $id | cut -d '.' -f 3 | cut -d '/' -f 1)
log "__SUB:ipfs_swarm_wallets_refresh: IPFS: ipfs get --output=./wallets_swarm/ /ipns/$id"
rm -Rf ./wallets_swarm/.$id
./shell/timeout.sh -t 20 su $YOU -c "ipfs get --output=./wallets_swarm/ /ipns/$id"
done
##################################################################
if [[ "$1" == "" ]]; then
##################################################################
@ -55,7 +30,7 @@ if [[ "$1" == "PRINT" ]]; then
##################################################################
# Refresh All peers SWARM Wallets.
##################################################################
ipfs_swarm_wallets_refresh "SIMPLE"
ipfs_swarm_wallets_refresh
################################################################################
# PRINT G1Tag PRINTED FROM ANOTHER NODE (TODO: Correct BAD Cypher KEY + BUG why last image png layers are not printed???)

51
zen/ipfs_SWARM_refresh.sh Executable file
View File

@ -0,0 +1,51 @@
#!/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)
########################################################################
mkdir -p "~/.zen/ipfs_swarm"
echo '
___ _ _ __ __ _ _ _ _ _ _ __
| |_)|_(_ (_\ //\ |_)|\/| |_)|_|_|_)|_(_ |_|
_|_| | __) __)\/\//--\| \| | | \|_| | \|___)| |
'
# GET IPNS published wallets from ALL SWARM NODES ## TODO: IF NODES are MISSING, check ./wallets_swarm/.QmNODES...
ipfs get --output=~/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
count=1
# Search for All peers Nodes. ## TODO: To be changed when Swarm is too big or not expendanding
#for id in ./wallets/.Qm*/; # Alternative search
for id in $(ipfs swarm peers | awk -F '/' '{print $7}');
do
count=$((count+1))
id=$(echo $id | cut -d '.' -f 3 | cut -d '/' -f 1)
echo "Refreshing ~/.zen/ipfs_swarm/.$id"
rm -Rf ~/.zen/ipfs_swarm/.$id
$MY_PATH/tools/timeout.sh -t 10 ipfs get --output=~/.zen/ipfs_swarm/ /ipns/$id
done

View File

@ -22,14 +22,24 @@
~/.zen/ipfs/.${ipfsnodeid}/CHAN/sha256(id@channel)
# ipfs_SWARM_refresh.sh
```
# IPFS CHANNELS
# IPFS CHANNELS ARE IMPORTED FROM LOCAL NODE
```
~/.zen/ipfs/sha256(id@channel)/_uid
~/.zen/ipfs/sha256(+33647683646@SMS_+33667676767)/_uid
```
# natools CRYPT/DECRYPT
g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
$MY_PATH/tools/natools.py encrypt -p $g1pub -i file -o file.crypt
$MY_PATH/tools/natools.py decrypt --pubsec -k ~/.ssb/secret.dunikey -i file.crypt -o file