|
@ -2,8 +2,9 @@ |
|
|
# |
|
|
# |
|
|
# Setup with `pip install -r requirements.txt` and then `source venv/bin/activate` |
|
|
# Setup with `pip install -r requirements.txt` and then `source venv/bin/activate` |
|
|
# |
|
|
# |
|
|
# Usage: python webpush.py "ENDPOINT|P256DH|AUTH" PRIVATE_KEY |
|
|
# Usage: python webpush.py "ENDPOINT|P256DH|AUTH" PRIVATE_KEY TITLE |
|
|
# ... where, yes, that second arg includes the "|" character, matching sqlite output. |
|
|
# ... where, yes, that second arg includes the "|" character, matching sqlite output. |
|
|
|
|
|
# A title of "DIRECT_NOTIFICATION" will show a message, bypassing TimeSafari filters. |
|
|
|
|
|
|
|
|
from pywebpush import webpush, WebPushException |
|
|
from pywebpush import webpush, WebPushException |
|
|
|
|
|
|
|
@ -42,8 +43,14 @@ if len(sys.argv) > 1: |
|
|
if len(parts) > 2: |
|
|
if len(parts) > 2: |
|
|
subscription_info['keys']['auth'] = parts[2] |
|
|
subscription_info['keys']['auth'] = parts[2] |
|
|
|
|
|
|
|
|
|
|
|
title = "Test" |
|
|
|
|
|
if len(sys.argv) > 3: |
|
|
|
|
|
title = sys.argv[3] |
|
|
|
|
|
|
|
|
now = datetime.datetime.now().isoformat() |
|
|
now = datetime.datetime.now().isoformat() |
|
|
data = json.dumps({"title": "test", "message": f"Message at {now}"}) |
|
|
message = f"Message at {now}" |
|
|
|
|
|
|
|
|
|
|
|
data = json.dumps({"title": title, "message": message}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|