This commit is contained in:
qo-op 2020-03-29 04:57:04 +01:00
parent e9d094ba62
commit d1bb564492
1 changed files with 20 additions and 5 deletions

View File

@ -15,11 +15,12 @@ echo '
########################################################################
# ex: ./'$ME'
# SURVEY received #astroport-swarmkey ipfs_swarm.key.crypt for IPFS
######################################################################## _ _ _ _ _
########################################################################
__ __ _ _
(_ (_ |_) _ ._ _ _|_o| _ _
__)__)|_) _>|_||\/(/_\/ | ||(/__>
/
(_ (_ |_) _ ._ _ _|_o|
__)__)|_) _>|_||\/(/_\/ | ||(/__>
/
USED ONLY ONCE... Next swarm.key change will accurs in ~/.zen/ipfs-swarm
@ -48,6 +49,7 @@ USED ONLY ONCE... Next swarm.key change will accurs in ~/.zen/ipfs-swarm
"timestamp": 1585194822367
}
'
[[ -f ~/.ipfs/ipfs_swarm.key ]] && echo "SWARM KEY ~/.ipfs/ipfs_swarm.key OK !!!" && exit 0
self=$(sbotc whoami | jq -r .id) || exit 1
g1self=$(echo $self | cut -d '@' -f 2 | cut -d '.' -f 1 | base64 -d | base58)
@ -77,11 +79,14 @@ sbotc messagesByType "post"
messages=$(sbotc messagesByType '{"type":"post"}')
while read -r msg
do
author=$(printf %s "$msg" | jq -r .value.author)
attached_file=$(printf %s "$msg" | jq -r .value.content.mentions[].name 2>/dev/null)
if [[ $attached_file == "ipfs_swarm.key.crypt" ]]; then
echo '
__ _ _
(_\ //\ |_)|\/| |/|_\_/ _._ .__|_
@ -89,21 +94,31 @@ __)\/\//--\| \| | |\|_ | de(_|\/|_)|_
/ |
to ~/.ipfs/ipfs_swarm.key
'
mylink=$(printf %s "$msg" | jq -r .value.content.mentions[].link)
mytmp=$(mktemp -d "${TMPDIR:-/tmp}/astroport.swarmkey.XXXXXXXXX")
echo "http://localhost:8989/blobs/get/$mylink"
continue
curl -s "http://localhost:8989/blobs/get/$mylink" > $mytmp/ipfs_swarm.key.crypt
$MY_PATH/tools/natools.py decrypt --pubsec -k ~/.ssb/secret.dunikey -i $mytmp/ipfs_swarm.key.crypt -o ~/.ipfs/ipfs_swarm.key && \
echo "IPFS SWARM KEY ~/.ipfs/ipfs_swarm.key received from SSB $author ... OK !"
echo '
___ _ _ __
| |_)|_(_ _| _. _ ._ _ _ ._
_|_| | __) (_|(_|(/_| | |(_)| | ... restart ...
'
# TODO!!! Add user in sudo without password like "pi" = Run astroport under pi user IDEA.
sudo systemctl restart ipfs
fi
done < <(printf '%s\n' "$messages")