# Architecture Firefox Manifest V2 WebExtension with no build step; all files are loaded as-is. ## Layout - `manifest.json` — extension manifest (background scripts, permissions, popup). - `background.js` / `sites.js` — background scripts. `sites.js` holds the per-site paywall bypass rules (cookie handling, regex blocks, DOM tweaks); `background.js` implements the request interception and rule engine that applies them. - `contentScript.js`, `contentScript_once.js`, `contentScript_once_var.js` — content scripts injected into pages to apply DOM-level bypass logic. - `options/` — options UI and popup (`options.html`, `popup.html`, their JS/CSS, plus `clearCookies.js`, `version.js`, exclusion/custom-rule sub-pages). - `custom/` — local override layer: - `custom/sites_custom.json` — per-site rule overrides/additions, merged with `sites.js` at runtime. - `custom/manifest.json` — an alternate manifest (e.g. "limited permissions" variant), not the one actually used to load the extension by default. - `sites_updated.json`, `updates.json` — metadata used by the extension's self-update check against the upstream project. - `lib/` — small vendored libraries (`purify.min.js`, `empty.js`). - `changelog.txt`, `README.md`, `README.html` — upstream-maintained docs; replaced wholesale on each upstream sync, don't hand-edit beyond local notes. ## Data flow (high level) 1. `background.js` reads the merged site rules (`sites.js` + `custom/sites_custom.json`). 2. On matching requests/pages it applies cookie/header rules via the `webRequest` API. 3. Content scripts apply DOM-level rules (removing overlays, revealing hidden content, injecting archive links, etc.) as instructed by the matched site rule. 4. The options/popup UI lets the user toggle sites, add custom rules, and view status.