Skip to content

Consolidate duplicated vendored JS into shared /js/#22

Merged
jonasniesner merged 1 commit into
OpenDisplay:mainfrom
balloob:chore/consolidate-vendored-js
Jul 5, 2026
Merged

Consolidate duplicated vendored JS into shared /js/#22
jonasniesner merged 1 commit into
OpenDisplay:mainfrom
balloob:chore/consolidate-vendored-js

Conversation

@balloob

@balloob balloob commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #21. Three vendored libraries existed in two copies each; this moves one canonical copy of each into /js/ and repoints both pages (firmware/toolbox/index.html and nrf_web_tools/index.html) at it. For both divergent pairs, the kept copy is the good one — so this is a bug fix for whichever page was serving the stale copy, not just cleanup:

  • /js/jszip.min.js — the two copies were byte-identical; pure dedup.
  • /js/web-serial-polyfill.js — was toolbox/serial.js and nrf_web_tools/web-serial-polyfill.js under different names. Only the toolbox copy had the fixes from 146f4c0 (unhandled rejection in pull(), overlapping-transferIn byte reordering, USB device left open on close()), so the demo page was still shipping those bugs. The fixed copy wins.
  • /js/nrf_web_tools.js — the toolbox shipped an older revision missing the multi-part DFU reconnect flow (WAITING_RECONNECT / flashRemainingFirmware / reconnectAndContinue), so flashing a softdevice+bootloader+app NRF52840.zip from the toolbox dead-ended at "Installation failed" after part 1. The newer copy wins; both revisions export the same NrfWebTools(buttonElement, zipPath) API with identical constructor semantics, and the only network access is fetch(zipPath), which resolves against the page URL rather than the script URL — verified drop-in.

Script-injection src values and their querySelector('script[src=…]') duplicate-load guards were updated together in both pages. Verified: no remaining references to the old paths anywhere in httpdocs/ (grep), and node --check passes on all three relocated files.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TEs4tsAWupf2DXFM4faECC

jszip.min.js existed twice (byte-identical); the toolbox and the
nrf_web_tools demo page now both load /js/jszip.min.js.

The web-serial polyfill existed twice under different names, and only
toolbox/serial.js had the unhandled-rejection / byte-reordering /
port-close fixes (146f4c0). That fixed copy is now /js/web-serial-polyfill.js
and the stale nrf_web_tools/web-serial-polyfill.js is gone, so the demo
page gets the fixes too.

nrf_web_tools.js existed twice, and the toolbox shipped the older
revision without the multi-part DFU reconnect flow, so multi-image
NRF52840 packages dead-ended there after part 1. The newer copy is now
/js/nrf_web_tools.js and both pages load it. Both copies export the
same NrfWebTools API and the zip path resolves against the page URL,
so the move is drop-in.

Script-injection src values and their querySelector guards updated in
both pages to the new absolute paths.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TEs4tsAWupf2DXFM4faECC
@jonasniesner jonasniesner merged commit ded99fe into OpenDisplay:main Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants