Support custom instance

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-03-17 20:41:14 +01:00
parent cfffb71765
commit d6926dea5e
Signed by: luzifer
GPG key ID: D91C3E91E4CAD6F5

View file

@ -1,6 +1,8 @@
#!/bin/bash
set -euo pipefail
: ${INSTANCE:=https://ots.fyi} # Where to reach the API of the instance (omit trailing slash)
deps=(curl jq)
for cmd in "${deps[@]}"; do
which ${cmd} >/dev/null || {
@ -28,9 +30,9 @@ id=$(
-X POST \
-H 'content-type: application/json' \
-d "$(jq --arg secret "${ciphertext}" -cn '{"secret": $secret}')" \
https://ots.fyi/api/create |
"${INSTANCE}/api/create" |
jq -r '.secret_id'
)
# Display URL to user
echo -e "Secret is now available at:\nhttps://ots.fyi/#${id}%7C${pass}"
echo -e "Secret is now available at:\n${INSTANCE}/#${id}%7C${pass}"