Documentation
¶
Overview ¶
Package branding owns the resolved-once brand assets behind one Handle: the brand logo SVG, the brand URL, and the implementor logo SVG. Each is derived from operator config (the portal logo, an mcpapps platform-info config map, and the implementor logo URL) and cached so repeated reads — and repeated fetches of a remote SVG — resolve only once.
Construction takes the resolved config values (the portal logo URL and the implementor logo URL) so the subsystem is constructible and testable without a Platform. It imports only the standard library, never pkg/platform.
InjectPortalLogo is the write seam the caller runs once while assembling the platform-info MCP app: it caches the brand URL and logo SVG from the app config, inlines the portal logo SVG (fetched from a URL) so it renders in sandboxed MCP App iframes that block external resource loading, and returns the possibly-augmented config map. The three accessors are the read seams the caller surfaces to its portal/admin consumers. Every method is nil-safe, so a caller that never built a Handle still reads empty brand assets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// PortalLogo is the portal.logo URL. When set and no explicit logo_svg /
// logo_url is present in the app config, InjectPortalLogo fetches and inlines
// it as logo_svg.
PortalLogo string
// ImplementorLogo is the portal.implementor.logo URL, fetched lazily by
// ResolveImplementorLogo.
ImplementorLogo string
}
Config carries the resolved brand config values the owner caches from. The caller translates its own config into this shape so this package stays free of the platform's config types.
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle owns the resolved brand assets: the portal / implementor logo URLs it was configured with and the cached brand logo SVG, brand URL, and implementor logo SVG. The read accessors expose the cached values to the caller's portal/admin consumers; each resolves at most once.
func New ¶
New builds a Handle from the resolved brand config. The cached assets start empty; InjectPortalLogo and ResolveImplementorLogo populate them on first use.
func (*Handle) BrandLogoSVG ¶
BrandLogoSVG returns the resolved brand logo SVG content (from the portal logo or the mcpapps platform-info config), or "" if none is configured or on a nil Handle.
func (*Handle) BrandURL ¶
BrandURL returns the resolved brand URL from the mcpapps platform-info config (brand_url), or "" if not configured or on a nil Handle.
func (*Handle) InjectPortalLogo ¶
InjectPortalLogo auto-populates the logo in the platform-info app config from the configured portal logo when the operator hasn't set logo_svg or logo_url explicitly. When the logo is an SVG URL, it is fetched and inlined as logo_svg so the logo renders in sandboxed contexts (MCP App iframes) that block external resource loading. It also caches brand_url from the app config for use by BrandURL(). No-op passthrough on a nil Handle.
func (*Handle) ResolveImplementorLogo ¶
ResolveImplementorLogo fetches the implementor logo SVG from the configured implementor logo URL. The result is cached so subsequent calls return the same value without another HTTP request. Returns "" if no logo URL is configured, the fetch fails, or the Handle is nil.