Commit c80d4944 authored by nimrod's avatar nimrod
Browse files

Handle forms in spammer.

With the new spam page in my site, I'm using an HTML form. Handle both
the simpler POSTs and the HTML forms.
parent 869d3f58
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
#!/bin/sh
set -eu

URL='https://patchbay.pub/pubsub/1446c969-9a54-4b5b-83e0-bf88f22f289d'

while true
do
    # Backoff in case of an error.
    if ! notify-send \
    message="$(curl --silent "$URL")"
    exitstatus="$?"
    if echo "$message" | grep --silent '^message='
    then
        message="$(echo "$message" | sed 's/message=//; s/+/ /g')"
    fi
    notify-send \
        --urgency low \
        --hint "string:desktop-entry:spammer" \
        "$(curl --silent https://patchbay.pub/pubsub/1446c969-9a54-4b5b-83e0-bf88f22f289d)"
        "$message"
    # Backoff in case of an error.
    if [ "$exitstatus" -gt '0' ]
    then
        sleep 1
    fi