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.
 
 
 
 
 

32 lines
1.0 KiB

  1. PYTHON=python3
  2. .PHONY: run
  3. run: templates/S2_perm_sw.html templates/S4_server.py venv static/i-ico.png static/i-banner.png
  4. ($(VENVACT) && python templates/S4_server.py )
  5. VENVACT=. ./venv/bin/activate
  6. venv:
  7. $(PYTHON) -m venv venv && ( $(VENVACT) && pip install flask ecdsa pywebpush) || rm -rf venv
  8. # python S1_vapid.py
  9. templates/S2_perm_sw.html: src/S2_perm_sw.html keys/public_key.txt
  10. mkdir -p templates
  11. sed -e 's/YOUR-PUBLIC-KEY/'"$$(cat keys/public_key.txt)"'/' < src/S2_perm_sw.html > templates/S2_perm_sw.html
  12. templates/S4_server.py: src/S4_server.py keys/private_key.txt
  13. if [ -z "$(EMAIL)" ]; then echo Must specify EMAIL.; exit 1; fi
  14. mkdir -p templates
  15. sed -e 's/your@email.com/$(EMAIL)/' -e 's/YOUR-PRIVATE-KEY/'"$$(cat keys/private_key.txt)"'/' < src/S4_server.py > templates/S4_server.py
  16. # XXX - HOST_* and VAPID_SUBJECT
  17. keys/public_key.txt keys/private_key.txt: venv S1_vapid.py
  18. ( $(VENVACT) && python S1_vapid.py )
  19. static/i-ico.png:
  20. echo P6 1 1 255 255 0 0 | pnmtopng > $@
  21. static/i-banner.png:
  22. echo P6 1 1 255 0 0 255 | pnmtopng > $@