astroport/zen/ssb_SURVEY_swarmkey.sh

40 lines
1.6 KiB
Bash
Executable File

#!/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'
# SURVEY received #astroport-swarmkey and copy it to IPFS
######################################################################## _ _ _ _ _
___ _ _ __
| |_)|_(_ _ _.._._ _ | _
_|_| | __) _>\/\/(_|| | | ||<(/_\/
/
USED ONLY ONCE... Next swarm.key change will use ipfs.
'
self=$(sbotc whoami | jq -r .id) || exit 1
g1self=$(echo $self | cut -d '@' -f 2 | cut -d '.' -f 1 | base64 -d | base58)
self_name=$(sbotc query.read '{"query":[{"$filter":{"value":{"author": "'"$self"'", "content":{"type":"about", "about": "'"$self"'"}}}}]}' | jq -r .value?.content?.name | grep -v null | tail -n 1)
ipfsnodeid=$(ipfs id -f='<id>\n')
[[ ! $ipfsnodeid ]] && echo "ERROR ipfs id" && exit 1
messages=$(sbotc backlinks.read '{"query":[{"$filter":{"dest":"#astroport-swarmkey","value":{"content":{"type":"post"}}}}]}')
while read -r msg
do
done < <(printf '%s\n' "$messages")