b234c8dcae13159730ef011089a6c65f9b5f1c80
Problem: Even after fixing the hls.js file naming (was 'hls.min.js', now
'hls.js'), videos don't play in the viewer. Likely root cause is CORS
blocking chrome-extension:// requests to phncdn.com CDN URLs that lack
CORS headers for extension origins.
Solution — two-layer fix:
1. Service worker proxy (background.js):
- New GOON_PROXY_FETCH handler fetches any URL via native fetch()
(no CORS restrictions in the service worker)
- Returns base64-encoded response data to the viewer
2. Custom HLS loader (viewer/viewer.js):
- HlsLoader implements hls.js Loader interface
- For phncdn.com/pornhubcdn URLs: proxies via GOON_PROXY_FETCH
- For all other URLs: uses native XHR (bypasses proxy overhead)
- Config passed to hls.js only when manifest URL needs proxying
3. Diagnostics (viewer/viewer.js):
- CORS check at page load for phncdn.com and per-video URL
- Full storage dump of video entries in console
- Manifest URL logging on each HLS load attempt
- Proxy activation logging for debugging
Goon Plugin
A Chrome extension (Manifest V3) that finds videos on the current page and displays them in a 2x2 grid.
Features
- Click the extension icon → "Find Videos" to scan the current tab for all
<video>elements - Videos are listed in the popup for reference (clickable links, "Copy All URLs" button)
- Click "Open Viewer" to open a new window with videos in a 2x2 grid (autoplay muted)
- Click "Clear" to reset the stored video list
Getting started
# 1. Install deps
npm i
# 2. Run in watch mode
npm run dev
# 3. Build for distribution
npm run build
Loading in Chrome
- Open
chrome://extensions/ - Enable Developer mode (top-right)
- Click Load unpacked → select the project root folder (where
manifest.jsonis located)
Project structure
manifest.json — Extension manifest (MV3)
package.json — Dev tooling (Vite + Vitest + TS)
vite.config.ts — Build config
src/
background/ — Service worker (MV3 background)
content/ — Content script
viewer/ — Popup UI + video viewer
index.html — Popup (Find Videos, Open Viewer buttons)
index.js — Popup logic (scans current tab for videos)
index.css — Popup styles
viewer.html — Viewer page (2x2 video grid in new window)
viewer.js — Viewer logic (renders video panels)
viewer.css — Viewer grid styles
icons/ — Extension icons (place .png files here)
Recommended extensions (VS Code)
- Chrome Extension Developer (extension-list-viewer)
- ESLint
- Prettier
VS Code workspace
Open goon_plugin.code-workspace to get the project with recommended extensions pre-installed.