Conversation
WalkthroughThe changes introduce Widevine VMP signing support for macOS and Windows builds using Castlabs EVS, update build hooks and configuration, and provide new documentation for Electron updates and Widevine signing. The Electron dependency is switched to a Castlabs fork, and readiness checks for WidevineCDM are added to the browser startup flow. Changes
Sequence Diagram(s)sequenceDiagram
participant CI as GitHub Actions (macOS/Windows)
participant Castlabs as Castlabs EVS
participant App as Electron App
CI->>CI: Install dependencies (Bun)
CI->>CI: Install castlabs-evs (macOS/Windows)
CI->>Castlabs: Login with credentials (via Python script)
Note over CI,Castlabs: Continue on error if login fails
CI->>CI: Build and package app
CI->>App: Run afterPack/afterSign hooks
App->>Castlabs: signAppWithVMP (via Python script)
Castlabs-->>App: Signed app (Widevine VMP)
sequenceDiagram
participant Main as Main Process
participant Electron as Electron App
participant Widevine as WidevineCDM
Main->>Electron: app.whenReady()
Electron-->>Main: Ready
Main->>Widevine: components.whenReady()
Widevine-->>Main: (Success or Failure, continue regardless)
Main->>Electron: createWindowInternal()
Suggested labels
Poem
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
27d6728 to
d36a381
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (11)
build/entitlements.mac.plist (1)
11-12: Disable library validation for Widevine. Addingcom.apple.security.cs.disable-library-validationis necessary for loading Widevine CDM components, but be aware this relaxes macOS library validation and can increase the attack surface. Consider adding a comment to document this requirement for future maintainers.CONTRIBUTING.md (1)
73-80: Refine markdown link and wording.
- Replace the bare URL with a markdown link to comply with linting (MD034).
- Simplify the phrasing by removing "in order to".
-## Widevine VMP Signing (Advanced) -This build pipeline contains Widevine VMP Signing Capabilities. However, you will have to create an account in order to enable it. -Create an Account: https://github.com/castlabs/electron-releases/wiki/EVS#creating-an-evs-account -Once logged in, the app will be automatically VMP-signed, and you can enjoy Widevine Protected Content! +## Widevine VMP Signing (Advanced) +This build pipeline supports Widevine VMP signing. You must create an account to enable it. +- Create an EVS account: [EVS account creation guide](https://github.com/castlabs/electron-releases/wiki/EVS#creating-an-evs-account) +Once logged in, the app will be automatically VMP-signed, allowing playback of Widevine protected content.🧰 Tools
🪛 LanguageTool
[style] ~75-~75: Consider a more concise word here.
Context: ...ver, you will have to create an account in order to enable it. Create an Account: https://...(IN_ORDER_TO_PREMIUM)
🪛 markdownlint-cli2 (0.17.2)
77-77: Bare URL used
null(MD034, no-bare-urls)
build/hooks/afterSign.js (2)
5-5: Fix JSDoc return type annotationThe JSDoc type annotation indicates a return type of
void, but the function is async and returns a Promise.-/** @type {(context: import("./types.js").PackContext) => void} */ +/** @type {(context: import("./types.js").PackContext) => Promise<void>} */
13-16: Improve error handling for better debuggingThe current implementation silently swallows errors during signing, which might hide important failure information.
- await signAppWithVMP(context.appOutDir) - .then(() => true) - .catch(() => false); + try { + await signAppWithVMP(context.appOutDir); + } catch (error) { + console.error(`Error during VMP signing: ${error.message}`); + // Continue build process despite signing failure + }build/hooks/afterPack.js (2)
5-5: Fix JSDoc return type annotationThe JSDoc type annotation indicates a return type of
void, but the function is async and returns a Promise.-/** @type {(context: import("./types.js").PackContext) => void} */ +/** @type {(context: import("./types.js").PackContext) => Promise<void>} */
13-16: Improve error handling for better debuggingThe current implementation silently swallows errors during signing, which might hide important failure information.
- await signAppWithVMP(context.appOutDir) - .then(() => true) - .catch(() => false); + try { + await signAppWithVMP(context.appOutDir); + } catch (error) { + console.error(`Error during VMP signing: ${error.message}`); + // Continue build process despite signing failure + }docs/contributing/updating-electron.md (2)
7-31: Consider adding a verification step for the update processThe guide would benefit from adding a step to verify that the updated Electron version works correctly with Widevine CDM before finalizing the update.
Consider adding:
5a. Test that Widevine CDM is working correctly: - Build the application with `bun run build` - Open a Widevine-protected streaming service (like Netflix or Disney+) - Verify playback works as expected
38-38: Add link to the specific Bun issueFor better reference, consider making the issue reference a clickable link.
-This is because of a [bun issue](https://github.com/oven-sh/bun/issues/19585), which causes `git clone` of the fork to fail. +This is because of a [bun issue #19585](https://github.com/oven-sh/bun/issues/19585), which causes `git clone` of the fork to fail.build/hooks/components/castlabs-evs.js (3)
10-14: Simplify platform-specific path logicThe current code sets the same
signPathvalue for both platforms, making the separate conditional branches unnecessary.- let signPath = null; - if (process.platform === "darwin") { - signPath = appOutDir; - } else if (process.platform === "win32") { - signPath = appOutDir; - } + // Only sign on supported platforms + const supportedPlatforms = ["darwin", "win32"]; + const signPath = supportedPlatforms.includes(process.platform) ? appOutDir : null;
20-20: Add error handling for Python command executionThe code assumes
python3is in the PATH, which might not be true in all environments. Consider adding validation or fallback options.- const signProcess = spawn("python3", ["-m", "castlabs_evs.vmp", "--no-ask", "sign-pkg", signPath]); + // Try python3 first, fall back to python if needed + const pythonCommand = process.platform === "win32" ? "python" : "python3"; + const signProcess = spawn(pythonCommand, ["-m", "castlabs_evs.vmp", "--no-ask", "sign-pkg", signPath]);
41-44: Add timeout handling for signing processThe current implementation doesn't handle cases where the signing process might hang indefinitely.
+ // Set timeout to prevent hanging indefinitely + const timeout = setTimeout(() => { + console.error("Signing process timed out after 5 minutes"); + signProcess.kill(); + reject(new Error("Signing process timed out")); + }, 5 * 60 * 1000); + signProcess.on("error", (error) => { console.error("Error in signing process:", error.message); + clearTimeout(timeout); reject(error); }); + + signProcess.on("close", (code) => { + clearTimeout(timeout); + // ... existing code ... + });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (13)
.github/workflows/build-and-release.yml(1 hunks).github/workflows/build.yml(1 hunks)CONTRIBUTING.md(1 hunks)README.md(1 hunks)build/entitlements.mac.plist(1 hunks)build/hooks/afterPack.js(1 hunks)build/hooks/afterSign.js(1 hunks)build/hooks/components/castlabs-evs.js(1 hunks)build/hooks/types.d.ts(1 hunks)docs/contributing/updating-electron.md(1 hunks)electron-builder.json(1 hunks)package.json(2 hunks)src/main/browser/browser.ts(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
build/hooks/afterPack.js (1)
build/hooks/afterSign.js (2)
vmpSignPlatforms(3-3)handler(6-20)
build/hooks/afterSign.js (1)
build/hooks/afterPack.js (2)
vmpSignPlatforms(3-3)handler(6-20)
🪛 LanguageTool
CONTRIBUTING.md
[style] ~75-~75: Consider a more concise word here.
Context: ...ver, you will have to create an account in order to enable it. Create an Account: https://...
(IN_ORDER_TO_PREMIUM)
🪛 markdownlint-cli2 (0.17.2)
CONTRIBUTING.md
77-77: Bare URL used
null
(MD034, no-bare-urls)
🔇 Additional comments (17)
README.md (1)
71-71: Typo fix approved. The correction from "Widewine Support" to "Widevine Support" accurately reflects the DRM technology.package.json (2)
77-77: Verify GitHub Electron fork compatibility.
Referencing"github:castlabs/electron-releases#v35.3.0+wvcus"indevDependenciesmay behave differently across package managers. Please confirm that your CI (npm, pnpm, bun) correctly resolves and installs this GitHub-based dependency, and that the path undernode_modules/electron/distexists as expected.
105-109: Trusted dependencies updated.
ExpandingtrustedDependenciesto include"better-sqlite3","electron","esbuild", and"sharp"makes sense given the native modules and build hooks. No issues noted.electron-builder.json (1)
94-96: Add build hooks for Widevine signing.
TheelectronDist,afterPack, andafterSignconfigurations correctly integrate the Castlabs EVS signing scripts into the build pipeline. Ensure that the paths are relative to the project root and the hook scripts are executable.src/main/browser/browser.ts (2)
3-3: Good addition of components import from ElectronThis import is necessary for the Widevine CDM integration you're implementing.
88-97: Well-implemented Widevine readiness checkThe implementation correctly:
- Waits for the app to be ready first
- Then attempts to wait for Widevine components to be ready
- Gracefully handles potential failures with the promise catch
- Continues regardless of component readiness
This is a robust approach that won't block the browser from launching if Widevine isn't available.
build/hooks/types.d.ts (1)
1-12: Well-structured TypeScript interface for build hooksThis interface correctly defines the structure of the context object passed to packaging hooks with appropriate types from Electron Builder. Including the documentation URL is helpful for future reference.
.github/workflows/build-and-release.yml (3)
52-55: Castlabs EVS installation looks goodThe conditional installation for macOS and Windows platforms is appropriate since Widevine signing is only needed on these platforms.
Note: The
--break-system-packagesflag is typically used to override pip's restrictions, but since this is running in an isolated GitHub runner environment, it's acceptable.
56-63: Well-implemented Castlabs EVS authentication for macOSGood use of:
- Conditional execution based on OS
- GitHub secrets for credentials
continue-on-errorto prevent workflow failures if authentication fails
64-72: Well-implemented Castlabs EVS authentication for WindowsThe Windows-specific authentication correctly:
- Uses cmd shell which is appropriate for Windows
- Uses proper environment variable syntax for Windows
- Maintains consistent approach with the macOS version
.github/workflows/build.yml (3)
45-48: Castlabs EVS installation looks goodThe conditional installation for macOS and Windows platforms is appropriate.
49-56: Well-implemented Castlabs EVS authentication for macOSGood implementation mirroring the build-and-release workflow.
57-65: Well-implemented Castlabs EVS authentication for WindowsGood implementation mirroring the build-and-release workflow.
build/hooks/afterSign.js (1)
1-20: Well-structured hook for Widevine signingThe hook script correctly sets up Widevine VMP signing for Windows platforms after the standard signing process, which is necessary for Widevine CDM to work. The implementation follows the pattern established in afterPack.js for macOS.
build/hooks/afterPack.js (1)
1-20: Well-structured hook for Widevine signing on macOSThe hook script correctly sets up Widevine VMP signing for macOS platforms at the right stage in the build process (after packing but before Apple signing). This is properly complemented by the afterSign.js hook for Windows.
docs/contributing/updating-electron.md (1)
1-43: Comprehensive guide for updating the Castlabs Electron forkThe documentation provides clear instructions for updating the Electron dependency to support Widevine CDM. The steps for working around the Bun issue are well-documented.
build/hooks/components/castlabs-evs.js (1)
8-55: Well-implemented core signing functionalityThe implementation correctly handles the Widevine VMP signing process using Castlabs EVS, with proper process spawning, output capture, and error handling.
e20b987 to
8fc554b
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (5)
CONTRIBUTING.md (1)
73-79: Refine phrasing for clarity and conciseness.Consider replacing “contains Widevine VMP Signing Capabilities” with a more direct phrase and streamlining “in order to enable it” to “to enable it”.
Apply this diff:
- This build pipeline contains Widevine VMP Signing Capabilities. However, you will have to create an account in order to enable it. + This build pipeline includes Widevine VMP signing capabilities. However, you will have to create an account to enable them.🧰 Tools
🪛 LanguageTool
[style] ~75-~75: Consider a more concise word here.
Context: ...ver, you will have to create an account in order to enable it. Create an Account: https://...(IN_ORDER_TO_PREMIUM)
docs/contributing/updating-electron.md (4)
11-16: Remove comments from JSON code snippets.The JSON examples include
// Templateand// Examplecomments, which are not valid JSON. Consider either using a pseudo-JSON snippet or removing the inline comments:- ```json - // Template - "electron": "github:castlabs/electron-releases#<version>", - - // Example - "electron": "github:castlabs/electron-releases#v35.3.0+wvcus", - ``` + ```jsonc + "electron": "github:castlabs/electron-releases#<version>" + + // Example: + "electron": "github:castlabs/electron-releases#v35.3.0+wvcus" + ```
18-18: Add missing article for clarity.The instruction should read “update the
bun.lockfile” instead of “updatebun.lockfile.”Apply this diff:
- 3. Run `bun install` to update `bun.lock` file. + 3. Run `bun install` to update the `bun.lock` file.🧰 Tools
🪛 LanguageTool
[uncategorized] ~18-~18: You might be missing the article “the” here.
Context: ...s", ``` 3. Runbun installto update `bun.lock` file. 4. Find the electron en...(AI_EN_LECTOR_MISSING_DETERMINER_THE)
23-28: Clean up comments inbun.locksnippet.Similar to the package.json snippet, the snippet for
bun.lockcontains// Templateand// Examplecomments, which aren’t valid JSON. Consider changing tojsoncor removing comments:- ```json - // Template - "electron": ["electron@git+ssh://github.com/castlabs/electron-releases#<commit_hash>", "..."], - - // Example - "electron": ["electron@git+ssh://github.com/castlabs/electron-releases#c3d0eae09e098fbf33873ecbb95a8ca0fb5e48f5", "..."], - ``` + ```jsonc + "electron": [ + "electron@git+ssh://github.com/castlabs/electron-releases#<commit_hash>", + "..." + ] + + // Example: + // "electron": ["electron@git+ssh://github.com/castlabs/electron-releases#c3d0eae09e098fbf33873ecbb95a8ca0fb5e48f5", "..."] + ```
35-35: Clarify cache cleanup instruction.Change “delete bun's cache” to “delete the Bun cache” and capitalize consistently:
- 7. Additionally, you can delete bun's cache at `~/.bun/install/cache`, delete `node_modules`, and re-run `bun install` to make sure everything would work as expected. + 7. Additionally, you can delete the Bun cache at `~/.bun/install/cache`, remove `node_modules`, and re-run `bun install` to ensure everything works as expected.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (13)
.github/workflows/build-and-release.yml(1 hunks).github/workflows/build.yml(1 hunks)CONTRIBUTING.md(1 hunks)README.md(1 hunks)build/entitlements.mac.plist(1 hunks)build/hooks/afterPack.js(1 hunks)build/hooks/afterSign.js(1 hunks)build/hooks/components/castlabs-evs.js(1 hunks)build/hooks/types.d.ts(1 hunks)docs/contributing/updating-electron.md(1 hunks)electron-builder.json(1 hunks)package.json(2 hunks)src/main/browser/browser.ts(2 hunks)
✅ Files skipped from review due to trivial changes (2)
- README.md
- build/hooks/types.d.ts
🚧 Files skipped from review as they are similar to previous changes (9)
- package.json
- build/entitlements.mac.plist
- src/main/browser/browser.ts
- build/hooks/afterPack.js
- .github/workflows/build-and-release.yml
- build/hooks/afterSign.js
- electron-builder.json
- .github/workflows/build.yml
- build/hooks/components/castlabs-evs.js
🧰 Additional context used
🪛 LanguageTool
CONTRIBUTING.md
[style] ~75-~75: Consider a more concise word here.
Context: ...ver, you will have to create an account in order to enable it. Create an Account: https://...
(IN_ORDER_TO_PREMIUM)
docs/contributing/updating-electron.md
[uncategorized] ~18-~18: You might be missing the article “the” here.
Context: ...s", ``` 3. Run bun install to update `bun.lock` file. 4. Find the electron en...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
🔇 Additional comments (2)
docs/contributing/updating-electron.md (2)
1-4: Overview is clear.The description of the Castlabs Electron fork is informative and well-placed.
42-42: DevDependencies note is good.The reminder to keep
electronindevDependenciesis clear and valuable.
tldr
This will add support for serval streaming services, such as Netflix, Disney+, etc.
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores
Refactor