Skip to content

feat(ui): add customizable HTML page title#437

Merged
fank merged 4 commits into
mainfrom
feat/customize-page-title
May 11, 2026
Merged

feat(ui): add customizable HTML page title#437
fank merged 4 commits into
mainfrom
feat/customize-page-title

Conversation

@fank
Copy link
Copy Markdown
Member

@fank fank commented May 11, 2026

Summary

  • Adds a customize.pageTitle option that overrides the browser tab <title> (currently hardcoded to OCAP2).
  • Wired through the existing /api/v1/customize endpoint and CustomizeProvider; respects the customize.enabled gate and restores the original title on cleanup.
  • Configurable via setting.json or OCAP_CUSTOMIZE_PAGETITLE env var.

Test plan

  • With customize.enabled: true and customize.pageTitle: "My Server", the browser tab shows My Server.
  • With customize.enabled: false, the tab still shows the default OCAP2.
  • With customize.enabled: true and pageTitle empty, the tab still shows OCAP2.

Adds a `customize.pageTitle` option that overrides the browser tab title
(<title>) at runtime via the existing /api/v1/customize endpoint.
Original title is restored on cleanup.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

Coverage Report for ui

Status Category Percentage Covered / Total
🔵 Lines 98.98%
🟰 ±0%
5446 / 5502
🔵 Statements 98.27%
🟰 ±0%
7752 / 7888
🔵 Functions 97.8%
🟰 ±0%
2187 / 2236
🔵 Branches 89.52%
⬆️ +0.03%
2418 / 2701
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
ui/src/data/apiClient.ts 97.25%
🟰 ±0%
91.66%
🟰 ±0%
98.14%
🟰 ±0%
98.25%
🟰 ±0%
420, 549, 591-592
ui/src/hooks/useCustomize.tsx 100%
🟰 ±0%
94.44%
⬆️ +2.78%
100%
🟰 ±0%
100%
🟰 ±0%
Generated in workflow #636 for commit 6a6ae8d by the Vitest Coverage Report Action

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a configurable 'pageTitle' setting across the backend configuration and frontend API client, allowing the application title to be dynamically updated via the 'CustomizeProvider'. The review highlights a potential race condition in the 'onMount' hook where global 'document.title' side effects are performed asynchronously without verifying the component's mounted state, suggesting that this should be handled to ensure the title is correctly restored upon unmounting.

Comment thread ui/src/hooks/useCustomize.tsx
@github-actions
Copy link
Copy Markdown

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/web/internal/server 94.25% (+0.00%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/OCAP2/web/internal/server/setting.go 93.42% (+0.09%) 76 (+1) 71 (+1) 5 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

@fank fank merged commit 0f04b78 into main May 11, 2026
3 checks passed
@fank fank deleted the feat/customize-page-title branch May 11, 2026 19:32
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