Skip to content

Dev - #1373

Merged
VampireChicken12 merged 6 commits into
mainfrom
dev
Aug 21, 2026
Merged

Dev#1373
VampireChicken12 merged 6 commits into
mainfrom
dev

Conversation

@VampireChicken12

@VampireChicken12 VampireChicken12 commented Aug 21, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Playback-speed controls now remember manual speed selections and restore them when automatic enforcement is disabled.
    • Manual speed changes are respected without being immediately overridden.
  • Bug Fixes

    • Improved mini-player recovery when enabling, disabling, moving, or restoring the player.
    • Prevented stale overlays and improved handling of playback-rate changes during navigation.
    • Improved popup sizing for more consistent display.
  • Documentation

    • Clarified contribution and branching guidelines.

VampireChicken12 and others added 6 commits August 20, 2026 06:16
…e crash (#1370)

Deep-merge the default configuration into stored settings when loading
them on the options page and in the content script, and restore the
defaults merge on background load removed in 82047c6. Newly added
nested settings (e.g. videosPerRow.videosPerRow) are now always
populated, preventing the NumberInput 'Cannot read properties of
undefined' crash that stopped the options page from opening.
…retches to Chrome's max canvas

Chrome 152 change causes popups to be laid out against a near-max-width canvas
instead of shrink-to-fit, so only applying max-width to body left html stretching
to ~792px with blank space on the right. Pin the document root to fit-content so
the popup renders at the body's content width.
…ed speed (#1372)

Forced playback speed was continuously re-enforced on every player state
change, so any manual adjustment (settings menu, shift+., scroll wheel,
speed buttons) was reverted to the configured value within seconds.

Detect user intent via a ratechange listener on the video element and
mark a per-video manual override whenever the playback rate changes by
anything other than the extension's own enforcement task. While an
override is active for the current video, enforcement stands down until
the next navigation, where the configured speed applies again.

- add playerSpeed/manualOverride.ts: per-video override flag plus a
  timestamped record of extension-applied rates so enforced writes are
  never mistaken for user input
- makePlayerSpeedTask: no-op while a manual override is active for the
  current video; retry during the stale-video window instead of writing
  base speed onto the previous video; record applied rates before writing
- restore-on-disable keeps tracking the user's latest choice, including
  changes made after an override is active

Fixes #1372
…le/restore flow

- Call ensureTrustedTypesPolicy() once during embedded setup instead of
  per-feature so all features can safely use HTML sinks on pages that
  enforce Trusted Types; remove the now-redundant calls from
  playlistManagementButtons and saveToWatchLaterButton
- Wrap enable/movePlayerIntoOverlay/restorePlayer in error handling so a
  failure no longer leaves the video detached from the page
- Remove stale overlays before creating a new one and skip re-detaching
  when the player is already in the overlay
- Fall back to standard player containers when the original parent or
  placeholder is gone during restore
- Guard state API access and size preset parsing against bad saved state

Fixes the mini player never appearing and the video disappearing when
scrolling to comments, caused by innerHTML assignment throwing under
YouTube's Trusted Types CSP.
@VampireChicken12
VampireChicken12 merged commit e6566be into main Aug 21, 2026
5 of 6 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done - Released in YouTube Enhancer Aug 21, 2026
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e905a54e-8106-45de-8cf8-43fdbbcb92be

📥 Commits

Reviewing files that changed from the base of the PR and between 77a9125 and e20e5cf.

📒 Files selected for processing (9)
  • CONTRIBUTING.md
  • src/_setup/embedded/lifecycle.ts
  • src/features/miniPlayer/controller.ts
  • src/features/playerSpeed/index.ts
  • src/features/playerSpeed/manualOverride.ts
  • src/features/playlistManagementButtons/index.ts
  • src/features/saveToWatchLaterButton/index.ts
  • src/pages/popup/index.css
  • src/utils/security/trustedTypes.ts

Walkthrough

The pull request updates contribution branching guidance, centralizes Trusted Types setup, hardens mini-player recovery, improves playback-speed enforcement and manual override tracking, and sets popup width to fit-content.

Changes

Contribution guidance

Layer / File(s) Summary
Branching and pull-request workflow
CONTRIBUTING.md
The contribution workflow now uses dev for feature branches and pull requests. The main branch is reserved for releases.

Trusted Types setup

Layer / File(s) Summary
Embedded policy initialization
src/_setup/embedded/lifecycle.ts, src/features/playlistManagementButtons/index.ts, src/features/saveToWatchLaterButton/index.ts, src/utils/security/trustedTypes.ts
Embedded setup now initializes the Trusted Types policy. Feature-level initialization was removed, and the utility documentation reflects the new call site.

Mini-player recovery

Layer / File(s) Summary
Player lifecycle and restoration
src/features/miniPlayer/controller.ts
Mini-player setup, movement, shutdown, and restoration now handle detached players, stale overlays, disconnected elements, and restoration failures.
Player state and persistence safety
src/features/miniPlayer/controller.ts
Manual override reads, size parsing, and rectangle persistence now use guarded state handling and fallback values.

Playback-speed control

Layer / File(s) Summary
Manual override and applied-rate state
src/features/playerSpeed/manualOverride.ts
The module tracks active manual overrides and recent extension-applied playback rates.
Validated speed enforcement
src/features/playerSpeed/index.ts
Speed enforcement waits for matching video identifiers, bypasses active manual overrides, and records applied rates.
Rate-change lifecycle
src/features/playerSpeed/index.ts
Rate-change listeners now track external and manual changes, persist selected rates, and reset state during enable, navigation, and disable.

Popup sizing

Layer / File(s) Summary
Popup document width
src/pages/popup/index.css
The popup html element now uses width: fit-content.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant playerSpeed
  participant HTMLVideoElement
  participant manualOverride
  participant PersistedState
  playerSpeed->>HTMLVideoElement: wait for matching video ID
  playerSpeed->>manualOverride: check active manual override
  playerSpeed->>HTMLVideoElement: apply effective playback rate
  playerSpeed->>manualOverride: record extension-applied rate
  HTMLVideoElement->>playerSpeed: emit ratechange
  playerSpeed->>PersistedState: persist external or manual rate
Loading

Poem

I’m a rabbit with a branch in sight,
dev grows green while main rests tight.
Rates hop safely, players mend,
Trusted types guard each start and end.
Fit-content makes the popup bright!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

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.

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.34.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done - Released

Development

Successfully merging this pull request may close these issues.

1 participant