You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pairing links that open Pulse or the store, and survive the install (#252) - #267
This is the #252 branch: this first commit makes pairing links work as https links that open Pulse or the store. More commits for the rest of #252 land here (destination info on the link, the upload outcome and return to the host, watch links).
What changes
https pairing links.https://mieweb.github.io/pulse/open#v=1&artifactId=…&server=…&token=… is a Universal Link / App Link. app.config.ts declares mieweb.github.io (iOS associated domains; an Android autoVerify intent filter for /pulse/), fixed, with no env override. An Android debug build's key isn't in the host's assetlinks.json, so its links are switched on with adb shell pm set-app-links-user-selection (in the config comment). Parameters ride in the fragment, so the link host never receives them.
One parser, no navigation.pairingLinkParams reads both pulsecam://?… and the https form. +native-intent keeps the router on the current screen for both, so pairing opens over whatever is up (recorder, export, onboarding); pulsecam:// no longer collapses the stack to home. A bare pulsecam:// (Android's upload notification) is ignored instead of alerting.
Pairing sheet. Replaces the confirmation alert: the server, Connect / Cancel, and "Don't ask again for this server". Trusted servers pair without the sheet (an info toast says why); About lists them, with remove-one and Clear all, and Copy details includes them.
Pairing through a store install. Android reads the pairing link from the Play install referrer (expo-application) on first launch. iOS shows Apple's paste button for the link the /pulse/open page copied; it reads the pasteboard only on that tap, so iOS shows no paste prompt.
Log redaction also covers a #token= fragment.
The /pulse/open page (pages/open.html, served at https://mieweb.github.io/pulse/open with no trailing-slash redirect): Android goes to Play with the link as the install referrer, iOS copies the link on "Get Pulse" and opens the App Store, desktop shows a QR of the link, and "Already have Pulse? Open it" uses pulsecam://. It is the test host's page minus its debug log, and the QR script now loads with an integrity hash.
Testing
On an iPhone 17 Pro Max (iOS 26), on a build of the pulse-editor branch (#240) carrying these changes, with the link host pointed at morepriyam.github.io (a test host; the env override used for that has since been removed serving the association files and the /pulse/open page):
Pulse installed, app closed and app open: scanning the https QR with the Camera opened Pulse into the pairing sheet; Connect paired.
Pulse not installed: the page's "Get Pulse" opened the App Store; after installing (the dev build, standing in for the store), first launch showed the paste sheet; Paste paired, with no paste prompt, and it survived onboarding.
An old pulsecam:// QR (the demo server's page) opened Pulse over the current screen with the same sheet.
Apple's CDN served the test host's association file (app-site-association.cdn-apple.com/a/v1/morepriyam.github.io).
pages/open.html served locally, in Playwright (Chromium, desktop and iPhone emulation): desktop shows the QR (the integrity hash matches cdnjs's), iPhone shows "Get Pulse" and the pulsecam:// link, no console errors. Not opened on a phone from mieweb.github.io yet.
Typecheck: no errors in changed files; lint and Prettier clean; unit tests for the touched areas pass (upload, about, logs: 133).
Not confirmed on a device: a trusted server's next link pairing without the sheet (and its info toast).
Not run: Android (App Link verification, the store redirect, the install referrer and its size limit), the Play Store install path (needs an internal-track build), this branch's own build on main.
Before it goes live
iOS signing: the App ID now has the Associated Domains capability, which invalidates the existing provisioning profiles. Regenerate them (match with force) before the next iOS release build, or it fails to sign.
Link host: live. Serve the app-association files for Pulse links mieweb.github.io#1 is merged: both association files are served at the root with no redirect, Apple's CDN (app-site-association.cdn-apple.com/a/v1/mieweb.github.io) returns the Pulse entry, and Google's Digital Asset Links API returns both Play keys. The /pulse/open page goes live when this PR merges (the Pages workflow runs on pages/**).
…survive the install
Part of #252.
- An https pairing link (`https://<link host>/pulse/open#<params>`) is a
Universal Link / App Link: the app declares the host (associated
domains, an autoVerify intent filter for /pulse/), defaulting to
mieweb.github.io; PULSE_LINK_HOST points a local build at a test host.
Parameters ride in the fragment, so the link host never receives them.
- Both link forms parse to the same link, and `+native-intent` keeps the
router on the current screen for both, so pairing opens over whatever
is up. A bare `pulsecam://` (Android's upload notification) is ignored.
- The pairing sheet replaces the confirmation alert: the server, with
Connect / Cancel and "Don't ask again for this server". Trusted
servers pair without the sheet; About lists them (remove one, or clear
all) and Copy details includes them.
- After a store install: Android reads the pairing link from the Play
install referrer (expo-application); iOS offers Apple's paste button on
first launch for the link the /pulse/open page copied.
- Log redaction also covers a `#token=` fragment.
…th their text
The server glyph and the "Don't ask again" check on the pairing sheet, and the trusted-server
rows' check and the list's chevron on About, use Icon's scalesWithText (#266). The rows' trash
buttons keep their size.
…ulse
Served by this repo's Pages at https://mieweb.github.io/pulse/open (as
open.html, so there is no trailing-slash redirect). The page tested on the
test host, minus its debug log: Android goes to Play with the link as the
install referrer, iOS copies the link on the Get Pulse tap and opens the
App Store, desktop shows a QR of the link, and an installed Pulse opens via
pulsecam://. Parameters stay in the fragment. The QR script now loads with
an integrity hash.
The org host now serves the association files, so PULSE_LINK_HOST (a local
build pointed at a test host) has no use left. iOS dev builds match by team
and bundle ID and open the org host's links as they are; an Android debug
build's key isn't listed, so its links are switched on with adb, as the
comment says.
…request, launch URL resolved, honest privacy line
- The pairing sheet opens full height and scrolls at large text or on a
short screen, like About, so Connect is never cut off.
- "Don't ask again" belongs to the request it was ticked on: a link that
replaces it in the open sheet starts unticked.
- The deferred-pairing check asks for the launch URL itself instead of the
first render of useLinkingURL, which can be null on a cold start.
- About's trusted-servers list scrolls inside the full-height sheet on
Android (nestedScrollEnabled).
- /pulse/open: "This website never receives" the link's details; on
Android it adds that Google Play passes them to Pulse.
Trust is keyed by the full base URL, including its path prefix (trusted-servers.ts:24-27), but this row and its delete label reduce that identity to the host. Two servers such as https://vault.example.org/a and /b therefore appear identical, so the user cannot tell which trust they are removing. Display and announce the full stored base URL (or at least host plus path).
Persist deferred-check flag only after a successful probe
src/features/upload/deferred-pairing.ts:29
The one-shot flag is persisted before either platform probe succeeds. If the Play Install Referrer service is temporarily unavailable/disconnected (the Expo API rejects in those cases), or a clipboard/DB call fails, the outer catch swallows the error but every later launch sees deferredChecked=true; the pairing link is then permanently lost. Persist the flag only after a conclusive probe, and leave it unset when the probe fails so the next launch can retry.
Serialize trusted-server mutations to prevent lost updates
src/features/upload/trusted-servers.ts:46
This read-modify-write is not serialized. If two trusted rows are removed quickly, both calls can read the same original array and the last write restores the entry removed by the other call; trustServer and clearTrustedServers can race similarly. Serialize all trusted-server mutations (as src/db/destinations.ts:41-45 does) or update the value atomically.
- "Don't ask again" that fails to save still pairs, and the Connected
toast says the next link will ask first (a toast of its own would be
covered by it).
- Removing one trusted server that fails shows an error toast, like
Remove all.
Copilot's review of be0ea2b listed two previously missed findings with no thread. Both fixed in 5997948:
Individual trust removal lacks failure handling (about.tsx): the trash button's removal now shows an error toast when it fails, like Remove all.
Failed trust preference save is silently ignored (upload-deep-link-provider.tsx): pairing still goes ahead, and the "Connected to …" toast says Pulse couldn't save "Don't ask again", so its next link asks first. It's in that toast because a separate error toast would be replaced by it moments later. The second line the review cites (243 at be0ea2b) is the Cancel handler, which saves nothing; the only trust write is the one fixed here. A failed trust read (isTrustedServer) still falls back to asking, which is the safe side.
Not changed here: the review's summary also notes that opening the identical link again isn't processed. useLinkingURL only re-renders when the URL string changes, so (from reading the code, not tried on a device) re-opening the same link after Cancel does nothing until another link opens. That behaviour is on main too; it'll be its own fix.
Typecheck, lint and Prettier pass; the existing upload/about tests pass (125).
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The iOS fallback opens the store even when copying fails, losing the pairing through installation.
0 open findings
Previously missed (1)
In code that hasn't changed since last review
Avoid App Store redirect when pairing URL copy fails
pages/open.html:228
Both fallback paths still open the App Store when the clipboard API is unavailable or writeText rejects. The install then succeeds without a pairing URL on the pasteboard, so first launch cannot offer the promised deferred pairing. Only navigate after a successful copy; on failure, keep the page open and provide a retry or manual-copy fallback.
On iOS the copied link is what carries the pairing through the install.
If the copy fails or there's no clipboard API, the page no longer goes to
the App Store: it says how to finish (install, come back, "Open it") and
the button becomes "Open the App Store" for the next tap.
Copilot's review of 5997948 listed one previously missed finding with no thread, fixed in 60409f2:
Avoid App Store redirect when pairing URL copy fails (pages/open.html): when writeText rejects or there's no clipboard API, the page stays: it shows "Pulse couldn’t copy your link. Install Pulse, then come back to this page and tap “Already have Pulse? Open it”." and the button becomes "Open the App Store", which the next tap follows. The tab keeps the link, so "Open it" (pulsecam://) pairs after the install, and re-scanning the QR works too.
Checked in Playwright (Chromium, iPhone emulation, page served locally): copy succeeds → the page URL is copied and it goes to the App Store; copy rejected, and no clipboard API → no navigation, message shown, button relabelled, second tap goes to the App Store. Not yet run in Safari on an iPhone.
…ets the sheet
closed() kept the newer request but left the sheet marked open after the
route had gone, so the push effect never showed it. The route's close now
always clears the mark, and a waiting newer request bumps the effect to
push the sheet again.
Replacement requests can be dropped during swipe dismissal
src/features/upload/pairing-sheet.tsx:48
A replacement request can still be dropped during a swipe dismissal. The screen remains mounted during the closing transition, so if request B arrives after the swipe starts, this effect can change shown.current from A to B; the unmount cleanup then calls closed(B), and the provider sees B as the shown request and clears it instead of reopening it. If B arrives before these passive effects flush, the provider’s own requestRef can likewise still be stale. Snapshot the shown request when dismissal starts (or queue/version requests independently of passive effects) so arrivals after that point are preserved.
…as the dismissed one
The sheet stops tracking the current request once its closing transition
starts (native-stack transitionStart, closing: true; a swipe let go of
reopens with closing: false), so closed() reports the request it was
closed on and a newer one gets the sheet again. The provider keeps
requestRef in step at every set instead of in an effect, so closed() never
compares against a stale request.
Copilot's review of 0463a6b listed one previously missed finding with no thread, fixed in 29f8a40:
Replacement requests can be dropped during swipe dismissal (pairing-sheet.tsx): the sheet now listens for native-stack's transitionStart. From closing: true (the sheet's will-disappear) it stops updating shown, so its unmount reports the request it was closed on; a request that arrived during the closing animation is newer, so closed keeps it and the provider pushes the sheet again (0463a6b). A swipe that's let go of fires closing: false on will-appear and tracking resumes. The provider's requestRef is now set together with the state at every setRequest, not in an effect, so closed never compares against a stale value.
Typecheck, lint, Prettier and the existing upload tests pass. Checked by reading expo-router's native-stack view (will-disappear/will-appear emit transitionStart with closing true/false); the race itself hasn't been reproduced on a device.
The pinned server now documents the https link form this branch accepts
(mieweb/pulsevault#86). protocol.gen.ts regenerated: only the deep-link
description and the protocol revision change.
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
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.
Part of #252.
This is the #252 branch: this first commit makes pairing links work as https links that open Pulse or the store. More commits for the rest of #252 land here (destination info on the link, the upload outcome and return to the host, watch links).
What changes
https://mieweb.github.io/pulse/open#v=1&artifactId=…&server=…&token=…is a Universal Link / App Link.app.config.tsdeclaresmieweb.github.io(iOS associated domains; an AndroidautoVerifyintent filter for/pulse/), fixed, with no env override. An Android debug build's key isn't in the host'sassetlinks.json, so its links are switched on withadb shell pm set-app-links-user-selection(in the config comment). Parameters ride in the fragment, so the link host never receives them.pairingLinkParamsreads bothpulsecam://?…and the https form.+native-intentkeeps the router on the current screen for both, so pairing opens over whatever is up (recorder, export, onboarding);pulsecam://no longer collapses the stack to home. A barepulsecam://(Android's upload notification) is ignored instead of alerting.expo-application) on first launch. iOS shows Apple's paste button for the link the/pulse/openpage copied; it reads the pasteboard only on that tap, so iOS shows no paste prompt.#token=fragment./pulse/openpage (pages/open.html, served athttps://mieweb.github.io/pulse/openwith no trailing-slash redirect): Android goes to Play with the link as the install referrer, iOS copies the link on "Get Pulse" and opens the App Store, desktop shows a QR of the link, and "Already have Pulse? Open it" usespulsecam://. It is the test host's page minus its debug log, and the QR script now loads with an integrity hash.Testing
On an iPhone 17 Pro Max (iOS 26), on a build of the pulse-editor branch (#240) carrying these changes, with the link host pointed at
morepriyam.github.io(a test host; the env override used for that has since been removed serving the association files and the/pulse/openpage):pulsecam://QR (the demo server's page) opened Pulse over the current screen with the same sheet.app-site-association.cdn-apple.com/a/v1/morepriyam.github.io).pages/open.htmlserved locally, in Playwright (Chromium, desktop and iPhone emulation): desktop shows the QR (the integrity hash matches cdnjs's), iPhone shows "Get Pulse" and thepulsecam://link, no console errors. Not opened on a phone frommieweb.github.ioyet.Not confirmed on a device: a trusted server's next link pairing without the sheet (and its info toast).
Not run: Android (App Link verification, the store redirect, the install referrer and its size limit), the Play Store install path (needs an internal-track build), this branch's own build on
main.Before it goes live
matchwithforce) before the next iOS release build, or it fails to sign.app-site-association.cdn-apple.com/a/v1/mieweb.github.io) returns the Pulse entry, and Google's Digital Asset Links API returns both Play keys. The/pulse/openpage goes live when this PR merges (the Pages workflow runs onpages/**).buildUploadLinkproduce the https form.