Skip to content

Fire the mobile /app/main redirect on iOS regardless of userAgentData - #66

Merged
Kryptos-s merged 1 commit into
JustAlex0000:mainfrom
Kryptos-s:ios-redirect-detect
Jul 27, 2026
Merged

Kryptos-s merged 1 commit into
JustAlex0000:mainfrom
Kryptos-s:ios-redirect-detect

Conversation

@Kryptos-s

Copy link
Copy Markdown
Collaborator

Follow-up to #65. That PR made /app/main render on iOS; this makes the redirect that sends users there actually fire on iOS.

Problem

isMobileUserAgent() consulted navigator.userAgentData.mobile first. On Chromium that bit stays false under a spoofed iOS UA string (DevTools device mode, a UA switcher, desktop "request mobile site"), so the opt-in /app/main redirect was skipped even though the UA clearly said iPhone. Reproduced with an iOS UA on Chromium: userAgentData.mobile === false → isMobileUserAgent() returned false, no redirect.

(On a real iPhone, Safari exposes no userAgentData, so the existing Android|Mobile sniff already caught it — but every Chromium-based test/spoof path was broken.)

Fix

iPhone/iPad/iPod in the UA now wins first, then userAgentData.mobile, then the existing Android|Mobile sniff. The logic is extracted into a pure isMobileUA(userAgent, userAgentData) so it can be unit-tested directly.

Testing

  • npm test passes, including new isMobileUA cases: iOS with no userAgentData, iOS with userAgentData.mobile === false (the spoof case), Android Chrome, Firefox Android, and desktop.
  • Loaded unpacked with the browser UA set to an iPhone string and the redirect enabled: opening a normal school page now redirects to /app/main (previously it stayed on the desktop page).

isMobileUserAgent() consulted navigator.userAgentData.mobile first, which
stays false on Chromium under a spoofed iOS UA string (DevTools, UA
switchers, desktop request-mobile-site), so the /app/main redirect never
fired on iPhone/iPad in those cases. Check for iPhone/iPad/iPod in the UA
first — iOS Safari exposes no userAgentData anyway — and split the logic
into a pure isMobileUA() with unit coverage.
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Kryptos-s, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 44 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 23cab527-8326-4e84-9a5a-5af921402bea

📥 Commits

Reviewing files that changed from the base of the PR and between 5aaf663 and d3e183d.

📒 Files selected for processing (2)
  • scripts/content.js
  • tests/content.test.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Kryptos-s
Kryptos-s merged commit b50b2e4 into JustAlex0000:main Jul 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant