Repository navigation
Pass a sealed preview through to the phone (GRYT-1688) - #3
Merged
Merged
Conversation
A push can now carry `preview`: who wrote, where, and the first line, sealed by the server to a key only the phone has. The relay checks that it's base64url of a sane length, and forwards it without opening it: - APNs: top-level `p`, plus `mutable-content: 1` so iOS hands it to the app's notification extension before showing it - FCM: `data.p`. Android still shows the fixed text for now (GRYT-1698). The relay's own text is still sent, so a phone that can't open the preview shows "New message" as before. A push without a preview is byte for byte what it was. The server half is in Gryt-chat/server and the phone half in Gryt-chat/mobile (linked below). What to look at: `PREVIEW_SHAPE` caps it at 2,048 characters, well under APNs' 4 KB with the rest of the payload. This is the first thing a server sends that ends up on screen, but it can't be read here, and the relay's text is unchanged. Tests: a preview reaches the sender untouched, APNs gets `mutable-content` and `p`, and FCM gets `data.p`. A push without one is unchanged. Bad shapes get a 400 and send nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A push can now carry
preview: who wrote, where, and the first line, sealed by the server to a key only the phone has. The relay checks that it's base64url of a sane length, and forwards it without opening it:p, plusmutable-content: 1so iOS hands it to the app's notification extension before showing itdata.p. Android still shows the fixed text for now (GRYT-1698).The relay's own text is still sent, so a phone that can't open the preview shows "New message" as before. A push without a preview is byte for byte what it was.
The server half is Gryt-chat/server#286 and the phone half is Gryt-chat/mobile#316.
What to look at:
PREVIEW_SHAPEcaps it at 2,048 characters, well under APNs' 4 KB with the rest of the payload. This is the first thing a server sends that ends up on screen, but it can't be read here, and the relay's text is unchanged.Tests: a preview reaches the sender untouched, APNs gets
mutable-contentandp, and FCM getsdata.p. A push without one is unchanged. Bad shapes get a 400 and send nothing.🤖 Generated with Claude Code