Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to configure if pushkey should be converted to hex before sending to APNs #344

Merged
merged 6 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sygnal.yaml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ apps:
# #
# # The default is 'production'. Uncomment to use the sandbox instance.
# #platform: sandbox
# #
# # Specifies whether to use a hexadecimally encoded push token. If True
# # (default) the pushkey received is trancoded from base64 to hex. If False
# # the pushkey received is passed to APNs as is.
# #apns_device_token_use_hex: false
clokep marked this conversation as resolved.
Show resolved Hide resolved

# This is an example GCM/FCM push configuration.
#
Expand Down
5 changes: 4 additions & 1 deletion sygnal/apnspushkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,10 @@ async def _dispatch_request(
log.info(f"Sending as APNs-ID {notif_id}")
span.set_tag("apns_id", notif_id)

device_token = base64.b64decode(device.pushkey).hex()
if self.get_config("apns_device_token_use_hex", bool, True):
danbim marked this conversation as resolved.
Show resolved Hide resolved
device_token = base64.b64decode(device.pushkey).hex()
else:
device_token = device.pushkey

request = NotificationRequest(
device_token=device_token,
Expand Down