diff --git a/push_impl.wxpusher.sh b/push_impl.wxpusher.sh new file mode 100644 index 0000000..a4244fc --- /dev/null +++ b/push_impl.wxpusher.sh @@ -0,0 +1,26 @@ + +## --------- push via wxpusher + +## need conf +# wxpusher_spt= + +## use simple-push +## msg is html //also support 1-text, 2-html, 3-markdown +do_push_wxpusher(){ + local tit="$1" + local msg="$2" + curl -s https://wxpusher.zjiecode.com/api/send/message/simple-push \ + -H 'Content-Type: application/json' -d @- <<-EOF + { + "content":"$msg", + "summary":"$tit", + "contentType":2, + "spt":"$wxpusher_spt" + } + EOF + echo + # echo "==`date -Is`: $tit: $msg" >&2 +} + +## note: this file indent need to be tabs, cause bash here-doc + diff --git a/push_notify.sh b/push_notify.sh index 33c4b43..1b8fb13 100644 --- a/push_notify.sh +++ b/push_notify.sh @@ -12,6 +12,7 @@ do_push_notify(){ case "$push_backend" in telegram) do_push_telegram "$tit" "$msg";; pushplus) do_push_pushplus "$tit" "$msg";; + wxpusher) do_push_wxpusher "$tit" "$msg";; serverchan) do_push_serverchan "$tit" "$msg";; *) echo 'choose a push backend by set PUSH_BACKEND';; esac @@ -24,6 +25,7 @@ load_push_impl(){ case "$push_backend" in telegram) source $dir/push_impl.telegram.sh;; pushplus) source $dir/push_impl.pushplus.sh;; + wxpusher) source $dir/push_impl.wxpusher.sh;; serverchan) source $dir/push_impl.serverchan.sh;; *) echo 'choose a push backend by set PUSH_BACKEND';; esac