changelog/plugins-available/content-hastebin.sh

17 lines
717 B
Bash
Raw Normal View History

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