@mediago/extension
A Chromium browser extension (Manifest V3) that sniffs downloadable video / audio resources on every page you visit and sends the picked ones to your MediaGo server in one click — works with both the Desktop build (auto-detected) and the self-hosted Docker build (filled in manually).
Detection rules live in @mediago/shared-common and are shared with
the Electron sniffing helper, so the set of URLs detected in the
browser matches what the desktop in-app browser would see.
Features (P0)
- MV3, no external runtimes, vanilla TS + tiny CSS
chrome.webRequest.onSendHeaderswiretap on<all_urls>- Per-tab source list with badge count
- Auto-detects a local MediaGo Desktop on
127.0.0.1:9900at install / browser startup (no onboarding needed for desktop users) - Options page for Docker users to point at a custom URL + API key
- One-click "import all" / per-row "import" to MediaGo's
POST /api/downloads
Dev
pnpm --filter @mediago/extension dev
This runs Vite with @crxjs/vite-plugin and writes a live-reloading
build to packages/mediago-extension/dist. Load the dist/ folder as
an unpacked extension (see Install below).
Build
pnpm --filter @mediago/extension build
Outputs the production bundle to packages/mediago-extension/dist/.
Install (end users)
- Download / clone the built
dist/directory (or.zipit up). - Open
chrome://extensions(Edge / Brave:edge://extensions/brave://extensions). - Enable Developer mode (top right).
- Click Load unpacked and select the
dist/directory. - The 🧲 MediaGo icon should appear in your toolbar.
Desktop (auto)
If MediaGo Desktop is already running, nothing else to do — the
extension probes http://127.0.0.1:9900/healthy on install / startup
and self-configures.
Docker / self-hosted
- Click the extension icon → ⚙️ (bottom right) to open Options.
- Fill in your server URL, e.g.
http://your-host:8899. - Fill in the API Key you configured with
--enable-auth. - Click 测试连接. Green = ready. Click 保存.
Use
- Browse to a page that plays / exposes video (Bilibili, a live-stream site, a random MP4 link, etc.).
- As requests fly by, the extension icon shows a red badge with a count — those are the captured sources.
- Click the icon to open the popup, pick items, hit 导入.
- Tasks show up in the MediaGo download list and start downloading.
Architecture
src/
background/ service_worker — sniffer + probe + HTTP client
index.ts registers listeners synchronously at top level
sniffer.ts chrome.webRequest.onSendHeaders → matched sources
storage.ts chrome.storage.local (settings) + session (tabs)
probe.ts auto-detect Desktop on install / startup
mediago-client.ts POST /api/downloads, GET /healthy
messages.ts popup / options → bg message router
popup/ extension popup — per-tab source list + import
options/ extension options page — server URL + API key
shared/ types & constants shared across the 3 surfaces
Permissions
webRequest— read outbound request URLs + headers for matchingtabs— look up page title / URL for the currently-active tabstorage— save user settings + per-tab sourceshost_permissions: <all_urls>— listen across every site
No content scripts, no DOM injection, no remote code. The extension never sends anything to third parties; its only outbound traffic goes to the MediaGo server URL configured in Options.