mirror of
https://github.com/jb55/nostril.git
synced 2025-08-11 19:10:46 -04:00
.github
deps
devtools
doc
scripts
git-send-nostr
nostril-post
nostril-relay
.envrc
.gitignore
.gitmodules
CHANGELOG
COPYING
Makefile
README.md
aes.c
aes.h
base64.c
base64.h
compiler.h
configurator.c
cursor.h
default.nix
endian.h
hex.h
nostril-query
nostril.c
proof.h
random.h
sha256.c
sha256.h
shell.nix
38 lines
551 B
Bash
Executable File
38 lines
551 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
TMP=$(mktemp)
|
|
|
|
$EDITOR "$TMP"
|
|
|
|
if [ ! -f "$TMP" ]; then
|
|
printf "could not create temporary file\n" >&2
|
|
exit 1
|
|
fi
|
|
|
|
content="$(cat $TMP)"
|
|
|
|
re="^[[:space:]]*$"
|
|
if [[ "$content" =~ $re ]]; then
|
|
printf "note empty. aborting.\n" >&2
|
|
exit 2
|
|
fi
|
|
|
|
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 "$note\n"
|
|
<<<"$note" nostril relay
|
|
printf "done.\n" >&2
|
|
|
|
rm -f "$TMP"
|