Conversation
📝 WalkthroughWalkthroughAdds a Prime Video in-page bootstrap to intercept and patch target scripts, introduces global log level management with storage and messaging, conditionally gates PostHog via build/runtime flags with provider shims, and exposes log-level controls in the UI and background/content initialization. Changes
Sequence Diagram(s)sequenceDiagram
participant PV as Prime Video Page
participant PIC as Interceptor Content Script
participant BS as Bootstrap Script
participant Fetch as Fetch API
PV->>PIC: page loads
PIC->>PIC: determine isDev
PIC->>BS: inject bootstrap (document_start)
BS->>BS: set per-page bootstrapped flag
BS->>BS: scan existing <script src>
BS->>BS: install DOM hooks & MutationObserver
PV->>BS: script element added/loaded
BS->>BS: test URL via isPrimeVideoTargetScriptUrl
alt target script
BS->>Fetch: fetch original script
Fetch-->>BS: script content
BS->>BS: patchPrimeVideoScriptContent()
BS->>BS: create inline patched <script>
BS->>PV: replace original, preserve handlers, set dataset status
else non-target
BS->>PV: leave script unchanged
end
sequenceDiagram
participant User as User
participant Modal as OTTModal
participant Store as Zustand Store
participant BG as Background
participant Storage as AppStorage
User->>Modal: select new log level
Modal->>Store: setLogLevel(newLevel)
Store->>Store: setGlobalLogLevel(newLevel)
Store->>BG: sendMessage(SET_LOG_LEVEL, { level: newLevel })
BG->>Storage: storageManager.setLogLevel(level)
Storage-->>BG: persisted
BG->>BG: setGlobalLogLevel(level)
BG->>BG: broadcast STORAGE_CHANGED { logLevel }
BG-->>Store: STORAGE_CHANGED { logLevel }
Store->>Store: updateLogLevelFromStorage(level)
Store->>Modal: re-render with updated logLevel
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes 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 docstrings
🧪 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: 4
🧹 Nitpick comments (4)
src/components/OTTModal.tsx (1)
397-421: Consider adding a descriptive title for the log level section.The
RuleSectionuses an emptytitle=""which renders awkwardly. Adding a title like "Developer" or "Settings" would improve UX clarity.💡 Suggested improvement
- <RuleSection title=""> + <RuleSection title="Developer">🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/OTTModal.tsx` around lines 397 - 421, The RuleSection rendering the log level control currently passes an empty title (title=""), causing an awkward header; update the JSX where RuleSection is used (the component containing the select for log level) to provide a meaningful title such as "Developer" or "Settings" — locate the RuleSection instance that wraps the log level select (references: RuleSection, LOG_LEVEL_OPTIONS, handleLogLevelChange, logLevel) and change title="" to a descriptive string to improve UX.src/entrypoints/primevideo-interceptor.content.ts (1)
6-7: Remove unnecessary type assertion; the string literal naturally matches the expected type.The
as Parameters<typeof injectScript>[0]assertion is redundant. WXT'sinjectScriptexpects typeScriptPublicPathwhich accepts strings matching the pattern${string}.js. The literal"/primevideo-bootstrap.js"already satisfies this type, as shown by the assertion-free usage of"/script.js"insrc/entrypoints/content/index.tsx:54. Assign the string directly without the assertion:const bootstrapPath = "/primevideo-bootstrap.js";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/entrypoints/primevideo-interceptor.content.ts` around lines 6 - 7, Remove the redundant type assertion on bootstrapPath: the string literal "/primevideo-bootstrap.js" already satisfies injectScript's parameter type (ScriptPublicPath), so change the declaration of bootstrapPath (currently using as Parameters<typeof injectScript>[0]) to a plain string assignment; update the variable defined as bootstrapPath and ensure any call sites using injectScript continue to pass bootstrapPath unchanged.src/entrypoints/primevideo-bootstrap.ts (1)
199-216: Multiple interception mechanisms may process the same script.The code has four interception paths: DOM method wrapping (lines 150-152),
setAttributeoverride (lines 154-168),srcproperty setter (lines 178-196), and MutationObserver (lines 199-210). Additionally, existing scripts are scanned at startup (lines 212-216).The
processedScriptsWeakSet (line 27) correctly deduplicates, but consider adding a brief comment explaining this intentional defense-in-depth approach for future maintainers.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/entrypoints/primevideo-bootstrap.ts` around lines 199 - 216, The multiple interception mechanisms (DOM method wrapping, setAttribute override, src property setter, MutationObserver and initial script scan) can appear redundant to future readers; add a short clarifying comment near the processedScripts WeakSet declaration (processedScripts) that explains this is intentional defense-in-depth and that deduplication is handled by processedScripts, and also add brief inline notes next to the functions inspectNode and replaceScript (and the MutationObserver/initial querySelectorAll usage) describing which interception each covers so maintainers understand why all four paths are present and that processedScripts prevents double-processing.src/lib/logger.ts (1)
23-39:loggerInstancesSet holds strong references - potential memory consideration.The
loggerInstancesSet keeps references to all createdLoggerinstances (including child loggers from line 464). If loggers are created dynamically at runtime (not just at module initialization), they won't be garbage collected.For the current usage pattern where loggers are created at module level (e.g.,
export const logger = createLogger("app")), this is acceptable. However, if dynamic logger creation becomes common, consider using aWeakSetor adding a cleanup method.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/logger.ts` around lines 23 - 39, loggerInstances currently uses a strong Set which prevents garbage collection of dynamically created Logger instances (including child loggers created by createLogger and Logger.createChild); change loggerInstances to a WeakSet<Logger> so references do not keep loggers alive, and ensure any code that iterates loggerInstances (e.g., setGlobalLogLevel) still works with WeakSet semantics (iterate by tracking registrations or update setGlobalLogLevel to store the level and call Logger.setLevel on new registrations), or alternatively add registerLogger/unregisterLogger helpers and call unregister from Logger.dispose()/createChild to remove references when loggers are no longer needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/entrypoints/primevideo-bootstrap.ts`:
- Around line 41-51: fetchPatchedScript is calling the app-level fetch which is
intercepted by the patchScripts middleware, causing duplicate patching when you
then call patchPrimeVideoScriptContent; modify fetchPatchedScript to bypass
middleware by using the original unwrapped fetch (e.g., ctx.originalFetch) or
add an internal marker header (like X-Internal-Fetch: true) and update the
patchScripts middleware to skip processing when that marker is present; update
references to scriptCache and fetchPatchedScript to use the new bypass so
bootstrap fetches return unmodified responses before
patchPrimeVideoScriptContent is applied.
In `@src/entrypoints/primevideo-interceptor.content.ts`:
- Around line 9-11: The current use of "void injectScript(bootstrapPath, {
keepInDom: isDev })" discards the returned Promise so injection failures are
silently swallowed; update the call in primevideo-interceptor.content.ts to
handle errors by either awaiting injectScript(...) or attaching a .catch(...)
that logs the error (use the same logging mechanism/pattern as
content/index.tsx), referencing injectScript, bootstrapPath and isDev so any
thrown error is caught and reported instead of being ignored.
In `@src/lib/apps/primevideo/script-patch-shared.ts`:
- Around line 20-26: The replacement only uses String.replace(...) which
substitutes only the first match; update the return object in the function that
builds the patch so that all occurrences are replaced by using
content.replaceAll(PRIMEVIDEO_SCRIPT_FIND_PATTERN,
PRIMEVIDEO_SCRIPT_REPLACE_WITH) (or, if PRIMEVIDEO_SCRIPT_FIND_PATTERN is a
RegExp string, convert it to a RegExp with the global flag and call
content.replace(new RegExp(PRIMEVIDEO_SCRIPT_FIND_PATTERN, 'g'),
PRIMEVIDEO_SCRIPT_REPLACE_WITH)) to ensure every instance of
PRIMEVIDEO_SCRIPT_FIND_PATTERN is replaced throughout the script content.
In `@src/lib/posthog-impl.ts`:
- Line 1: Create a new file src/lib/posthog-disabled.ts that mirrors the public
API of src/lib/posthog-enabled.ts but implements all exported
functions/classes/constants as no-ops (e.g., functions that return void or
resolved Promises, methods that do nothing, and objects with stubbed methods),
and re-export any types or interfaces so consumers keep the same types. Ensure
every exported symbol from posthog-enabled (named exports and any default
export) exists in posthog-disabled with the same signature and exported name so
imports of "@/lib/posthog-impl" resolve cleanly in disabled builds.
---
Nitpick comments:
In `@src/components/OTTModal.tsx`:
- Around line 397-421: The RuleSection rendering the log level control currently
passes an empty title (title=""), causing an awkward header; update the JSX
where RuleSection is used (the component containing the select for log level) to
provide a meaningful title such as "Developer" or "Settings" — locate the
RuleSection instance that wraps the log level select (references: RuleSection,
LOG_LEVEL_OPTIONS, handleLogLevelChange, logLevel) and change title="" to a
descriptive string to improve UX.
In `@src/entrypoints/primevideo-bootstrap.ts`:
- Around line 199-216: The multiple interception mechanisms (DOM method
wrapping, setAttribute override, src property setter, MutationObserver and
initial script scan) can appear redundant to future readers; add a short
clarifying comment near the processedScripts WeakSet declaration
(processedScripts) that explains this is intentional defense-in-depth and that
deduplication is handled by processedScripts, and also add brief inline notes
next to the functions inspectNode and replaceScript (and the
MutationObserver/initial querySelectorAll usage) describing which interception
each covers so maintainers understand why all four paths are present and that
processedScripts prevents double-processing.
In `@src/entrypoints/primevideo-interceptor.content.ts`:
- Around line 6-7: Remove the redundant type assertion on bootstrapPath: the
string literal "/primevideo-bootstrap.js" already satisfies injectScript's
parameter type (ScriptPublicPath), so change the declaration of bootstrapPath
(currently using as Parameters<typeof injectScript>[0]) to a plain string
assignment; update the variable defined as bootstrapPath and ensure any call
sites using injectScript continue to pass bootstrapPath unchanged.
In `@src/lib/logger.ts`:
- Around line 23-39: loggerInstances currently uses a strong Set which prevents
garbage collection of dynamically created Logger instances (including child
loggers created by createLogger and Logger.createChild); change loggerInstances
to a WeakSet<Logger> so references do not keep loggers alive, and ensure any
code that iterates loggerInstances (e.g., setGlobalLogLevel) still works with
WeakSet semantics (iterate by tracking registrations or update setGlobalLogLevel
to store the level and call Logger.setLevel on new registrations), or
alternatively add registerLogger/unregisterLogger helpers and call unregister
from Logger.dispose()/createChild to remove references when loggers are no
longer needed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e8f6d323-2c23-4d37-a10a-18403cbe266d
📒 Files selected for processing (23)
.changeset/calm-deserts-deny.mdsrc/components/App.tsxsrc/components/OTTModal.tsxsrc/entrypoints/background.tssrc/entrypoints/content/index.tsxsrc/entrypoints/primevideo-bootstrap.tssrc/entrypoints/primevideo-interceptor.content.tssrc/entrypoints/script.tssrc/hooks/useStore.tsxsrc/lib/apps/primevideo/config.tssrc/lib/apps/primevideo/script-patch-shared.tssrc/lib/apps/primevideo/script-watcher.tssrc/lib/logger.tssrc/lib/messaging.tssrc/lib/posthog-enabled.tssrc/lib/posthog-impl.tssrc/lib/posthog-provider-disabled.tsxsrc/lib/posthog-provider-enabled.tsxsrc/lib/posthog-provider-impl.tsxsrc/lib/posthog-provider.tsxsrc/lib/posthog.tssrc/lib/storage.tswxt.config.ts
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/lib/posthog-disabled.ts (1)
6-14: Minor DRY cleanup forapi_host.Behavior is correct, but Line 7 can reference
POSTHOG_API_HOSTinstead of another string literal to keep defaults centralized.♻️ Proposed small cleanup
export const posthogOptions = { - api_host: "", + api_host: POSTHOG_API_HOST, autocapture: false, capture_pageview: false, persistence: "localStorage", disable_external_dependency_loading: true, disable_surveys: true, disable_session_recording: true, } as const;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/posthog-disabled.ts` around lines 6 - 14, Replace the hard-coded empty string for api_host in posthogOptions with the centralized default constant POSTHOG_API_HOST: update the posthogOptions object (symbol: posthogOptions) to reference POSTHOG_API_HOST instead of "" and add the necessary import or reference so POSTHOG_API_HOST is available in this module.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/apps/primevideo/script-patch-shared.ts`:
- Around line 12-27: The patch function patchPrimeVideoScriptContent returns a
{changed, content} tuple but its consumer currently ignores changed (see the
.then((content) => patchPrimeVideoScriptContent(content).content) usage in
primevideo-bootstrap.ts); update that consumer to inspect the returned changed
flag and handle the false case explicitly — e.g., if changed is false, log a
warning (with context that the PRIMEVIDEO_SCRIPT_FIND_PATTERN was not found) and
either throw an error or fall back to the original external script loading path
so the system does not mark the script as "patched" incorrectly; keep
patchPrimeVideoScriptContent as-is but ensure the caller checks the {changed}
value before proceeding.
In `@src/lib/apps/primevideo/script-watcher.ts`:
- Around line 3-6: The patchScripts middleware is a no-op while
patchPrimeVideoScriptContent is applied unconditionally, making the
bypass-lite-plan toggle ineffective; update the bootstrap to check the rule
state before calling patchPrimeVideoScriptContent (or remove patchScripts from
the config if you prefer to always patch), e.g., locate the call to
patchPrimeVideoScriptContent in the primevideo bootstrap code and wrap it with
the feature toggle check used for rules, or implement logic inside patchScripts
to invoke patchPrimeVideoScriptContent when the rule is enabled (reference
symbols: patchScripts, patchPrimeVideoScriptContent, and the rule identifier for
"bypass-lite-plan") so toggling the rule actually enables/disables the patch.
---
Nitpick comments:
In `@src/lib/posthog-disabled.ts`:
- Around line 6-14: Replace the hard-coded empty string for api_host in
posthogOptions with the centralized default constant POSTHOG_API_HOST: update
the posthogOptions object (symbol: posthogOptions) to reference POSTHOG_API_HOST
instead of "" and add the necessary import or reference so POSTHOG_API_HOST is
available in this module.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1cf2c41c-c24f-4a72-824c-bb37802c1b64
📒 Files selected for processing (4)
src/entrypoints/primevideo-bootstrap.tssrc/lib/apps/primevideo/script-patch-shared.tssrc/lib/apps/primevideo/script-watcher.tssrc/lib/posthog-disabled.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/entrypoints/primevideo-bootstrap.ts
| export function patchPrimeVideoScriptContent(content: string) { | ||
| if (!content.includes(PRIMEVIDEO_SCRIPT_FIND_PATTERN)) { | ||
| return { | ||
| changed: false, | ||
| content, | ||
| }; | ||
| } | ||
|
|
||
| return { | ||
| changed: true, | ||
| content: content.replace( | ||
| PRIMEVIDEO_SCRIPT_FIND_PATTERN, | ||
| PRIMEVIDEO_SCRIPT_REPLACE_WITH, | ||
| ), | ||
| }; | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify how the changed flag is used across the codebase
rg -n "patchPrimeVideoScriptContent" --type ts -A 3 -B 1Repository: WINOFFRG/ottpro
Length of output: 1264
🏁 Script executed:
# Get the full content of script-patch-shared.ts to see the pattern and any documentation
head -50 src/lib/apps/primevideo/script-patch-shared.tsRepository: WINOFFRG/ottpro
Length of output: 814
🏁 Script executed:
# Check for tests related to this function
fd -e "spec\|test" --type f | xargs rg -l "patchPrimeVideoScriptContent" 2>/dev/nullRepository: WINOFFRG/ottpro
Length of output: 145
🏁 Script executed:
# Get full context of how this is used in primevideo-bootstrap.ts
sed -n '35,55p' src/entrypoints/primevideo-bootstrap.tsRepository: WINOFFRG/ottpro
Length of output: 680
🏁 Script executed:
# Search for any error handling or logging around script patching
rg -n "scriptCache\|patchPrimeVideo" src/entrypoints/primevideo-bootstrap.ts -A 5 -B 2Repository: WINOFFRG/ottpro
Length of output: 41
🏁 Script executed:
# Find and read the test file for script-patch-shared.ts
fd -e "spec\|test" --type f -path "*primevideo*" | head -5Repository: WINOFFRG/ottpro
Length of output: 227
🏁 Script executed:
# Check the actual test content
cat src/lib/apps/primevideo/__tests__/script-patch-shared.spec.tsRepository: WINOFFRG/ottpro
Length of output: 152
🏁 Script executed:
# Check if there's any error handling in the actual runtime usage
cat src/entrypoints/primevideo-bootstrap.tsRepository: WINOFFRG/ottpro
Length of output: 6233
The changed flag is silently ignored, masking failed patches.
The function correctly returns a changed flag, but the consumer in primevideo-bootstrap.ts (line 45) ignores it entirely:
.then((content) => patchPrimeVideoScriptContent(content).content);When the pattern isn't found (e.g., if Amazon updates their script structure), the original unpatched content is still inlined as-is, and the status is set to "patched" regardless. This creates a silent failure: the script executes but without the subtitle detection patch, potentially breaking functionality without any visibility to users or developers.
Recommend adding a check of the changed flag and either:
- Logging a warning when patching is skipped, or
- Handling the failure case explicitly (e.g., falling back to the original external script or failing with visibility)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/lib/apps/primevideo/script-patch-shared.ts` around lines 12 - 27, The
patch function patchPrimeVideoScriptContent returns a {changed, content} tuple
but its consumer currently ignores changed (see the .then((content) =>
patchPrimeVideoScriptContent(content).content) usage in
primevideo-bootstrap.ts); update that consumer to inspect the returned changed
flag and handle the false case explicitly — e.g., if changed is false, log a
warning (with context that the PRIMEVIDEO_SCRIPT_FIND_PATTERN was not found) and
either throw an error or fall back to the original external script loading path
so the system does not mark the script as "patched" incorrectly; keep
patchPrimeVideoScriptContent as-is but ensure the caller checks the {changed}
value before proceeding.
| /** | ||
| * Middleware for fetch/XHR interception - patches response content | ||
| */ | ||
| export const patchScripts: Middleware = async (ctx, next) => { | ||
| if (!TARGET_URL_PATTERN.test(ctx.url)) { | ||
| return next(); | ||
| } | ||
|
|
||
| if (handledUrls.has(ctx.url)) { | ||
| return next(); | ||
| } | ||
| handledUrls.add(ctx.url); | ||
|
|
||
| try { | ||
| const response = await ctx.originalFetch(ctx.url, ctx.init); | ||
| const content = await response.text(); | ||
|
|
||
| if (!content.includes(FIND_PATTERN)) { | ||
| ctx.setHandled(); | ||
| ctx.setResponse( | ||
| new Response(content, { | ||
| status: response.status, | ||
| statusText: response.statusText, | ||
| headers: response.headers, | ||
| }), | ||
| ); | ||
| return; | ||
| } | ||
|
|
||
| const fileName = ctx.url.split("/").pop()?.split("?")[0]; | ||
| logger.info(`🔧 Patched script: ${fileName}`); | ||
|
|
||
| const patchedContent = content.replace(FIND_PATTERN, REPLACE_WITH); | ||
|
|
||
| ctx.setHandled(); | ||
| ctx.setResponse( | ||
| new Response(patchedContent, { | ||
| status: response.status, | ||
| statusText: response.statusText, | ||
| headers: response.headers, | ||
| }), | ||
| ); | ||
| } catch (error) { | ||
| logger.error("Patch failed", error); | ||
| return next(); | ||
| } | ||
| }; | ||
|
|
||
| /** | ||
| * MutationObserver to intercept <script> tags and redirect through fetch | ||
| * This ensures scripts loaded via HTML go through our fetch polyfill | ||
| */ | ||
| export function startScriptTagInterceptor() { | ||
| const processedScripts = new Set<HTMLScriptElement>(); | ||
|
|
||
| const observer = new MutationObserver((mutations) => { | ||
| for (const mutation of mutations) { | ||
| for (const node of mutation.addedNodes) { | ||
| if ( | ||
| node instanceof HTMLScriptElement && | ||
| node.src && | ||
| TARGET_URL_PATTERN.test(node.src) && | ||
| !processedScripts.has(node) | ||
| ) { | ||
| processedScripts.add(node); | ||
| const originalSrc = node.src; | ||
| const originalOnload = node.onload; | ||
| const originalOnerror = node.onerror; | ||
|
|
||
| node.removeAttribute("src"); | ||
| node.removeAttribute("defer"); | ||
| node.removeAttribute("async"); | ||
|
|
||
| fetch(originalSrc) | ||
| .then((response) => response.text()) | ||
| .then((patchedContent) => { | ||
| node.textContent = patchedContent; | ||
|
|
||
| if (originalOnload) { | ||
| originalOnload.call(node, new Event("load")); | ||
| } | ||
| }) | ||
| .catch((error) => { | ||
| logger.error("Script fetch failed", error); | ||
| if (originalOnerror) { | ||
| originalOnerror.call(node, new Event("error")); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| observer.observe(document.documentElement, { | ||
| childList: true, | ||
| subtree: true, | ||
| }); | ||
| } | ||
| export const patchScripts: Middleware = (_ctx, next) => next(); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== Rule wiring ==="
rg -n -C3 '"bypass-lite-plan"|middleware:\s*patchScripts|export const patchScripts' src || true
echo
echo "=== Bootstrap patch path ==="
rg -n -C4 'patchPrimeVideoScriptContent|bypass-lite-plan|isRuleEnabled|get.*Rule|enabled' src/entrypoints src/lib || true
BOOTSTRAP_FILE="$(fd 'primevideo-bootstrap.ts' src | head -n1 || true)"
if [ -n "${BOOTSTRAP_FILE:-}" ]; then
echo
echo "=== ${BOOTSTRAP_FILE} ==="
sed -n '1,240p' "$BOOTSTRAP_FILE"
fiRepository: WINOFFRG/ottpro
Length of output: 45242
The bypass-lite-plan rule toggle is now non-functional.
The middleware patchScripts in src/lib/apps/primevideo/script-watcher.ts is a no-op, but src/entrypoints/primevideo-bootstrap.ts patches Prime Video scripts unconditionally (line 45: patchPrimeVideoScriptContent(content).content) without checking the rule's enabled state. Users toggling this rule in settings will have no effect. Either gate the bootstrap patches with a rule state check, or remove the obsolete middleware from the config.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/lib/apps/primevideo/script-watcher.ts` around lines 3 - 6, The
patchScripts middleware is a no-op while patchPrimeVideoScriptContent is applied
unconditionally, making the bypass-lite-plan toggle ineffective; update the
bootstrap to check the rule state before calling patchPrimeVideoScriptContent
(or remove patchScripts from the config if you prefer to always patch), e.g.,
locate the call to patchPrimeVideoScriptContent in the primevideo bootstrap code
and wrap it with the feature toggle check used for rules, or implement logic
inside patchScripts to invoke patchPrimeVideoScriptContent when the rule is
enabled (reference symbols: patchScripts, patchPrimeVideoScriptContent, and the
rule identifier for "bypass-lite-plan") so toggling the rule actually
enables/disables the patch.
Summary by CodeRabbit
New Features
Bug Fixes
Chores