diff --git a/zen/g1ssb_ENV.sh b/zen/g1ssb_ENV.sh new file mode 100755 index 0000000..e87ac6c --- /dev/null +++ b/zen/g1ssb_ENV.sh @@ -0,0 +1,23 @@ +#!/bin/bash +######################################################################## +# Author: Fred (support@qo-op.com) +# Version: 2020.03.22 +# 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 +############# '$ME' +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# [ASTROPORT](https://astroport.com) +########################################################################' +############################################## +# NODE ENVIRONEMENT DETECTION +############################################## +IPFSNODEID=$(ipfs id -f='\n') +[[ ! -f ~/.ssb/secret.dunikey ]] && $MY_PATH/tools/secret2dunikey.sh +NODE_G1PUBKEY=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) diff --git a/zen/ssb_INIT.sh b/zen/ssb_INIT.sh index 9cfe021..dff7be5 100755 --- a/zen/ssb_INIT.sh +++ b/zen/ssb_INIT.sh @@ -36,31 +36,112 @@ echo ' IPFSNODEID=$(ipfs id -f='\n') [[ ! -f ~/.ssb/secret.dunikey ]] && $MY_PATH/tools/secret2dunikey.sh NODE_G1PUBKEY=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) - # CREATE ~/.zen/ipfs/.$IPFSNODEID/G1SSB ############################################## [[ $IPFSNODEID == "" ]] && echo "ERROR missing IPFSNODEID NODE_G1PUBKEY" && exit 1 mkdir -p ~/.zen/ipfs/.$IPFSNODEID/G1SSB +ssbpub=$(sbotc whoami 2>/dev/null | jq -r .id) + +if [[ $ssbpub == "" ]]; then + +EXTERNAL=$(cat /etc/hostname).local +mkdir -p ~/.ssb +echo" + _ __ __ _ + _ _ .__|_o _ (_ (_ |_) +(_(_)| || |(_| __)__)|_) + _| +$EXTERNAL +" + +[[ -f ~/.ssb/config ]] && cp -f ~/.ssb/config ~/.ssb/config.bkp +cat > ~/.ssb/config < ~/.zen/run-ssb-PUB_$EXTERNAL.sh </dev/null +done +EOF + +chmod 755 ~/.zen/run-ssb-PUB_$EXTERNAL.sh + +~/.zen/run-ssb-PUB_$EXTERNAL.sh & +sleep 3 + +ssbpub=$(sbotc whoami 2>/dev/null | jq -r .id) + +fi + +echo " +$ssbpub + _____ _____ _ + (_ | /\ |_)||_| \ +oooooooo__) |/--\| \||_|_/ + +" + ## PUBLISH ABOUT MESSAGE ############################################## -ssbpub=$(sbotc whoami | jq -r .id) -[[ $ssbpub == "" ]] && echo "ERROR missing ssb-server ?" && exit 1 -# G1 wallet QRCode +# CREATE G1 wallet QRCode qrcodefile=~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.qrcode.png qrencode -s 5 -o $qrcodefile "$NODE_G1PUBKEY" -# Publish About message + +# Publish G1 Wallet PUBKEY QRCode to SSB name=${qrcodefile##*/} id="$(sbotc blobs.add < $qrcodefile)" type="$(file -b --mime-type $qrcodefile)" size="$(wc -c < $qrcodefile)" -# Publish About message -sbot publish --type about --about $ssbpub --description "Welcome to [Astroport](https://astroport.com) G1SSB/IPFS Station [$IPFSNODEID](http://localhost/ipns/$IPFSNODEID)" --name "$USER@$(cat /etc/hostname)" --image "$id" -#sbotc publish '{"type":"about","about":"'"$ssbpub"'","description":"Welcome to [Astroport](https://astroport.com) G1SSB/IPFS Station\nhttp://'$(cat /etc/hostname)'.local/ipns/$IPFSNODEID","name":'"'$USER'@'$(cat /etc/hostname)'"',"image":'"'$id'"'}' - +# Publish ABOUT +sbot publish --type about --about $ssbpub --description "Welcome to [Astroport](https://astroport.com) G1SSB/IPFS Station [$IPFSNODEID](http://localhost:8080/ipns/$IPFSNODEID)" --name "$USER@$(cat /etc/hostname)" --image "$id" +# Publish QRCode FILE post sbotc publish '{"type":"post","text":"[G1SSB_Wallet.png]('"$id"')\nUse https://cesium.app to send payment.\nComment your transaction with '"'Zen'"' to order ZenTag...","mentions":[{"link":"'"$id"'","name":"'"$name"'","size":'"$size"',"type":"'"$type"'"}]}' # COPY NODE G1SSB ID to IPFS echo "$ssbpub" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_ssb.whoami echo "$NODE_G1PUBKEY" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.pubkey +IWALLETS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1) +NODEIPNS=$(ipfs name publish --quieter /ipfs/$IWALLETS) + + + +echo " + + + /\ |_ _ _|_ +/--\|_)(_)|_||_ + +$ssbpub + +http://localhost:8080/ipns/$IPFSNODEID/.$IPFSNODEID/G1SSB/ + +INVITATION : $(sbotc invite.create 1) + +" diff --git a/zen/zen_MAKE.sh b/zen/zen_MAKE.sh index bc20f2f..1a90345 100755 --- a/zen/zen_MAKE.sh +++ b/zen/zen_MAKE.sh @@ -204,15 +204,15 @@ READ : $READ Zen PARK : $PARK Zen " - +fi ######################################################################## -# PASSENGER DIRECTORY +# if [[ -d $PASSENGER ]]; then ######################################################################## # TODO # tar.gz and encrypt a whole directory # # tar -zcf - directory | openssl aes-128-cbc -pbkdf2 -k "$BB" -salt -out directory.tar.gz.aes # Encrypt # openssl aes-128-cbc -pbkdf2 -k "$BB" -d -salt -in directory.tar.gz.aes | tar -xz -f - # Decrypt ######################################################################## -fi + ########################################################### # Copy TAG into IPFS + ipfs name publish -k ${AA}.key @@ -275,6 +275,19 @@ qrencode -s 5 -o ~/.zen/tag/${AAH}/_QRCODE.write.png "BJ:${BB}#${J}" echo "DONE !! ${AA}" +######################################################################## +# SBOT PUBLISH +######################################################################## +echo ' + __ _ ____ +(_ |_)/ \| +__)|_)\_/| + +' +sbotc publish '{"type":"post","text":"ZenTAG created"}' + + + ######################################################################## # IPFS CLEANING (MANUAL OPERATION) ########################################################################