Skip to content

feat: serve tight favicon variants for API server and docs site#1879

Merged
ZaynJarvis merged 2 commits intovolcengine:mainfrom
t0saki:feat/server-favicon
May 7, 2026
Merged

feat: serve tight favicon variants for API server and docs site#1879
ZaynJarvis merged 2 commits intovolcengine:mainfrom
t0saki:feat/server-favicon

Conversation

@t0saki
Copy link
Copy Markdown
Contributor

@t0saki t0saki commented May 7, 2026

Description

Browsers and MCP clients (claude.ai, Claude Desktop) auto-fetch /favicon.ico and /apple-touch-icon.png to display a server icon. The 1933 API server previously returned JSON 404s for these paths, and the VitePress docs site pointed its <link rel=\"icon\"> at the 1000×1000 ov-logo.png used by the in-page nav — that PNG has heavy whitespace, so the actual sail glyph rendered visibly small inside the browser tab.

This PR adds tight, properly-sized favicon variants (trimmed of whitespace, padded to a square canvas) and wires them into both the API server and the docs site.

Related Issue

N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

API server (port 1933)

  • Add /favicon.ico, /favicon.png, /apple-touch-icon.png routes in openviking/server/app.py, each with Cache-Control: public, max-age=86400.
  • Ship three favicon variants under openviking/console/static/ (already declared in pyproject.toml [tool.setuptools.package-data], so wheels pick them up without an extra entry):
    • favicon.ico — multi-size (16/32/48), ~15 KB
    • favicon-32.png — 32×32, ~1.7 KB
    • apple-touch-icon.png — 180×180, ~14 KB (used by claude.ai / iOS)
  • Wire openviking/console/static/index.html <link rel=\"icon\"> / apple-touch-icon to the new files.

Docs site (VitePress)

  • Ship the same three favicon variants under docs/images/ (VitePress's vite.publicDir, served at site root).
  • Update docs/.vitepress/config.ts head: to reference the tight variants instead of the padded ov-logo.png. The in-page nav themeConfig.logo keeps using the original PNG — the whitespace looks balanced there.

Source

All variants were generated from docs/images/ov-logo.png via magick -trim +repage -gravity center -extent to crop whitespace and square the canvas before resizing.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Local verification:

  • python3 -c \"import ast; ast.parse(open('openviking/server/app.py').read())\" — syntax OK.
  • curl -I http://localhost:1933/favicon.ico returns 200 with content-type: image/x-icon.
  • curl -I http://localhost:1933/apple-touch-icon.png returns 200 with content-type: image/png.
  • Browser tab on the standalone console (/console) shows the OV logo at expected size.
  • npm run docs:dev in docs/ resolves the new icons via ${base}favicon.ico, etc.

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

N/A — see docs/images/ov-logo.png for the source logo. Generated assets are committed under openviking/console/static/ and docs/images/.

Additional Notes

  • No new dependencies. The API handler reuses FileResponse from FastAPI.
  • The docs and API server share generated variants but each ships its own copy under its respective public asset directory; this avoids the docs site reaching into the Python package and the package reaching into docs/.
  • Cache-Control: public, max-age=86400 keeps repeat favicon fetches off the API server.

Browsers and MCP clients (claude.ai, Claude Desktop) auto-fetch
/favicon.ico and /apple-touch-icon.png to display a server icon.
The 1933 server previously returned JSON 404s for these paths,
leaving connectors with a generic placeholder.

Add small route handlers that serve OV-branded icons from the
existing console/static directory (already shipped as package
data). Also wire the console index.html to the new icons.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🏅 Score: 98
🧪 No relevant tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

PR Code Suggestions ✨

No code suggestions found for the PR.

The docs site previously pointed `<link rel="icon">` at the same
1000x1000 ov-logo.png used by the in-page nav, so the tab favicon
rendered visibly small inside heavy whitespace.

Reuse the trim+square favicon variants generated for the API server
(favicon.ico, favicon-32.png, apple-touch-icon.png) under docs/images/
and wire them into the VitePress head config. The in-page nav logo
still uses the original PNG (whitespace looks fine in that context).
@t0saki t0saki changed the title feat(server): serve favicon and apple-touch-icon at root feat: serve tight favicon variants for API server and docs site May 7, 2026
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

Adds OV-branded favicon / touch-icon handling so browsers and MCP clients don’t see JSON 404s (and can display an icon) when probing common root icon paths.

Changes:

  • Add root-level routes on the 1933 API server for /favicon.ico, /favicon.png, and /apple-touch-icon.png backed by files in openviking/console/static/.
  • Add cache headers (Cache-Control: public, max-age=86400) for those icon responses.
  • Update the console index.html to reference the packaged icon assets.

Reviewed changes

Copilot reviewed 3 out of 9 changed files in this pull request and generated 3 comments.

File Description
openviking/server/app.py Registers three root icon routes returning FileResponse with caching headers.
openviking/console/static/index.html Adds <link rel="icon"> and <link rel="apple-touch-icon"> tags referencing console icon assets.

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

Comment thread openviking/server/app.py
_favicon_headers = {"Cache-Control": "public, max-age=86400"}
_favicon_files = {
"/favicon.ico": ("favicon.ico", "image/x-icon"),
"/favicon.png": ("favicon-32.png", "image/png"),
Comment thread openviking/server/app.py
Comment on lines +428 to +433
def _make_favicon_handler(filename: str, media_type: str):
path = _static_dir / filename

async def _handler():
return FileResponse(path, media_type=media_type, headers=_favicon_headers)

Comment thread openviking/server/app.py
Comment on lines +436 to +439
for _route, (_fname, _mime) in _favicon_files.items():
app.add_api_route(
_route, _make_favicon_handler(_fname, _mime), include_in_schema=False
)
Copy link
Copy Markdown
Collaborator

@ZaynJarvis ZaynJarvis left a comment

Choose a reason for hiding this comment

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

ok.. if it works it works; 生态接入的 feat

@ZaynJarvis ZaynJarvis merged commit 33113eb into volcengine:main May 7, 2026
7 of 8 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project May 7, 2026
ZaynJarvis pushed a commit that referenced this pull request May 7, 2026
#1881)

The favicons added in #1879 were generated with `-background white
-extent` to pad the trimmed logo to a square canvas. The source
ov-logo.png is a transparent sRGBA PNG, so this baked a solid white
square into the alpha channel. On dark-mode browser tabs the icon
showed up as a white block.

Regenerate the variants with `-background none` so the padded canvas
stays transparent. The visible glyph is unchanged; only the previously
white padding is now alpha=0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants