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
- func InitBrandingKit(dir string, embeddedFS embed.FS, style BrandingStyle) error
- type AppConfig
- type AssetsConfig
- type BrandingStyle
- type CSSConfig
- type Config
- type Manager
- func (m *Manager) AppName() string
- func (m *Manager) ClearCache()
- func (m *Manager) Config() Config
- func (m *Manager) Dir() string
- func (m *Manager) GetAsset(name string) ([]byte, string, bool)
- func (m *Manager) GetAssetPath(name string) (string, bool)
- func (m *Manager) GetCustomCSS() ([]byte, error)
- func (m *Manager) GetManifest(originalManifest []byte) ([]byte, error)
- func (m *Manager) HasCustomCSS() bool
- func (m *Manager) ModifyIndexHTML(original []byte) ([]byte, error)
- func (m *Manager) NIP11Config() NIP11Config
- type ManifestConfig
- type NIP11Config
Constants ¶
const CSSTemplate = `` /* 6491-byte string literal not displayed */
CSSTemplate is the full CSS template with all variables and documentation
const CSSVariablesTemplate = `` /* 2251-byte string literal not displayed */
CSSVariablesTemplate contains only CSS variable definitions
const GenericCSSTemplate = `` /* 7154-byte string literal not displayed */
GenericCSSTemplate is the CSS template for generic/white-label branding
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 {
Logo string `json:"logo"` // Header logo image (replaces orly.png)
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 (*Manager) ClearCache ¶
func (m *Manager) ClearCache()
ClearCache clears all cached assets (useful for hot-reload during development)
func (*Manager) GetAsset ¶
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 ¶
GetAssetPath returns the full filesystem path for a custom asset
func (*Manager) GetCustomCSS ¶
GetCustomCSS returns the combined custom CSS content
func (*Manager) GetManifest ¶
GetManifest generates a customized manifest.json
func (*Manager) HasCustomCSS ¶
HasCustomCSS returns true if custom CSS is available
func (*Manager) ModifyIndexHTML ¶
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