branding

package
v0.58.13 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: Unlicense Imports: 16 Imported by: 0

Documentation

Overview

Package branding provides white-label customization for the ORLY relay web UI. It allows relay operators to customize the appearance, branding, and theme without rebuilding the application.

Index

Constants

View Source
const CSSTemplate = `` /* 6491-byte string literal not displayed */

CSSTemplate is the full CSS template with all variables and documentation

View Source
const CSSVariablesTemplate = `` /* 2251-byte string literal not displayed */

CSSVariablesTemplate contains only CSS variable definitions

View Source
const GenericCSSTemplate = `` /* 7154-byte string literal not displayed */

GenericCSSTemplate is the CSS template for generic/white-label branding

View Source
const GenericCSSVariablesTemplate = `` /* 2405-byte string literal not displayed */

GenericCSSVariablesTemplate contains CSS variables for generic/white-label branding

Variables

This section is empty.

Functions

func InitBrandingKit

func InitBrandingKit(dir string, embeddedFS embed.FS, style BrandingStyle) error

InitBrandingKit creates a branding directory with assets and configuration

Types

type AppConfig

type AppConfig struct {
	Name        string `json:"name"`        // Display name (e.g., "My Relay")
	ShortName   string `json:"shortName"`   // Short name for PWA (e.g., "Relay")
	Title       string `json:"title"`       // Browser tab title (e.g., "My Relay Dashboard")
	Description string `json:"description"` // Brief description
}

AppConfig contains application-level branding settings

type AssetsConfig

type AssetsConfig struct {
	Favicon string `json:"favicon"` // Browser favicon
	Icon192 string `json:"icon192"` // PWA icon 192x192
	Icon512 string `json:"icon512"` // PWA icon 512x512
}

AssetsConfig contains paths to custom asset files (relative to branding directory)

type BrandingStyle

type BrandingStyle string

BrandingStyle represents the type of branding kit to generate

const (
	StyleORLY    BrandingStyle = "orly"    // ORLY-branded assets
	StyleGeneric BrandingStyle = "generic" // Generic/white-label assets
)

type CSSConfig

type CSSConfig struct {
	CustomCSS    string `json:"customCSS"`    // Full CSS override file
	VariablesCSS string `json:"variablesCSS"` // CSS variables override file (optional)
}

CSSConfig contains paths to custom CSS files (relative to branding directory)

type Config

type Config struct {
	Version  int            `json:"version"`
	App      AppConfig      `json:"app"`
	NIP11    NIP11Config    `json:"nip11"`
	Manifest ManifestConfig `json:"manifest"`
	Assets   AssetsConfig   `json:"assets"`
	CSS      CSSConfig      `json:"css"`
}

Config is the main configuration structure loaded from branding.json

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a default configuration with example values

func GenericConfig

func GenericConfig() Config

GenericConfig returns a generic/white-label configuration

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles loading and serving custom branding assets

func New

func New(dir string) (*Manager, error)

New creates a new branding Manager by loading configuration from the specified directory

func (*Manager) AppName

func (m *Manager) AppName() string

AppName returns the custom app name, or empty string if not set

func (*Manager) ClearCache

func (m *Manager) ClearCache()

ClearCache clears all cached assets (useful for hot-reload during development)

func (*Manager) Config

func (m *Manager) Config() Config

Config returns the loaded branding configuration

func (*Manager) Dir

func (m *Manager) Dir() string

Dir returns the branding directory path

func (*Manager) GetAsset

func (m *Manager) GetAsset(name string) ([]byte, string, bool)

GetAsset returns a custom asset by name with its MIME type Returns the asset data, MIME type, and whether it was found

func (*Manager) GetAssetPath

func (m *Manager) GetAssetPath(name string) (string, bool)

GetAssetPath returns the full filesystem path for a custom asset

func (*Manager) GetCustomCSS

func (m *Manager) GetCustomCSS() ([]byte, error)

GetCustomCSS returns the combined custom CSS content

func (*Manager) GetManifest

func (m *Manager) GetManifest(originalManifest []byte) ([]byte, error)

GetManifest generates a customized manifest.json

func (*Manager) HasCustomCSS

func (m *Manager) HasCustomCSS() bool

HasCustomCSS returns true if custom CSS is available

func (*Manager) ModifyIndexHTML

func (m *Manager) ModifyIndexHTML(original []byte) ([]byte, error)

ModifyIndexHTML modifies the index.html to inject custom branding

func (*Manager) NIP11Config

func (m *Manager) NIP11Config() NIP11Config

NIP11Config returns the NIP-11 branding configuration

type ManifestConfig

type ManifestConfig struct {
	ThemeColor      string `json:"themeColor"`      // Theme color (e.g., "#1a1a2e")
	BackgroundColor string `json:"backgroundColor"` // Background color (e.g., "#16213e")
}

ManifestConfig contains PWA manifest customization

type NIP11Config

type NIP11Config struct {
	Name        string `json:"name"`        // Relay name in NIP-11 response
	Description string `json:"description"` // Relay description in NIP-11 response
	Icon        string `json:"icon"`        // Icon URL for NIP-11 response
}

NIP11Config contains settings for the NIP-11 relay information document

Jump to

Keyboard shortcuts

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