Super simple and small Web Push and Notification service
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

22 linhas
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"