-
Notifications
You must be signed in to change notification settings - Fork 1
fix: resolve 101/150 errors by aligning WebView baseUrl and origin in inline mode #74
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| "react-native-youtube-bridge": patch | ||
| "@react-native-youtube-bridge/core": patch | ||
| --- | ||
|
|
||
| fix: resolve 101/150 errors by aligning WebView baseUrl and IFrame origin in inline mode | ||
|
|
||
| - Set baseUrl to the default `https://localhost/` for inline WebView | ||
| - Default playerVars.origin to `https://localhost` in inline WebView | ||
| - Wrap certain dev logs with DEV so they only run in development | ||
| - Add TSDoc for playerVars.origin and webViewUrl props |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -25,7 +25,7 @@ const useCreateLocalPlayerHtml = ({ | |||||
| return '<html><body><div style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; color: #fff;">Invalid YouTube ID</div></body></html>'; | ||||||
| } | ||||||
|
|
||||||
| const safeOrigin = escapeHtml(origin); | ||||||
| const safeOrigin = escapeHtml(origin) ?? 'https://localhost'; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix origin fallback: As implemented, Apply this diff to ensure the default is actually applied and still sanitized: - const safeOrigin = escapeHtml(origin) ?? 'https://localhost';
+ const safeOrigin = escapeHtml(origin ?? 'https://localhost');Optional hardening: strip a trailing slash if the caller passes one to keep the value a proper “origin”: - const safeOrigin = escapeHtml(origin ?? 'https://localhost');
+ const safeOrigin = escapeHtml((origin ?? 'https://localhost').replace(/\/$/, ''));📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| const safeStartTime = safeNumber(startTime); | ||||||
| const safeEndTime = endTime ? safeNumber(endTime) : undefined; | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Double-check that runtime defaults match these docs
Since this comment promises defaults, verify the implementation actually:
baseUrl: 'https://localhost/'for inline HTML when not provided, andplayerVars.origintohttps://localhostin inline mode.Run:
🏁 Script executed:
Length of output: 380
🏁 Script executed:
Length of output: 68622
🏁 Script executed:
Length of output: 1491
🏁 Script executed:
Length of output: 1099
Ensure the documented origin default is actually applied in inline‐HTML mode
baseUrl: 'https://localhost/'whenuseInlineHtmlistrueis implemented correctly inYoutubeView.tsx(…src/YoutubeView.tsx line 44) .useCreateLocalPlayerHtml), the code usesBecause
escapeHtml(undefined)yields''(an empty string, notnull/undefined), the??fallback never runs andsafeOriginis falsy—so nooriginis injected.Refactor required
Update the fallback to use
||so that an empty string also triggers the default:This ensures that when no
originis provided, the hook injectsorigin: 'https://localhost'into the player configuration, matching the documentation.