diff --git a/AGENTS.md b/AGENTS.md index b08532b..16cd646 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -16,6 +16,14 @@ This add-on helps you collect and filter links from archive.org `https://archive - Popup → Content: try `collectLinks` first; if no receiver exists, Popup → Background → inject content → retry collect. - Popup → Background: `aria2.send` wraps `aria2.addUri` calls (batch) and keeps secrets out of page context. - Context menu: parent "Collect links…" with a dynamic submenu built per page ("Download/Copy All" and top file types). + - Popup → Background (badge): `popup.filteredCount` posts the current filtered count so the background can set a per‑tab badge. + +### Badges (Per‑tab) + +- Background maintains lightweight per‑tab state `{ url, isArchive, itemsCount, filteredCount }`. +- Default: on archive.org `/download/*` tabs, badge shows total item count; on other tabs, it is blank. +- When the popup filters change, it sends `popup.filteredCount`, and the badge shows that filtered count for the active tab. +- Badge updates on tab activation and URL changes; quick actions (copy/send) update only the current tab’s badge. ### Storage Keys @@ -79,11 +87,10 @@ Suggested scripts (future): `npm test`, `npm run test:e2e` with Playwright. ## Release & Signing - Add‑on ID and updates: `applications.gecko.id = "archive-org-link-grabber@jordanwages.com"` and `applications.gecko.update_url` points to the self‑hosted updates JSON. -- Scripts: `release:prepare:*` (syncs `manifest.json`), `release:sign` (creates XPI under `releases//`). +- Scripts: `release:prepare:*` (syncs `manifest.json`), `release:sign` (creates XPI under `releases//`), `release:push` (uploads artifacts and auto‑updates/uploads `releases/updates.json`). - Secrets: set `AMO_JWT_ISSUER` and `AMO_JWT_SECRET` locally (see `.env.example`); never commit them. ## Commit & PR Guidelines - Conventional Commits: `feat:`, `fix:`, `docs:`, `chore:`, `refactor:`. - Keep PRs small and focused; include motivation, UX screenshots for UI changes, test plan, and linked issues. - diff --git a/README.md b/README.md index fa2f5ea..25a6d4c 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Add-on for Firefox that enhances archive.org download pages (https://archive.org - Send to aria2: pushes to your configured aria2 RPC server using `aria2.addUri`. - Or use the page’s context menu: right‑click → "Collect links…" for quick "All" or top‑type actions. -Tip: The browser action badge shows counts when collecting/sending via context menu quick actions. +Tip: The browser action badge is per‑tab and reactive: on archive.org download pages it defaults to the total number of links; when you adjust filters in the popup, it shows the filtered count for that tab. It updates as you switch tabs. ## Regex and Matching @@ -141,7 +141,7 @@ For development, make changes and click “Reload” in `about:debugging` to pic - Background is a non‑module MV2 script. `src/lib/aria2-bg.js` exposes `addUri`, `addUrisBatch`, and `getVersion` on `globalThis` for background use. - Context menu parent: "Collect links…" appears on archive.org `/download/*` pages; submenu is rebuilt dynamically for top file types per page. -- BrowserAction badges show counts and state after collecting, copying, or sending. +- BrowserAction badges are per‑tab: default to total links on archive pages; switch to filtered counts when the popup is used on that tab. They also show counts and state after quick actions (copy/send) scoped to the current tab. ## Contributing @@ -164,6 +164,7 @@ This project is not affiliated with archive.org or aria2. Use responsibly and re - Set environment secrets locally (do not commit): `AMO_JWT_ISSUER=... AMO_JWT_SECRET=...` - Run: `npm run release:sign` - Artifacts land in `releases//` -- Self-hosted updates: `releases/updates.json` is tracked; update with the new version and `update_link` like `https://add-ons.jordanwages.com/archive-org-link-grabber/releases//archive-org-link-grabber-.xpi`. +- Push (self-hosted): `npm run release:push` uploads the signed artifacts in `releases//` and prepares/uploads `releases/updates.json` automatically (deriving the `update_link` from the manifest’s `applications.gecko.update_url`). + - Ensure FTP env vars are set (see `.env.example`). Notes: Keep AMO secrets local (see `.env.example`). CI is optional. You can tag releases with `git tag vX.Y.Z` and push tags if desired.