Skip to content

Commit

Permalink
U push_notify.sh, push_impl.wxpusher.sh: add push backed wxpusher
Browse files Browse the repository at this point in the history
  • Loading branch information
yurenchen000 committed Oct 22, 2024
1 parent 154f3f6 commit af8ec39
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
26 changes: 26 additions & 0 deletions push_impl.wxpusher.sh
Original file line number Diff line number Diff line change
@@ -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

2 changes: 2 additions & 0 deletions push_notify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit af8ec39

Please sign in to comment.