YouTube Music: Refactor command structure and improve error handling#25370
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Refactors all YouTube Music commands to use a consistent, robust pattern and fixes commands failing with "Unknown Error" when JavaScript from Apple Events is not enabled or no matching tab is found. Also translates leftover German UI strings to English and adds setup documentation.
Fixes #25177
Changes
dislike.tsx,like.tsx,fast-forward.tsx,rewind.tsx,play-pause.tsx,next-track.tsx,previous-track.tsx,next-chapter.tsx,previous-chapter.tsx,remove-like.tsx): All JavaScript snippets that were inlined insidedefaultexports are now standalone exported constants/functions. This improves readability and makes the JS independently testable."like-clicked","dislike-not-found","fast-forward-success") instead oftrue/false, making result handling unambiguous.switchstatements: All commands now useswitchon the result string to display specific HUD feedback per outcome, replacing ad-hocif/elsechecks.utils.ts(next-chapter.tsx,previous-chapter.tsx): The sharedgoToChapterobject is removed; each command now owns its JS with more granular error states ("no-active-chapter","no-next-chapter", etc.).runJSInYouTubeMusicTaberror handling (utils.ts): The function now throws on known error conditions (JS not allowed, no matching tab, JS runtime errors) and shows actionable toasts with a link to setup docs, instead of silently returningfalse.remove-like.tsx): Replaced leftover German messages ("Kein Like gesetzt", "Fehler beim Entfernen des Likes") with English equivalents.utils.ts): Removed theOsaErrorinterface andErrorMessagestype that are no longer needed.README.md): Documented how to enable "Allow JavaScript from Apple Events" for Safari, Chrome/Chromium, and WebCatalog apps, with screenshots.Screencast
fix-yt-music.mp4
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare located outside the metadata folder