types.go raw
1 // Package branding provides white-label customization for the ORLY relay web UI.
2 // It allows relay operators to customize the appearance, branding, and theme
3 // without rebuilding the application.
4 package branding
5
6 // Config is the main configuration structure loaded from branding.json
7 type Config struct {
8 Version int `json:"version"`
9 App AppConfig `json:"app"`
10 NIP11 NIP11Config `json:"nip11"`
11 Manifest ManifestConfig `json:"manifest"`
12 Assets AssetsConfig `json:"assets"`
13 CSS CSSConfig `json:"css"`
14 }
15
16 // AppConfig contains application-level branding settings
17 type AppConfig struct {
18 Name string `json:"name"` // Display name (e.g., "My Relay")
19 ShortName string `json:"shortName"` // Short name for PWA (e.g., "Relay")
20 Title string `json:"title"` // Browser tab title (e.g., "My Relay Dashboard")
21 Description string `json:"description"` // Brief description
22 }
23
24 // NIP11Config contains settings for the NIP-11 relay information document
25 type NIP11Config struct {
26 Name string `json:"name"` // Relay name in NIP-11 response
27 Description string `json:"description"` // Relay description in NIP-11 response
28 Icon string `json:"icon"` // Icon URL for NIP-11 response
29 }
30
31 // ManifestConfig contains PWA manifest customization
32 type ManifestConfig struct {
33 ThemeColor string `json:"themeColor"` // Theme color (e.g., "#1a1a2e")
34 BackgroundColor string `json:"backgroundColor"` // Background color (e.g., "#16213e")
35 }
36
37 // AssetsConfig contains paths to custom asset files (relative to branding directory)
38 type AssetsConfig struct {
39 Logo string `json:"logo"` // Header logo image (replaces orly.png)
40 Favicon string `json:"favicon"` // Browser favicon
41 Icon192 string `json:"icon192"` // PWA icon 192x192
42 Icon512 string `json:"icon512"` // PWA icon 512x512
43 }
44
45 // CSSConfig contains paths to custom CSS files (relative to branding directory)
46 type CSSConfig struct {
47 CustomCSS string `json:"customCSS"` // Full CSS override file
48 VariablesCSS string `json:"variablesCSS"` // CSS variables override file (optional)
49 }
50
51 // DefaultConfig returns a default configuration with example values
52 func DefaultConfig() Config {
53 return Config{
54 Version: 1,
55 App: AppConfig{
56 Name: "My Relay",
57 ShortName: "Relay",
58 Title: "My Relay Dashboard",
59 Description: "A high-performance Nostr relay",
60 },
61 NIP11: NIP11Config{
62 Name: "My Relay",
63 Description: "Custom relay description",
64 Icon: "",
65 },
66 Manifest: ManifestConfig{
67 ThemeColor: "#000000",
68 BackgroundColor: "#000000",
69 },
70 Assets: AssetsConfig{
71 Logo: "assets/logo.png",
72 Favicon: "assets/favicon.png",
73 Icon192: "assets/icon-192.png",
74 Icon512: "assets/icon-512.png",
75 },
76 CSS: CSSConfig{
77 CustomCSS: "css/custom.css",
78 VariablesCSS: "css/variables.css",
79 },
80 }
81 }
82