cleanup scripts

This commit is contained in:
William Casarin 2022-12-01 06:42:27 -08:00
parent 0ee25a0afa
commit f9ec1d1aa3
5 changed files with 27 additions and 9 deletions

View File

@ -1,2 +0,0 @@
#!/usr/bin/env bash
echo '["REQ","",{"kinds":[0],"authors":["'$1'"]}]'

View File

@ -1,2 +0,0 @@
#!/usr/bin/env bash
websocat "$@" wss://relay.damus.io

View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
jq -c '["EVENT",.]' | websocat wss://relay.damus.io

View File

@ -19,11 +19,19 @@ if [[ "$content" =~ $re ]]; then
exit 2 exit 2
fi fi
note=$(nostril "$@" --content "$content") sec=""
if command -v git; then
key=$(git config nostr.secretkey)
if [ $key != "" ]; then
sec="--sec $key"
fi
fi
note=$(nostril --envelope $sec "$@" --content "$content")
printf "relaying:\n" >&2 printf "relaying:\n" >&2
printf "$note\n" printf "$note\n"
<<<"$note" nostr-relay-note <<<"$note" nostril relay
printf "done.\n" >&2 printf "done.\n" >&2
rm -f "$TMP" rm -f "$TMP"

17
scripts/nostril-relay Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
relays=${NOSTR_RELAYS:-$(git config nostr.relays)}
relayer=${NOSTR_RELAYER:-nostcat}
to_stdout=0
if ! command -v $relayer; then
printf "nostr relayer '%s' not found. Please install or set NOSTR_RELAYER to your preferred relayer.\n" "$relayer"
exit 1
fi
if [ "$relays" == "" ]; then
printf 'no relays set. set\n\n export NOSTR_RELAYS="wss://relay1.com wss://relay2.com ..." or\n\n git config --global --add nostr.relays "wss://relay1.com wss://relay2.com"\n' >&2
exit 1
fi
$relayer $relays