- JavaScript 86.4%
- CSS 12.2%
- HTML 1.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| icons | ||
| src | ||
| styles | ||
| test | ||
| vendor | ||
| viewer | ||
| .gitignore | ||
| build.mjs | ||
| manifest.json | ||
| package-lock.json | ||
| package.json | ||
| PLAN.md | ||
| popup.html | ||
| README.md | ||
ghbrowse (prototype)
Firefox extension that lets you browse GitHub repos without hitting the browse-block: it fetches the repo tarball from codeload.github.com (the same non-HTML path git clone uses), extracts it into an IndexedDB "virtual FS" inside the extension, and renders the files in a normal-looking tab.
Why this works when github.com browsing doesn't
Unauthenticated HTML delivery is what gets throttled/blocked ("abuse detection", 429). The endpoints that serve raw repo bytes — codeload.github.com tarballs and .git smart-HTTP — remain reachable, which is why git clone keeps working on your network. ghbrowse only talks to those.
Load it in Firefox (dev mode)
- Open
about:debugging#/runtime/this-firefox. - Click Load Temporary Add-on… and select this directory's
manifest.json(any file in the folder works). - Done — it stays loaded until you restart Firefox. Then reload it again after edits, or use
npx web-ext runfor auto-reload on change.
(No signing needed for local dev; AMO signing only matters if you ever publish.)
Using it
Takeover mode (the main event)
When github.com serves a 403/429 block page on any owner/repo URL, ghbrowse takes over that same tab: the block page is replaced by a GitHub-look-alike file browser backed by the local mirror, and the address bar keeps showing real GitHub URLs (…/tree/main/src/file.ts, …/blob/main/readme.md) via pushState. Back/forward works; refresh re-triggers detection (and hits the cache if already fetched). A slim blue strip at top marks that you're in takeover mode, with a Reload original button.
- If GitHub only shows soft block markers (no 403/429 status), nothing is wiped automatically — instead a banner offers "Take over this tab with ghbrowse".
- Only files and commit history are emulated: issues/PRs/releases pages can't be served from the tarball/git data; takeover there falls back to the repo's file tree root.
Manual triggers
- Toolbar popup: type
owner/repo,owner/repo@branch, or paste a full github.com URL → opens the mirror in a dedicated viewer tab (works even when not blocked). - Right-click any page on github.com → "Open this repo in ghbrowse".
- Download progress shows as a
%badge on the toolbar icon.
The UI
GitHub-style repo chrome — repo header with Public pill, tab nav, branch pill, breadcrumb path, About sidebar — plus:
- File browser: directory table, README rendered below the tree, sanitized markdown, syntax highlighting (theme follows system light/dark), image previews, relative-link navigation inside snapshots.
- Line numbers: every text/code file gets a sticky GitHub-style line-number gutter; the header shows line count + size and offers Raw / Download / Copy / History.
- Commit history: the N Commits link next to the branch pill (like GitHub) shows the branch’s commit count and opens history. The first time a repo is opened, the count triggers a silent
.gitclone over the same smart-HTTP pathgit cloneuses; progress stays on the toolbar badge and the file UI is never blocked. History lists commits with author, relative date, and SHA; clicking a commit browses the entire tree at that revision. History inside a file view filters to commits touching that file. Load more pages through older commits. - Clear cache drops the repo (snapshot + git history) from local storage.
What's in the box
manifest.json MV3 manifest (gecko id, host perms: github.com + codeload only)
popup.html / src/popup.js
src/parse.js URL parsing, git info/refs pkt-line parser, helpers
src/tar.js minimal ustar/pax tar reader (fflate's browser build has no untar)
src/fsdb.js IndexedDB virtual-FS store ("repos" meta + "files" blobs/text)
src/background.js pipeline: ref resolve → codeload download → gunzip+untar → IDB
src/content/github.js block detector + banner on *.github.com
src/git-worker.js worker: isomorphic-git clone/log/tree/blob ops (keeps packfile work off the UI thread)
src/gitfs.js isomorphic-git fs adapter over an IndexedDB kv store
viewer/ the in-tab file browser (marked + DOMPurify + highlight.js)
vendor/ vendored UMD bundles (fflate, marked, dompurify, hljs, isomorphic-git) + a bundled Buffer polyfill for the git worker — via `npm run vendor`
Prototype limits (by design — see PLAN.md for the full roadmap)
- One snapshot per repo: re-fetching a different branch replaces the cached one.
- Whole-tarball download into memory before extract; 250 MB cap.
- Git history requires a separate full
.gitclone (noCheckout), also capped at 250 MB of packfile. The commit counter triggers this clone in the background on first view; huge histories report a partialN+count after 15 seconds. - No diff view yet: a commit opens the full file tree at that revision, not a patch.
- No submodules/LFS content (LFS pointers shown as text with a note).
- Block detection is heuristic (status 403/429 + page markers) — the manual triggers always work regardless.
Dev notes
npm install # pulls libs for vendoring only
npm run vendor # copies UMD bundles into vendor/
npm test # offline: viewer URL/hash state + Buffer-polyfill vendor guard
npm run test:idb # live: clone + log over a real IndexedDB-backed git fs (fake-indexeddb)
npm run test:git # live: clone → log → per-file log → tree → blob smoke test
node --check src/*.js viewer/app.js # syntax sanity (no build step otherwise)
There's intentionally no bundler: everything is classic scripts with globals (GhParse, GhTar, GhBrowseFS) so the extension stays readable and debuggable. The Node-testable modules have export guards at the bottom.