pubsub_setup: add -b option to set base URL to CGI program - pubsubhubbubblub -… | |
git clone git://git.codemadness.org/pubsubhubbubblub | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 584f6877875619a77ee4435d3e4621e560ae48eb | |
parent ded5d328be08e3616af355302645a98473f68bc0 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Sat, 28 May 2022 13:12:25 +0200 | |
pubsub_setup: add -b option to set base URL to CGI program | |
Remove unused -c option. Improve documentation. | |
Diffstat: | |
M README | 6 ++++-- | |
M pubsub_setup | 21 +++++++++++---------- | |
2 files changed, 15 insertions(+), 12 deletions(-) | |
--- | |
diff --git a/README b/README | |
@@ -123,13 +123,15 @@ Get the hub and feed URL: | |
Setup the feed structure for the CGI program and also subscribe to the hub usi… | |
cd /var/www/pubsub-data | |
- pubsub_setup -s 'slashdot' 'http://pubsubhubbub.appspot.com/' 'http://… | |
+ pubsub_setup -s -b 'https://codemadness.org/pubsub/' \ | |
+ 'slashdot' 'http://pubsubhubbub.appspot.com/' 'http://rss.slas… | |
Unsubscribe from a hub: | |
cd /var/www/pubsub-data | |
- pubsub_setup -u 'slashdot' 'http://pubsubhubbub.appspot.com/' 'http://… | |
+ pubsub_setup -u -b 'https://codemadness.org/pubsub/' \ | |
+ 'slashdot' 'http://pubsubhubbub.appspot.com/' 'http://rss.slas… | |
Monitor script example | |
diff --git a/pubsub_setup b/pubsub_setup | |
@@ -1,14 +1,23 @@ | |
#!/bin/sh | |
-while getopts "c:su" f; do | |
+while getopts "b:su" f; do | |
case "${f}" in | |
+ b) base="${OPTARG}";; | |
s) dosubscribe=1;; | |
u) dounsubscribe=1;; | |
esac | |
done | |
shift $(expr ${OPTIND} - 1) | |
-base="https://codemadness.org/pubsub/" | |
+feedname="$1" | |
+hub="$2" | |
+topic="$3" | |
+if test "$1" = "" -o "$2" = "" -o "$3" = "" -o "$base" = ""; then | |
+ printf "usage: %s <-b base_callback> [-s] [-u] <feedname> <hub> <topic… | |
+ exit 1 | |
+fi | |
+# make sure it has a / at the end. | |
+base="${base%%/}/" | |
# Linux | |
shacmd="$(command -v sha256sum)" | |
@@ -64,14 +73,6 @@ subscribe() { | |
fi | |
} | |
-feedname="$1" | |
-hub="$2" | |
-topic="$3" | |
-if test "$1" = "" -o "$2" = "" -o "$3" = ""; then | |
- printf "usage: %s [-s] [-u] <feedname> <hub> <topic>\n" "$0" >&2 | |
- exit 1 | |
-fi | |
- | |
isnew=1 | |
test -d "config/${feedname}" && isnew=0 | |