Adds link to open sync from youtube page#3431
Conversation
Adds a button to open the Odysee sync page directly from the YouTube transfer status page using a deep link. Enables auto-opening YouTube sync deep link Allows the application to automatically launch the YouTube sync deep link when specific URL parameters (`open_in_sync` or `open_app`) are present. This streamlines the user flow by initiating the sync process immediately upon page load for users directed with these parameters. It also removes the auto-open parameters from the URL after the attempt. Adjusts YouTube self-sync card visibility Expands the display conditions for the self-sync alternative card to include users with `autoOpenSync` enabled, improving discoverability for relevant users. Removes the direct "Open in Odysee Sync" button, streamlining the UI and potentially simplifying the user's journey for initiating the sync process. The self-sync token remains available for manual transfer.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughRefactors portal rendering to use derived mainPortal/mainPortals variables, adds query-driven auto-open for YouTube transfer self-sync, introduces URL cleanup and popup-guarding logic, tweaks YouTube transfer styling, and expands the spinner to handle an optional odysee:// launch URL with UI and inline navigation script. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Page as YouTubeSync Page
participant Component as YoutubeTransferStatus
participant Launcher as Sync Launcher / Popup
User->>Page: Visit page with ?open_in_sync=true (or ?open_app=true)
Page->>Page: Parse query params -> shouldAutoOpenSync
Page->>Component: Render with autoOpenSync={true}
Component->>Component: Compute selfSyncLauncherUrl (from token + DOMAIN)
Component->>Component: showSelfSyncCard = true
Component->>Component: useEffect triggers auto-open (once)
Component->>Launcher: window.open(selfSyncLauncherUrl)
alt popup allowed
Launcher->>Launcher: Launch native sync app
Launcher->>Component: (user returns) sync completed
else popup blocked
Component->>Component: Mark popup-blocked, show fallback UI
Component->>User: Display manual launch button/link
end
Component->>Page: clearAutoOpenParamsFromUrl()
Page->>User: URL params removed/cleaned
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
ui/component/youtubeTransferStatus/view.jsx (1)
30-31: Consider centralizing auto-open query param keys.Line [30]-[31] duplicates literals also declared in
ui/page/youtubeSync/view.jsx. Moving them to a shared constant avoids silent drift between parser and consumer.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ui/component/youtubeTransferStatus/view.jsx` around lines 30 - 31, The two duplicated constants AUTO_OPEN_SYNC_PARAM and AUTO_OPEN_SYNC_PARAM_ALT should be centralized into a shared exported constant so parser and consumer use the same source of truth; create a module exporting these keys (e.g. export const AUTO_OPEN_SYNC_PARAM, AUTO_OPEN_SYNC_PARAM_ALT) and update both view.jsx files to import and use those exports instead of declaring the literals locally, ensuring both youtubeTransferStatus (AUTO_OPEN_SYNC_PARAM / AUTO_OPEN_SYNC_PARAM_ALT) and youtubeSync reference the single exported constants.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ui/page/youtubeSync/view.jsx`:
- Around line 30-37: The isTruthyQueryValue function treats any falsy value as
false, which causes presence-only params (e.g. ?open_in_sync) to be ignored and
can mask alternate param checks; update isTruthyQueryValue to return true when
value === '' (presence-only) but still return false for null/undefined, and keep
the lowercase checks for '0'/'false'/'no'; additionally, in the code that reads
query params (the alternate param handling referenced around the existing
usage), prefer using URLSearchParams.has('open_in_sync') or explicitly call
isTruthyQueryValue on the result rather than relying on a falsy check so the
presence-only param is honored.
In `@web/src/spinner.js`:
- Around line 4-5: The value from ctx.query.launch (captured as launchParam and
normalized into launchUrl) is only prefix-checked but later injected into an
href attribute, so sanitize/validate it before use: instead of directly
interpolating launchUrl into the anchor href, validate against an allowlist or
strict pattern (e.g., require exact odysee://token/<base64-or-hex> form), reject
or nullify anything that doesn't match, and HTML-escape/URL-encode the value
prior to insertion; update the code paths that build the href (references around
where launchUrl is used/interpolated) to use the validated/escaped value or omit
the attribute when invalid.
---
Nitpick comments:
In `@ui/component/youtubeTransferStatus/view.jsx`:
- Around line 30-31: The two duplicated constants AUTO_OPEN_SYNC_PARAM and
AUTO_OPEN_SYNC_PARAM_ALT should be centralized into a shared exported constant
so parser and consumer use the same source of truth; create a module exporting
these keys (e.g. export const AUTO_OPEN_SYNC_PARAM, AUTO_OPEN_SYNC_PARAM_ALT)
and update both view.jsx files to import and use those exports instead of
declaring the literals locally, ensuring both youtubeTransferStatus
(AUTO_OPEN_SYNC_PARAM / AUTO_OPEN_SYNC_PARAM_ALT) and youtubeSync reference the
single exported constants.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
ui/component/portals/view.jsxui/component/youtubeTransferStatus/style.lazy.scssui/component/youtubeTransferStatus/view.jsxui/page/youtubeSync/view.jsxweb/src/spinner.js
Enhances `odysee://token/` deep link handling with stricter regex validation and HTML attribute escaping, preventing potential XSS vulnerabilities. Refines query parameter parsing for auto-opening the sync page, treating empty parameter values as truthy and ensuring primary parameters are prioritized.
Adds a button to open the Odysee sync page directly from the YouTube transfer status page using a deep link.
Enables auto-opening YouTube sync deep link
Allows the application to automatically launch the YouTube sync deep link when specific URL parameters (
open_in_syncoropen_app) are present.This streamlines the user flow by initiating the sync process immediately upon page load for users directed with these parameters. It also removes the auto-open parameters from the URL after the attempt.
Adjusts YouTube self-sync card visibility
Expands the display conditions for the self-sync alternative card to include users with
autoOpenSyncenabled, improving discoverability for relevant users.Removes the direct "Open in Odysee Sync" button, streamlining the UI and potentially simplifying the user's journey for initiating the sync process. The self-sync token remains available for manual transfer.
Fixes
Issue Number:
What is the current behavior?
What is the new behavior?
Other information
PR Checklist
Toggle...
What kind of change does this PR introduce?
Please check all that apply to this PR using "x":
Summary by CodeRabbit
New Features
UI/Behavior
Style