[fix] content hastebin should work

This commit is contained in:
alban 2020-06-03 21:51:32 +02:00
parent 68bd4f90d3
commit 8890984007
1 changed files with 4 additions and 4 deletions

View File

@ -1,15 +1,15 @@
#!/bin/bash
# Sends the changelog information to a changelog server
# see https://git.interhacker.space/alban/changelog-server
# Adds a line by sending a file to a hastebin server
# and then print a "/a/file/name https://haste.bin/urlurlurl" line
# Requires an environmental variable to work
# ex: HASTEBIN_SERVER=https://paste.interhacker.space
# example HASTEBIN_SERVER=https://paste.interhacker.space
PLUGIN_CONTENT+=( hookContentHastebin )
hookContentHastebin(){
[[ -z "$1" ]] && echo "Store a file by name in pastebin" && return
[[ -z "$HASTEBIN_SERVER" ]] && echo "Missing HASTEBIN_SERVER variable. Exiting." && return
TMP="$1"
read -e -p "File location? " FILE
[[ ! -f $FILE ]] && panic "Not a valid file" && exit
[[ ! -f $FILE ]] && panic "Not a valid file" && return
URL=$( curl -X POST -s -d "$(cat "$FILE" )" "$HASTEBIN_SERVER/documents" | awk -F '"' '{print "'$HASTEBIN_SERVER'/raw/"$4}'; )
echo "$FILE: $URL" >> $TMP
}