Skip to content

fix: bundle fonts locally; show endpoint warnings in speech settings - #2

Merged
SPhillips1337 merged 2 commits into
mainfrom
fix/local-fonts-endpoint-warnings
Nov 10, 2026
Merged

SPhillips1337 merged 2 commits into
mainfrom
fix/local-fonts-endpoint-warnings

Conversation

@SPhillips1337

@SPhillips1337 SPhillips1337 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1 (merged). Rebased onto main.

Fonts are bundled, not loaded from Google

  • Inter and JetBrains Mono now come from @fontsource-variable/* (OFL-1.1), bundled by Vite. Before this, every launch requested fonts.googleapis.com, and the app showed fallback fonts when offline.
  • The CSP drops the Google hosts (style-src 'self' 'unsafe-inline'; font-src 'self').
  • THIRD-PARTY-NOTICES.md carries the OFL text and is added to electron-builder files, so it ships with the app.

Endpoint warnings are shown

isLoopbackEndpoint and sendsKeyInClear existed but the UI never used them. The new endpointNotices(url, hasKey) turns them into messages, shown under Server URL when the engine is Server ASR:

URL Notice
loopback (127.0.0.1, localhost, ::1, *.localhost) none
https://api.example.com/... amber: speech leaves this machine
http://10.0.0.5:8080/... with a key saved or typed red: key sent unencrypted; amber: speech leaves this machine
not a url, file://, ws:// red: requests will be refused

Verification

  • npm run ci: typecheck, 125 tests (6 new in tests/endpoints.test.ts), build.
  • Ran the built app over CDP with a throwaway profile:
    • no external network requests on load;
    • Inter Variable and JetBrains Mono Variable loaded from local files;
    • each row of the table above produced exactly the notices listed, checked against the rendered DOM and a screenshot.

🤖 Generated with Claude Code

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

The changes are well-implemented and achieve both stated goals (bundled fonts and endpoint warnings in speech settings).

Fonts: Google Fonts <link> tags and CSP allowances are cleanly removed and replaced with @fontsource-variable/* imports. The updated CSP (font-src 'self') is correctly tightened.

Endpoint warnings: The endpointNotices function in src/shared/endpoints.ts is correct and the six new tests cover the full decision table from the PR description. The UI integration in main.tsx passes the right hasKey signal (speechKeyStatus.stored || speechKeyDraft.trim() !== '').

One minor observation (not a blocker): LOOPBACK_HOSTNAMES in endpoints.ts contains '[::1]' (with brackets), but URL.hostname for http://[::1]/ returns '::1' without brackets, so '[::1]' is a dead set entry that will never match. IPv6 loopback detection still works correctly because '::1' (without brackets) is also in the set. Worth cleaning up in a follow-on to avoid misleading future readers, but it does not affect correctness.

No blocking defects found — the PR is safe to merge after #1 lands and GitHub retargets this branch to main.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@SPhillips1337

Copy link
Copy Markdown
Contributor Author

Re the LOOPBACK_HOSTNAMES note: it's the other way round. The WHATWG URL parser keeps the brackets on IPv6 hostnames, so '[::1]' is the entry that matches:

$ node -e "for (const u of ['http://[::1]/','http://[::1]:8080/v1','http://[0:0:0:0:0:0:0:1]/']) console.log(u, '->', JSON.stringify(new URL(u).hostname))"
http://[::1]/                -> "[::1]"
http://[::1]:8080/v1         -> "[::1]"
http://[0:0:0:0:0:0:0:1]/    -> "[::1]"

Removing '[::1]' would make a local [::1] speech server show "speech leaves this machine". With a key set, it would also show the red "unencrypted key" warning. I tried it: the loopback test in tests/endpoints.test.ts fails.

29287f9 adds a comment next to the set explaining this, and a test case with the expanded [0:0:0:0:0:0:0:1] form. No behaviour change.

🤖 Generated with Claude Code

@SPhillips1337
SPhillips1337 deleted the branch docs/public-polish November 10, 2026 11:20
SPhillips1337 and others added 2 commits November 10, 2026 11:20
Fonts
- Inter and JetBrains Mono now come from @fontsource-variable packages
  bundled by Vite instead of Google Fonts, so launching makes no network
  request and the UI renders correctly offline
- CSP drops fonts.googleapis.com / fonts.gstatic.com (font-src 'self')
- THIRD-PARTY-NOTICES.md carries the OFL text and ships in the package

Endpoint warnings
- endpointNotices(url, hasKey) in src/shared/endpoints.ts turns the
  existing isSupportedEndpoint / isLoopbackEndpoint / sendsKeyInClear
  helpers into settings-panel messages; they were never shown before
- Speech settings show them under Server URL when the engine is Server:
  red for an invalid URL or a key over plain http off-machine, amber when
  speech leaves the machine
- endpoints.ts header no longer mentions features this app doesn't have

SECURITY.md updated to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
URL.hostname keeps brackets on IPv6 literals, so '[::1]' is the entry
that matches. A review bot suggested removing it as dead code; doing so
would flag a local [::1] server as off-machine. Add a comment and a test
case with the expanded [0:0:0:0:0:0:0:1] form; removing '[::1]' now
fails the loopback test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SPhillips1337 SPhillips1337 reopened this Nov 10, 2026
@SPhillips1337
SPhillips1337 changed the base branch from docs/public-polish to main November 10, 2026 11:21
@SPhillips1337
SPhillips1337 force-pushed the fix/local-fonts-endpoint-warnings branch from 29287f9 to dd13547 Compare November 10, 2026 11:21
@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@SPhillips1337
SPhillips1337 merged commit 66ad011 into main Nov 10, 2026
1 of 2 checks passed
@SPhillips1337
SPhillips1337 deleted the fix/local-fonts-endpoint-warnings branch November 10, 2026 11:23
SPhillips1337 added a commit that referenced this pull request Nov 10, 2026
- PROGRESS: public since 2026-11-10, archive repo pointer, #1/#2 deliveries,
  SonarCloud removal, next checks
- Spine: session checkpoint, public-identity decision, IPv6 hostname lesson

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant