Skip to content

Modernize Electron app: fix Drive link parsing, harden security#22

Merged
gomgom merged 2 commits into
masterfrom
claude/github-repo-relevance-a3nicn
Jul 8, 2026
Merged

Modernize Electron app: fix Drive link parsing, harden security#22
gomgom merged 2 commits into
masterfrom
claude/github-repo-relevance-a3nicn

Conversation

@gomgom

@gomgom gomgom commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Upgrade Electron 13.6.6 → 43.x (plus electron-builder/electron-packager/asar), resolving the outstanding dependabot security PRs (Bump electron from 13.6.6 to 18.3.7 #19, Bump json5 from 2.1.2 to 2.2.3 #20, Bump http-cache-semantics from 4.1.0 to 4.1.1 #21)
  • Fix the core bug: URL parsing only recognized the old drive.google.com/open?id=... link format. Google's share UI now only generates drive.google.com/file/d/ID/view?usp=sharing, so current links silently failed. Both formats are now supported.
  • Harden main.js/preload.js/renderer.js: remove nodeIntegration/webviewTag, enable contextIsolation+sandbox, bridge IPC through contextBridge in preload instead of require('electron') in the renderer
  • Drop the module.exports jQuery workaround in index.html, which is no longer needed once nodeIntegration is off
  • Fix a </webview></iframe> closing-tag typo in the generated player HTML

No feature/UI changes — this is a fix-and-modernize pass. jQuery itself was intentionally left in place.

Test plan

  • URL-parsing unit test (6/6 cases: legacy open?id=, current file/d/ID/view with/without query string, invalid input)
  • Headless Electron 43 boot via Xvfb: confirmed window.gdPlayer.{resizeWindow,maximize,toggleAlwaysOnTop} are exposed and window.require is undefined (contextIsolation working), no console errors
  • Simulated both link formats loading correctly into the <iframe> player
  • Simulated size buttons (M/L) and always-on-top toggle actually changing window size/state via IPC
  • npm audit: 0 vulnerabilities after dependency bump
  • Manually tested locally by the repo owner — confirmed working end-to-end, including real Google Drive video playback

🤖 Generated with Claude Code


Generated by Claude Code

- Upgrade Electron 13.6.6 -> 43.x (plus electron-builder/electron-packager/asar)
- main.js: remove nodeIntegration/webviewTag, enable contextIsolation+sandbox
- preload.js: expose IPC via contextBridge instead of leaving it inert
- renderer.js: use the new bridge instead of require('electron'); parse
  both the legacy open?id= link and the current file/d/ID/view link
  format (Drive's share UI no longer generates the old format); fix
  </webview> typo to </iframe>
- index.html: drop the module.exports jQuery workaround, now unnecessary
  without nodeIntegration
Copilot AI review requested due to automatic review settings July 8, 2026 05:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Modernizes the Electron-based Google Drive video player by upgrading to a current Electron major, fixing Google Drive share-link parsing to support both legacy and current formats, and tightening renderer/main boundaries by moving window-control actions behind a preload contextBridge API.

Changes:

  • Update Drive URL parsing to support both open?id=... and /file/d/ID/... formats and fix the generated player closing tag to </iframe>.
  • Replace require('electron') usage in the renderer with a window.gdPlayer preload bridge.
  • Upgrade Electron/tooling dependencies and harden BrowserWindow webPreferences (context isolation + sandbox) while removing the jQuery module workaround.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
renderer.js Adds robust Drive link parsing, fixes iframe closing tag, and switches window-control actions to window.gdPlayer.
preload.js Introduces contextBridge API (gdPlayer) to send IPC commands from a locked-down renderer.
main.js Updates BrowserWindow security-related webPreferences (context isolation + sandbox).
index.html Removes the module workaround now that nodeIntegration is disabled; keeps jQuery + renderer script loading.
package.json Upgrades Electron and packaging toolchain versions to current major releases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread renderer.js Outdated
Comment thread renderer.js Outdated
Comment thread renderer.js Outdated
Comment thread main.js
Comment thread preload.js
- renderer.js: declare url/id/parsed/fileMatch/player with const/let
  instead of leaking as implicit globals
- main.js: explicitly set nodeIntegration:false and webviewTag:false
  instead of relying on defaults
- preload.js: whitelist the resizeWindow size argument before
  interpolating it into the IPC channel name
@gomgom gomgom merged commit 2b40af3 into master Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants