From c02abb516c16c5178f44a171f05457092dc5a988 Mon Sep 17 00:00:00 2001 From: shimun Date: Sat, 12 Dec 2020 14:23:37 +0100 Subject: [PATCH] client script --- bp.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 bp.sh diff --git a/bp.sh b/bp.sh new file mode 100755 index 0000000..59068d8 --- /dev/null +++ b/bp.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +BP_ENDPOINT=${BROWNPAPER_ENDPOINT:-https://shimun.net/bp} +CURL_ARGS="--write-out %{url_effective}\\n --silent -o /dev/null" +GPG_ARGS="$([ ! -z "$BROWNPAPER_KEY" ] && echo "--local-user $BROWNPAPER_KEY")" +if [ ! -z "$1" ]; then + printf "$1" | gpg --sign -a $GPG_ARGS | curl -s --data @- -X POST $BP_ENDPOINT/new -Ls $CURL_ARGS +else + gpg --sign -a $GPG_ARGS | curl -s --data @- -X POST $BROWNPAPER_ENDPOINT/new -Ls $CURL_ARGS +fi