mirror of
https://github.com/Sneed-Group/pypush-plus-plus
synced 2025-01-09 17:33:47 +00:00
trying something
This commit is contained in:
parent
7c18293986
commit
33c30ffdc5
1 changed files with 12 additions and 0 deletions
12
printer.py
12
printer.py
|
@ -153,6 +153,18 @@ def pretty_print_payload(prefix, payload: tuple[int, list[tuple[int, bytes]]]) -
|
||||||
# if it has apsd -> APNs in the prefix, it's an outgoing notification
|
# if it has apsd -> APNs in the prefix, it's an outgoing notification
|
||||||
if "apsd -> APNs" in prefix:
|
if "apsd -> APNs" in prefix:
|
||||||
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKBLUE}OUTGOING Notification{bcolors.ENDC}")
|
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKBLUE}OUTGOING Notification{bcolors.ENDC}")
|
||||||
|
# Duplicate the payload to send it twice, but with a different ID
|
||||||
|
payload1 = apns._serialize_payload(payload[0], payload[1])
|
||||||
|
for i in range(len(payload[1])):
|
||||||
|
if payload[1][i][0] == 0x4:
|
||||||
|
payload[1][i] = (0x4, (int.from_bytes(payload[1][i][1]) + 1).to_bytes(4, "big"))
|
||||||
|
#payload[1][i] = (None, None)
|
||||||
|
payload2 = apns._serialize_payload(payload[0], payload[1])
|
||||||
|
for i in range(len(payload[1])):
|
||||||
|
if payload[1][i][0] == 0x4:
|
||||||
|
payload[1][i] = (0x4, (int.from_bytes(payload[1][i][1]) + 1).to_bytes(4, "big"))
|
||||||
|
payload3 = apns._serialize_payload(payload[0], payload[1])
|
||||||
|
return (payload1 + payload2 + payload3)
|
||||||
else:
|
else:
|
||||||
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Notification{bcolors.ENDC}")
|
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Notification{bcolors.ENDC}")
|
||||||
for field in payload[1]:
|
for field in payload[1]:
|
||||||
|
|
Loading…
Reference in a new issue