Super simple and small Web Push and Notification service
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

22 lines
544 B

  1. #!/bin/sh -
  2. subinfo="$1"
  3. privkey="$2"
  4. claim="$3"
  5. if ! [ -f "$1" ] || [ $# != 1 -a $# != 3 ]; then
  6. echo "Usage: $0 <subinfo> [ <pemprivkey> <claimtxt> ]"
  7. exit 1
  8. fi
  9. tmpfname="tmp.pushinfo.$$"
  10. cat - > "$tmpfname"
  11. title=$(grep -i "^Subject:" "$tmpfname" | sed -e 's/.*:[ ]*//')
  12. jq --rawfile msg "$tmpfname" --arg title "$title" -n '{ "title": $title, "body": $msg, "icon" : "static/i-ico.png", "image" : "static/i-banner.png" }' |
  13. pywebpush -v --data /dev/stdin --info "$subinfo" \
  14. --key "${privkey}" --claims "${claim}"
  15. rm "$tmpfname"