storefront

package
v0.13.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProfileNamespace = "x402"
	ProfileConfigMap = "obol-storefront-profile"
	ProfileDataKey   = "profile.json"
	DefaultLogoPath  = "/obol-stack-logo.png"
)

Variables

This section is empty.

Functions

func ConfigMapManifest

func ConfigMapManifest(p schemas.StorefrontProfile) (map[string]any, error)

ConfigMapManifest returns a kubectl-applyable ConfigMap for the profile.

func DescribeLogoURL

func DescribeLogoURL(raw string) string

DescribeLogoURL returns a terminal-friendly rendering of a logo URL: inline data: URIs are summarised (mime + decoded size) instead of dumping the base64 payload; everything else passes through unchanged.

func InlineLogoFromFile

func InlineLogoFromFile(path string) (string, error)

InlineLogoFromFile reads a local image file and returns it as a data:image/...;base64 URI suitable for StorefrontProfile.LogoURL. Inline logos are self-contained — immune to CORS, hotlink protection, and dead hosts — but must fit the ConfigMap budget (maxInlineLogoBytes).

func IsDefaultLogoURL

func IsDefaultLogoURL(raw string) bool

IsDefaultLogoURL reports whether url is the stack default wordmark (relative or absolute).

func MarshalProfile

func MarshalProfile(p schemas.StorefrontProfile) (string, error)

MarshalProfile serialises a profile for ConfigMap storage.

func MergeProfile

func MergeProfile(base, patch schemas.StorefrontProfile) schemas.StorefrontProfile

MergeProfile overlays non-empty patch fields onto base.

func ParseProfile

func ParseProfile(raw string) (*schemas.StorefrontProfile, error)

ParseProfile decodes profile JSON from a ConfigMap data key.

func ProfileLocalPath

func ProfileLocalPath(cfg *config.Config) string

ProfileLocalPath is the host-side record of the operator profile.

func ReconcileRecorded

func ReconcileRecorded(cfg *config.Config, u *ui.UI)

ReconcileRecorded re-applies the operator's recorded storefront branding into the cluster during `obol stack up`.

`obol sell info set` writes the profile to both the x402/obol-storefront-profile ConfigMap (etcd, destroyed by `obol stack down`) and a host-side record at $CONFIG_DIR/storefront/profile.json (survives cluster recreation). Without this replay a fresh `stack up` would come back with the branding on disk but no matching ConfigMap, so the controller would publish the default catalog envelope.

The host file is the source of truth. No record on disk => nothing to do. Best-effort: a failure warns but never blocks stack-up.

func ResolvePublished

func ResolvePublished(explicit *schemas.StorefrontProfile, baseURL string) schemas.StorefrontProfile

ResolvePublished merges an operator-set profile over stack defaults.

func ValidateContactEmail

func ValidateContactEmail(raw string) error

ValidateContactEmail accepts a bare operator contact address for OpenAPI info.contact.email (required by x402scan discovery audits).

func ValidateLogoURL

func ValidateLogoURL(raw string) error

ValidateLogoURL accepts absolute http(s) URLs, site-relative paths, or inline data:image/...;base64 URIs (self-contained — immune to CORS, hotlink protection, and dead hosts).

Types

type LogoPreflight

type LogoPreflight struct {
	// LoadFailure is true when the image could not be fetched at all
	// (network error, HTTP error status, or a non-image response) — the
	// logo will be broken everywhere, not just for strict consumers.
	LoadFailure bool
	// Warnings are human-readable problems found by the probe.
	Warnings []string
}

LogoPreflight is the result of probing a logo URL the way a browser would load it.

func PreflightLogoURL

func PreflightLogoURL(ctx context.Context, rawURL string) LogoPreflight

PreflightLogoURL fetches an absolute logo URL and checks the properties browsers and catalog consumers depend on: reachability, an image content-type, permissive CORS (for fetch()/canvas-based consumers), https (mixed content on https storefront pages), and size. Problems come back as Warnings rather than an error so the caller can decide whether to proceed. Empty and data: URIs are self-contained and probe as OK.

func (LogoPreflight) OK

func (p LogoPreflight) OK() bool

OK reports whether the probe found no problems.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL