diff --git a/zen/cron_MINUTE.sh b/zen/cron_MINUTE.sh index 413c100..0026501 100755 --- a/zen/cron_MINUTE.sh +++ b/zen/cron_MINUTE.sh @@ -11,9 +11,9 @@ ME="${0##*/}" ipfsnodeid=$(/usr/local/bin/ipfs id -f='\n') g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) -# TIME -minute=$(date +%M) -heure=$(date +%H) +# UNIVERSAL TIME (TODO ntpdate, but sudo problem) +minute=$(date -u +%M) +heure=$(date -u +%H) timebar="$heure:$minute" jourdelasemaine=$(date +%w) jourdumois=$(date +%d) diff --git a/zen/ssb_INIT.sh b/zen/ssb_INIT.sh index 66fd793..7228b54 100755 --- a/zen/ssb_INIT.sh +++ b/zen/ssb_INIT.sh @@ -47,15 +47,32 @@ g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) # IPFS LOCAL REPOSITORY for Node Identity G1 + SSB mkdir -p ~/.zen/ipfs/.$ipfsnodeid/G1SSB + +# PUBLISH ipfs informations sbotc publish '{"type":"ipfsnodeid","text":"'"$ipfsnodeid"'"}' sbotc publish '{"type":"ipfstryme","text":"'"$(ipfs id | jq -r .Addresses[] | tail -n 1)"'"}' +# ADD Cesium+ informations +# GET CESIUM+ geoPoint DATA (TODO install , load balance CesiumPod?) +CESIUM="https://g1.data.le-sou.org" +geopointlat=$(curl -s ${CESIUM}/user/profile/${g1pub} | jq '._source.geoPoint.lat') +[[ $geopointlat != null ]] && sbotc publish '{"type":"cesium_geoPoint.lat","text":"'"$geopointlat"'"}' +geopointlon=$(curl -s ${CESIUM}/user/profile/${g1pub} | jq '._source.geoPoint.lon') +[[ $geopointlon != null ]] && sbotc publish '{"type":"cesium_geoPoint.lon","text":"'"$geopointlon"'"}' + +# GET Cesium+ Avatar image +curl -s ${CESIUM}/user/profile/${g1pub} | jq '._source.avatar._content' | sed 's/\"//g' | base64 -d > "/tmp/avatar.png" + + ## PUBLISH ABOUT MESSAGE ############################################## -# IMAGE of G1 wallet QRCode -qrcodefile=~/.zen/ipfs/.$ipfsnodeid/G1SSB/_g1.qrcode.png -qrencode -s 5 -o $qrcodefile "$g1pub" - +# IF AVATAR not png take IMAGE of G1 wallet QRCode +if [[ ! $(file "/tmp/avatar.png" | grep 'PNG') ]]; then + qrcodefile=~/.zen/ipfs/.$ipfsnodeid/G1SSB/_g1.qrcode.png + qrencode -s 5 -o $qrcodefile "$g1pub" +else + qrcodefile=/tmp/avatar.png +fi # Prepare QRCode File for SSB name=${qrcodefile##*/} id="$(sbotc blobs.add < $qrcodefile)" @@ -84,7 +101,7 @@ $g1pub -- sbotc publish -- " -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"'"}]}' +sbotc publish '{"type":"post","text":"[G1SSB_Wallet.png]('"$id"')\nUse https://cesium.app to send payment.\nComment your transaction with '"'Zen'"' to make ZenTag...","mentions":[{"link":"'"$id"'","name":"'"$name"'","size":'"$size"',"type":"'"$type"'"}]}' echo "