Skip to content

Commit d29fe01

Browse files
committed
readme and settings rework
1 parent 8121b58 commit d29fe01

49 files changed

Lines changed: 848 additions & 1517 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ node_modules/
44
coverage/
55
docs/easy-ecad-downloader-architecture.drawio
66
docs/professional-grade-review.md
7+
*.psd
78

89
# Local secrets and environment files
910
.env

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This repository is a compact browser extension that detects supported distributo
77
- `src/content_script.js`: page detection for EasyEDA/LCSC and SamacSys-backed Mouser/Farnell contexts
88
- `src/popup.js`: popup UI state, settings interaction, preview requests, and export requests
99
- `src/service_worker.js`: thin background entrypoint that registers the runtime
10-
- `src/service_worker_runtime.js`: provider routing, runtime gating, auth-refresh orchestration, and worker dependency composition
10+
- `src/service_worker_runtime.js`: provider routing, runtime gating, response shaping, and worker dependency composition
1111
- `src/core/`: shared worker helpers for settings, downloads, preview data, export artifacts, and storage-backed libraries
1212
- `src/sources/`: EasyEDA and SamacSys source adapters and upstream fetch/archive helpers
1313
- `src/kicad_converter.js` and `src/kicad/`: EasyEDA-to-KiCad conversion and OBJ-to-WRL conversion

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This section summarizes the current `Development` branch compared with `main` as
1111
- Added Mouser SamacSys support for part detection, preview loading, upstream KiCad ZIP download, and KiCad library or loose-file export.
1212
- Added Farnell SamacSys support through the shared SamacSys distributor flow.
1313
- Added Firefox SamacSys relay support for preview and export requests through a user-managed relay URL.
14-
- Added SamacSys authentication settings for relay auth, upstream username/password Basic auth generation, manual upstream `Authorization` override, captured Firefox upstream auth reuse, and one automatic Firefox auth-refresh retry after ZIP `401` responses.
14+
- Added SamacSys authentication settings for relay auth and upstream username/password Basic auth generation.
1515
- Added a configurable Downloads-relative KiCad library folder.
1616
- Added runtime ZIP extraction for SamacSys archives, including KiCad symbols, footprints, STEP models, and WRL files already present in the archive.
1717
- Added `systemDesign.md`, architecture notes, Firefox relay documentation, contribution guidance, and security reporting documentation.
@@ -28,9 +28,10 @@ This section summarizes the current `Development` branch compared with `main` as
2828
- Split the oversized service-worker regression file into focused core, EasyEDA, direct SamacSys, and Firefox SamacSys test files backed by a shared harness.
2929
- Reworked the popup into a provider-aware UI that shows fixed manufacturer metadata plus source-specific part metadata and advanced SamacSys/Firefox settings.
3030
- Moved persistent download layout, Firefox relay, and SamacSys auth settings from the popup into a dedicated extension settings page.
31-
- Grouped Firefox helper and captured-sign-in controls into a Firefox-only advanced settings menu.
31+
- Grouped Firefox helper controls into a Firefox-only advanced settings menu.
3232
- Added explicit `Save` and `Discard` controls to the settings page.
3333
- Made helper tokens and SamacSys passwords session-only by default, with explicit remember-on-this-device opt-ins and warning copy.
34+
- Removed hidden upstream `Authorization` capture, manual override handling, and automatic Firefox auth-refresh retry behavior.
3435
- Updated the manifest for Chrome service-worker operation and Firefox background-document fallback on Firefox `121+`.
3536
- Updated README and project docs to describe supported providers, setup, settings, auth behavior, browser support, validation, and repository layout.
3637

README.md

Lines changed: 190 additions & 104 deletions
Large diffs are not rendered by default.

SECURITY.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,9 @@ The extension stores ordinary settings in `chrome.storage.local`. That storage c
2626

2727
- the optional Firefox SamacSys relay URL
2828
- remember-on-this-device flags for optional secrets
29-
- an optional manual upstream SamacSys `Authorization` override
3029
- accumulated KiCad symbol-library text used for library-mode exports
3130

32-
The optional Firefox helper password/token and optional SamacSys username/password are stored in `chrome.storage.session` by default, so they are kept only for the current browser session. They are copied to `chrome.storage.local` only when the user explicitly ticks the matching `Remember ... on this device` box after reading the warning in the settings page.
33-
34-
The latest Firefox-captured upstream SamacSys `Authorization` header is stored in `chrome.storage.session` and treated as short-lived session data. The extension ignores captured auth values older than one hour.
31+
The optional Firefox authentication token and optional SamacSys username/password are stored in `chrome.storage.session` by default, so they are kept only for the current browser session. They are copied to `chrome.storage.local` only when the user explicitly ticks the matching `Remember ... on this device` box after reading the warning in the settings page.
3532

3633
Relay auth and upstream SamacSys auth are intentionally separate. The relay auth header is sent only to the configured user-managed relay. Upstream SamacSys auth is sent only to SamacSys or inside a relay payload that asks the relay to contact SamacSys.
3734

contributing.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,47 @@ For SamacSys-backed pages, note whether previews worked, whether ZIP export fail
2727

2828
## Development setup
2929

30+
Use Node `22.13.0+` recommended, Node `20.19.0+`, or Node `24+`. Node `21.x` is not supported by the current Vitest/Vite/jsdom stack.
31+
3032
1. Clone the repository.
3133
2. Install dependencies with `npm install`.
3234
3. Load the extension unpacked in Chrome or temporarily in Firefox.
3335
4. Run `npm run validate` before finalizing changes.
3436

37+
The repository includes `.nvmrc` for the recommended Node version.
38+
39+
## Manual extension loading
40+
41+
Chrome:
42+
43+
1. Open `chrome://extensions`.
44+
2. Enable `Developer mode`.
45+
3. Click `Load unpacked`.
46+
4. Select the repository root that contains `manifest.json`.
47+
48+
Firefox:
49+
50+
1. Open `about:debugging#/runtime/this-firefox`.
51+
2. Click `Load Temporary Add-on`.
52+
3. Select `manifest.json` from the repository root.
53+
54+
The development manifest expects Firefox `121+` so Firefox can use the background-document fallback while Chrome uses the Manifest V3 service worker.
55+
56+
## Local validation
57+
58+
Run the local checks with:
59+
60+
```bash
61+
npm install
62+
npm run lint
63+
npm test
64+
npm run validate
65+
```
66+
67+
`npm run validate` runs linting, the Vitest regression suite, a moderate-severity dependency audit, and whitespace checks. CI uses `npm ci` and the same validation script on the supported Node lines.
68+
69+
The Vitest suite includes a history-wide security hygiene check. It is meant for full validation, CI, security cleanup, and before sharing pushed history; it does not need to be run manually for every intermediate local commit while iterating.
70+
3571
Use `README.md` for the operator-facing overview. Use `systemDesign.md` for the implemented design and `docs/architecture-notes.md` for short implementation notes.
3672

3773
## Change guidelines

docs/architecture-notes.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This file records short implementation notes that supplement, but do not replace
88
- `src/popup.js`: popup UI state, preview requests, Firefox SamacSys relay gating, settings-page launch, and export requests
99
- `src/settings_page.js`: persistent download layout plus session-first SamacSys auth settings and Firefox-only advanced helper settings
1010
- `src/service_worker.js`: thin runtime entrypoint only
11-
- `src/service_worker_runtime.js`: provider routing, runtime gating, Firefox SamacSys auth capture, automatic auth-refresh orchestration, response shaping, and composition of worker dependencies
11+
- `src/service_worker_runtime.js`: provider routing, runtime gating, response shaping, and composition of worker dependencies
1212
- `src/core/*.js`: shared worker business logic for settings, downloads, storage-backed symbol-library handling, shared export artifact writing, and common normalization
1313
- `src/sources/*.js`: source adapters plus source-specific fetch/parse/export helpers
1414
- `src/sources/samacsys_distributor_adapter.js` is the shared backend adapter for Mouser and Farnell
@@ -35,12 +35,10 @@ This file records short implementation notes that supplement, but do not replace
3535
- SamacSys distributor support is still Chrome-first, but Firefox can opt into a user-managed relay through the advanced Firefox settings menu.
3636
- Chrome direct SamacSys ZIP export now retries once with configured upstream auth after a `401`, but preview requests still use the normal direct browser session without preemptive auth headers.
3737
- Firefox relay mode forwards matching `componentsearchengine.com` cookies so authenticated SamacSys ZIP downloads can reuse the browser session instead of teaching the relay to log in.
38-
- Firefox relay mode can also generate the upstream SamacSys HTTP Basic auth header locally from optional username/password credentials, avoiding any dependency on a browser-captured header when the user prefers that setup.
38+
- Firefox relay mode can also generate the upstream SamacSys HTTP Basic auth header locally from optional username/password credentials.
3939
- Optional helper tokens and SamacSys passwords are session-only by default; the settings page requires explicit opt-in before remembering them in browser local storage.
40-
- Firefox now stores the latest observed upstream SamacSys `Authorization` header through `webRequest` as short-lived session data and reuses it for proxied Firefox requests until a newer one is captured or it expires.
4140
- Relay auth and upstream SamacSys auth are separate: relay auth is sent only on the Worker POST, while upstream auth is forwarded inside the relay payload.
4241
- SamacSys ZIP-export `401` responses are mapped to a sign-in-required error because upstream authentication can be stricter for downloads than for previews.
43-
- On Firefox relay mode, one failed SamacSys ZIP export can trigger a single auth-refresh attempt, then a single retry with the newly captured upstream auth.
4442
- SamacSys ZIP extraction treats `KiCad/` and `3D/` directories as valid whether they appear at the archive root or under a part-specific parent folder.
4543
- The current repository is intentionally compact; add new sources through focused adapters or distributor detection changes rather than introducing a broader application framework.
4644
- The manifest intentionally declares both `background.service_worker` and `background.scripts` so Chrome can run the service worker while Firefox falls back to a background document on Firefox 121+.
227 KB
Loading
86.9 KB
Loading
237 KB
Loading

0 commit comments

Comments
 (0)