2042 on Nostr: commit e399ebfac74d6536751cbe266f8cf5b07e0c57f7 Author: randymcmillan ...
commit e399ebfac74d6536751cbe266f8cf5b07e0c57f7 Author: randymcmillan <randymcmillan@protonmail.com> Date: Fri Jul 12 11:04:15 2024 -0400 template/gnostr-post:gnostr-post:ARG1 ARG2 --sec --content use gnostr-post-event diff --git a/template/gnostr-post b/template/gnostr-post index a131f37e1..f096eca80 100755 --- a/template/gnostr-post +++ b/template/gnostr-post @@ -4,58 +4,69 @@ set -e #uxo pipefail ##echo $1 $2 -WEEBLE=${gnostr-weeble:-} -WOBBLE=${gnostr-wobble:-} -#echo $WEEBLE -#echo $WOBBLE - -##RELAYS=$(curl '
https://api.nostr.watch/v1/online'; 2>/dev/null | -## sed -e 's/[{}]/''/g' | -## sed -e 's/\[/''/g' | -## sed -e 's/\]/''/g' | -## sed -e 's/"//g' | -## awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}') 2>/dev/null -## -##if [[ ! -z "$RELAYS" ]]; -##then -## for r in $RELAYS; -## do -## echo #$r -## done -##fi -## -###exit; - +WEEBLE=$(gnostr-weeble || 0) +BLOCK=$(gnostr-blockheight || 0) +WOBBLE=$(gnostr-wobble || 0) +echo $WEEBLE +echo $BLOCK +echo $WOBBLE + +## gnostr-post +## gnostr-post --sec ARG=${1:-} -CONTENT=${2:-#gnostr} - +## gnostr-post --sec $(gnostr-sha256) +SEC=${2:-0000000000000000000000000000000000000000000000000000000000000001} +## gnostr-post --sec $(gnostr-sha256) --content "this is a message" +ARG2=${3:-} + +version(){ + + printf "v0.0.0"; +exit; +} +help(){ + + printf "gnostr-post -h --help\n"; + printf " -v --version\n"; + printf " \n"; + printf " --sec <sha256>\n"; + printf " --sec <sha256> --content \"<string>\"\n"; +exit; +} if [[ $ARG == "-h" ]]; then - printf "gnostr-post help"; exit; +help fi if [[ $ARG == "--help" ]]; then - printf "gnostr-post help"; exit +help fi if [[ $ARG == "help" ]]; then - printf "gnostr-post help"; exit +help fi if [[ $ARG == "-v" ]]; then - printf "v0.0.1"; exit + version fi if [[ $ARG == "--version" ]]; then - printf "v0.0.0"; exit + version +fi +if [[ $ARG == "--sec" ]]; +then + SEC=$2 +fi + ##ARG1 ##SEC ##ARG2 ##CONTENT +## gnostr-post --sec $(gnostr-sha256) --content "this is a message" +if [[ $ARG2 == "--content" ]]; +then + ARG_CONTENT=$4 fi TMP=$(mktemp) -if [[ $ARG == "--content" ]]; -then - echo $CONTENT > $TMP -fi +echo $ARG_CONTENT > $TMP $EDITOR "$TMP" @@ -72,45 +83,44 @@ if [[ "$content" =~ $re ]]; then exit 2 fi -sec="" -if command -v gnostr-git >/dev/null; then - key=$(gnostr-git config gnostr.secretkey) || \ - key=0000000000000000000000000000000000000000000000000000000000000000 ##technically an invalid secretkey - if [ $key != "" ]; then - sec="--sec $key" - fi -elif command -v git >/dev/null; then - key=$(git config nostr.secretkey) || \ - key=0000000000000000000000000000000000000000000000000000000000000000 ##technically an invalid secretkey - if [ $key != "" ]; then - sec="--sec $key" - fi -fi - -note=$(gnostr --envelope $sec "$@" -t gnostr -t $(gnostr-weeble) -t $(gnostr-blockheight) -t $(gnostr-wobble) --content "#gnostr:$content") - -RELAYS=$(curl '
https://api.nostr.watch/v1/online'; 2>/dev/null | +## sec="" +## if command -v gnostr-git >/dev/null; then +## key=$(gnostr-git config gnostr.secretkey) || \ +## key=0000000000000000000000000000000000000000000000000000000000000000 ##technically an invalid secretkey +## if [ $key != "" ]; then +## sec="--sec $key" +## fi +## elif command -v git >/dev/null; then +## key=$(git config nostr.secretkey) || \ +## key=0000000000000000000000000000000000000000000000000000000000000000 ##technically an invalid secretkey +## if [ $key != "" ]; then +## sec="--sec $key" +## fi +## fi + +note=$(gnostr --sec $SEC "$@" -t gnostr -t $(gnostr-weeble) -t $(gnostr-blockheight) -t $(gnostr-wobble) --content "$content") + +RELAYS=$(gnostr-get-relays -s) || $(curl '
https://api.nostr.watch/v1/online'; 2>/dev/null | sed -e 's/[{}]/''/g' | sed -e 's/\[/''/g' | sed -e 's/\]/''/g' | sed -e 's/"//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}') 2>/dev/null - #echo $RELAYS # ##printf "relaying:\n" >&2 printf "$note\n" -<<<"$note" gnostr-cat -1 wss://relay.damus.io || true +<<<"$note" gnostr-post-event wss://relay.damus.io || true #printf "done.\n" >&2 printf "$note\n" -<<<"$note" gnostr-cat -1 wss://nos.lol || true +<<<"$note" gnostr-post-event wss://nos.lol || true #printf "done.\n" >&2 for r in $RELAYS; do ##printf "relaying:\n" >&2 printf "$note\n" -<<<"$note" gnostr-cat -1 $r || true +<<<"$note" gnostr-post-event $r || true #printf "done.\n" >&2 done
Published at
2024-07-12 15:06:17Event JSON
{
"id": "9c78d0fbe763a53a63164f3e65c607e07b21fc655e5e2246d66c208f54566439",
"pubkey": "a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd",
"created_at": 1720796777,
"kind": 1,
"tags": [
[
"t",
"gnostr"
],
[
"t",
"2020"
],
[
"t",
"851854"
],
[
"t",
"51697"
]
],
"content": "commit e399ebfac74d6536751cbe266f8cf5b07e0c57f7 Author: randymcmillan \u003crandymcmillan@protonmail.com\u003e Date: Fri Jul 12 11:04:15 2024 -0400 template/gnostr-post:gnostr-post:ARG1 ARG2 --sec --content use gnostr-post-event diff --git a/template/gnostr-post b/template/gnostr-post index a131f37e1..f096eca80 100755 --- a/template/gnostr-post +++ b/template/gnostr-post @@ -4,58 +4,69 @@ set -e #uxo pipefail ##echo $1 $2 -WEEBLE=${gnostr-weeble:-} -WOBBLE=${gnostr-wobble:-} -#echo $WEEBLE -#echo $WOBBLE - -##RELAYS=$(curl 'https://api.nostr.watch/v1/online' 2\u003e/dev/null | -## sed -e 's/[{}]/''/g' | -## sed -e 's/\\[/''/g' | -## sed -e 's/\\]/''/g' | -## sed -e 's/\"//g' | -## awk -v k=\"text\" '{n=split($0,a,\",\"); for (i=1; i\u003c=n; i++) print a[i]}') 2\u003e/dev/null -## -##if [[ ! -z \"$RELAYS\" ]]; -##then -## for r in $RELAYS; -## do -## echo #$r -## done -##fi -## -###exit; - +WEEBLE=$(gnostr-weeble || 0) +BLOCK=$(gnostr-blockheight || 0) +WOBBLE=$(gnostr-wobble || 0) +echo $WEEBLE +echo $BLOCK +echo $WOBBLE + +## gnostr-post +## gnostr-post --sec ARG=${1:-} -CONTENT=${2:-#gnostr} - +## gnostr-post --sec $(gnostr-sha256) +SEC=${2:-0000000000000000000000000000000000000000000000000000000000000001} +## gnostr-post --sec $(gnostr-sha256) --content \"this is a message\" +ARG2=${3:-} + +version(){ + + printf \"v0.0.0\"; +exit; +} +help(){ + + printf \"gnostr-post -h --help\\n\"; + printf \" -v --version\\n\"; + printf \" \\n\"; + printf \" --sec \u003csha256\u003e\\n\"; + printf \" --sec \u003csha256\u003e --content \\\"\u003cstring\u003e\\\"\\n\"; +exit; +} if [[ $ARG == \"-h\" ]]; then - printf \"gnostr-post help\"; exit; +help fi if [[ $ARG == \"--help\" ]]; then - printf \"gnostr-post help\"; exit +help fi if [[ $ARG == \"help\" ]]; then - printf \"gnostr-post help\"; exit +help fi if [[ $ARG == \"-v\" ]]; then - printf \"v0.0.1\"; exit + version fi if [[ $ARG == \"--version\" ]]; then - printf \"v0.0.0\"; exit + version +fi +if [[ $ARG == \"--sec\" ]]; +then + SEC=$2 +fi + ##ARG1 ##SEC ##ARG2 ##CONTENT +## gnostr-post --sec $(gnostr-sha256) --content \"this is a message\" +if [[ $ARG2 == \"--content\" ]]; +then + ARG_CONTENT=$4 fi TMP=$(mktemp) -if [[ $ARG == \"--content\" ]]; -then - echo $CONTENT \u003e $TMP -fi +echo $ARG_CONTENT \u003e $TMP $EDITOR \"$TMP\" @@ -72,45 +83,44 @@ if [[ \"$content\" =~ $re ]]; then exit 2 fi -sec=\"\" -if command -v gnostr-git \u003e/dev/null; then - key=$(gnostr-git config gnostr.secretkey) || \\ - key=0000000000000000000000000000000000000000000000000000000000000000 ##technically an invalid secretkey - if [ $key != \"\" ]; then - sec=\"--sec $key\" - fi -elif command -v git \u003e/dev/null; then - key=$(git config nostr.secretkey) || \\ - key=0000000000000000000000000000000000000000000000000000000000000000 ##technically an invalid secretkey - if [ $key != \"\" ]; then - sec=\"--sec $key\" - fi -fi - -note=$(gnostr --envelope $sec \"$@\" -t gnostr -t $(gnostr-weeble) -t $(gnostr-blockheight) -t $(gnostr-wobble) --content \"#gnostr:$content\") - -RELAYS=$(curl 'https://api.nostr.watch/v1/online' 2\u003e/dev/null | +## sec=\"\" +## if command -v gnostr-git \u003e/dev/null; then +## key=$(gnostr-git config gnostr.secretkey) || \\ +## key=0000000000000000000000000000000000000000000000000000000000000000 ##technically an invalid secretkey +## if [ $key != \"\" ]; then +## sec=\"--sec $key\" +## fi +## elif command -v git \u003e/dev/null; then +## key=$(git config nostr.secretkey) || \\ +## key=0000000000000000000000000000000000000000000000000000000000000000 ##technically an invalid secretkey +## if [ $key != \"\" ]; then +## sec=\"--sec $key\" +## fi +## fi + +note=$(gnostr --sec $SEC \"$@\" -t gnostr -t $(gnostr-weeble) -t $(gnostr-blockheight) -t $(gnostr-wobble) --content \"$content\") + +RELAYS=$(gnostr-get-relays -s) || $(curl 'https://api.nostr.watch/v1/online' 2\u003e/dev/null | sed -e 's/[{}]/''/g' | sed -e 's/\\[/''/g' | sed -e 's/\\]/''/g' | sed -e 's/\"//g' | awk -v k=\"text\" '{n=split($0,a,\",\"); for (i=1; i\u003c=n; i++) print a[i]}') 2\u003e/dev/null - #echo $RELAYS # ##printf \"relaying:\\n\" \u003e\u00262 printf \"$note\\n\" -\u003c\u003c\u003c\"$note\" gnostr-cat -1 wss://relay.damus.io || true +\u003c\u003c\u003c\"$note\" gnostr-post-event wss://relay.damus.io || true #printf \"done.\\n\" \u003e\u00262 printf \"$note\\n\" -\u003c\u003c\u003c\"$note\" gnostr-cat -1 wss://nos.lol || true +\u003c\u003c\u003c\"$note\" gnostr-post-event wss://nos.lol || true #printf \"done.\\n\" \u003e\u00262 for r in $RELAYS; do ##printf \"relaying:\\n\" \u003e\u00262 printf \"$note\\n\" -\u003c\u003c\u003c\"$note\" gnostr-cat -1 $r || true +\u003c\u003c\u003c\"$note\" gnostr-post-event $r || true #printf \"done.\\n\" \u003e\u00262 done",
"sig": "1dcb8118d3a2d63536ab95cab9824948b433aeff537640713748151e8724359b391f51de12b00fd18b1748f93eb52568e86a86213599aee32b4210b37e01fe81"
}