Skip to content

Self-host Rajdhani font and remove unsafe-inline from CSP#34

Merged
Ilia01 merged 3 commits into
mainfrom
copilot/self-host-rajdhani-font-csp-update
Apr 10, 2026
Merged

Self-host Rajdhani font and remove unsafe-inline from CSP#34
Ilia01 merged 3 commits into
mainfrom
copilot/self-host-rajdhani-font-csp-update

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 10, 2026

What changed

  • Added Rajdhani woff2 files (weights 500/600/700, latin subset) to assets/fonts/
  • Added src/renderer/fonts.css with local @font-face declarations
  • Removed Google Fonts CDN <link> and preconnect tags from both HTML files
  • Tightened CSP: style-src 'self' (dropped 'unsafe-inline'), font-src 'self' (dropped https://fonts.gstatic.com)
  • Added assets/fonts/OFL.txt with the SIL Open Font License 1.1 (copyright Indian Type Foundry) for distribution compliance

Why

External font loading adds latency and unsafe-inline in style-src weakens CSP. Self-hosting eliminates the CDN dependency and allows a strict policy. The accompanying OFL.txt ensures proper license attribution when distributing the packaged app.

How to test

  • Launch app — verify Rajdhani renders in both hub and overlay windows
  • Open DevTools console — confirm no CSP violations or font loading errors
  • Disconnect network — fonts still load (no external dependency)

Checklist

  • Builds clean
  • Tests pass
  • Tested manually

- Add woff2 font files for Rajdhani (500, 600, 700) to assets/fonts/
- Create fonts.css with @font-face declarations
- Remove Google Fonts CDN links and preconnect from both HTML files
- Remove unsafe-inline from style-src and update font-src to 'self' in CSP

Agent-Logs-Url: https://github.com/Ilia01/Beacon/sessions/4659a37b-89be-454d-aa1d-e97931227613

Co-authored-by: Ilia01 <155351862+Ilia01@users.noreply.github.com>
Copilot AI changed the title [WIP] Self-host Rajdhani font and remove unsafe-inline from CSP Self-host Rajdhani font and remove unsafe-inline from CSP Apr 10, 2026
Copilot AI requested a review from Ilia01 April 10, 2026 11:10
@Ilia01 Ilia01 requested a review from Copilot April 10, 2026 13:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR self-hosts the Rajdhani font and tightens the renderer Content Security Policy by removing external Google Fonts dependencies and dropping style-src 'unsafe-inline'.

Changes:

  • Added local @font-face declarations via a new src/renderer/fonts.css.
  • Removed Google Fonts CDN <link> / preconnect tags from renderer HTML files.
  • Tightened CSP to style-src 'self' and font-src 'self'.

Reviewed changes

Copilot reviewed 3 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/renderer/index.html Removes Google Fonts links; loads local fonts.css; tightens CSP.
src/renderer/hub.html Removes Google Fonts links; loads local fonts.css; tightens CSP.
src/renderer/fonts.css Introduces local @font-face rules pointing to bundled .woff2 assets.
assets/fonts/rajdhani-latin-500-normal.woff2 Adds bundled Rajdhani 500 weight font binary.
assets/fonts/rajdhani-latin-600-normal.woff2 Adds bundled Rajdhani 600 weight font binary.
assets/fonts/rajdhani-latin-700-normal.woff2 Adds bundled Rajdhani 700 weight font binary.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/renderer/fonts.css
@Ilia01
Copy link
Copy Markdown
Owner

Ilia01 commented Apr 10, 2026

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 10, 2026

@copilot apply changes based on the comments in this thread

Added assets/fonts/OFL.txt with the SIL Open Font License 1.1 (copyright Indian Type Foundry) alongside the Rajdhani woff2 files in commit 171e28b.

@Ilia01 Ilia01 marked this pull request as ready for review April 10, 2026 14:51
@Ilia01 Ilia01 merged commit cbd41f8 into main Apr 10, 2026
@Ilia01 Ilia01 deleted the copilot/self-host-rajdhani-font-csp-update branch April 10, 2026 14:52
@Ilia01 Ilia01 mentioned this pull request Apr 10, 2026
9 tasks
Copilot AI added a commit that referenced this pull request Apr 10, 2026
Reset branch to current main (after rewrite) and cleanly reapply
the post-game summary feature:

- summaryLog tracks every prompt (uncapped), promptHistory stays capped at 20
- buildGameSummary() aggregates summaryLog into per-category entries
- GameSummaryEntry.category strongly typed as PromptCategory
- Hub resizes in-place via getBounds/setBounds (no re-centering)
- Hub resets to default height on game-started
- Summary section in hub UI, hidden by default, rendered on game-end
- 6 new tests in summary.test.ts

Preserves all features from #34, #37, #38, #40.

Agent-Logs-Url: https://github.com/Ilia01/Beacon/sessions/e256904c-7a23-4575-a5e2-3c3df7bece08

Co-authored-by: Ilia01 <155351862+Ilia01@users.noreply.github.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.

self-host Rajdhani font and remove unsafe-inline from CSP

3 participants