[fix] Bit of renaming things

This commit is contained in:
alban 2020-05-18 01:10:06 +02:00
parent e77830a144
commit d296e615e9
6 changed files with 71 additions and 52 deletions

View file

@ -0,0 +1,16 @@
#!/bin/bash
# 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 )
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
URL=$( curl -X POST -s -d "$(cat "$FILE" )" "$HASTEBIN_SERVER/documents" | awk -F '"' '{print "'$HASTEBIN_SERVER'/raw/"$4}'; )
echo "$FILE: $URL" >> $TMP
}

View file

@ -0,0 +1,18 @@
#!/bin/bash
# Sends the changelog information to a changelog server
# see https://git.interhacker.space/alban/changelog-server
# Requires environmental variables to work
# CHANGELOG_SERVER
# CHANGELOG_AUTH_KEY
PLUGIN_OUTPUT+=( hookOutputChangelogServer )
hookOutputChangelogServer(){
[[ -z "$1" ]] && echo "Sending changelog to remote server" && return
[[ -z "$CHANGELOG_SERVER" ]] && echo "Missing CHANGELOG_SERVER variable. Exiting." && return
[[ -z "$CHANGELOG_AUTH_KEY" ]] && echo "Missing CHANGELOG_AUTH_KEY variable. Exiting." && return
CONTENT=$(jq -aRs . $1|tr '"' '\"')
PAYLOAD="{\"author\":\"$CHANGELOG_USERNAME\",\"server\":\"$(hostname -f)\",\"content\":${CONTENT}}"
URL=$( curl -X POST -H "AuthorizationToken: $CHANGELOG_AUTH_KEY" -H "Content-Type: application/json" -s -d "${PAYLOAD}" "$CHANGELOG_SERVER/changelog/_doc"; )
[[ 0 -ne $? ]] && echo "Failed to upload the changelog..." && return
echo "$FILE: $URL" >> $TMP
}