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.
 
 
 
 
 

37 linhas
1.1 KiB

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