diff --git a/controllers/home.ctrl.go b/controllers/home.ctrl.go index c68bac4..5c94dfd 100644 --- a/controllers/home.ctrl.go +++ b/controllers/home.ctrl.go @@ -40,6 +40,7 @@ type HomepageContent struct { BlockHeight int Uris []string Channels []Channel + Branding service.BrandingConfig } type Channel struct { @@ -111,6 +112,7 @@ func (controller *HomeController) Home(c echo.Context) error { BlockHeight: int(info.BlockHeight), Channels: channelSlice, Uris: info.Uris, + Branding: controller.svc.Config.Branding, } var buf bytes.Buffer err = tmpl.Execute(&buf, content) diff --git a/lib/service/config.go b/lib/service/config.go index 9fdbb5a..88774f1 100644 --- a/lib/service/config.go +++ b/lib/service/config.go @@ -1,5 +1,10 @@ package service +import ( + "fmt" + "strings" +) + type Config struct { DatabaseUri string `envconfig:"DATABASE_URI" required:"true"` SentryDSN string `envconfig:"SENTRY_DSN"` @@ -24,4 +29,32 @@ type Config struct { MaxReceiveAmount int64 `envconfig:"MAX_RECEIVE_AMOUNT" default:"0"` MaxSendAmount int64 `envconfig:"MAX_SEND_AMOUNT" default:"0"` MaxAccountBalance int64 `envconfig:"MAX_ACCOUNT_BALANCE" default:"0"` + Branding BrandingConfig +} + +type BrandingConfig struct { + Title string `envconfig:"BRANDING_TITLE" default:"LndHub.go - Alby Lightning"` + Desc string `envconfig:"BRANDING_DESC" default:"Alby server for the Lightning Network"` + Url string `envconfig:"BRANDING_URL" default:"https://ln.getalby.com"` + Logo string `envconfig:"BRANDING_LOGO" default:"/static/img/alby.svg"` + Favicon string `envconfig:"BRANDING_FAVICON" default:"/static/img/favicon.png"` + Footer FooterLinkMap `envconfig:"BRANDING_FOOTER" default:"about=https://getalby.com;community=https://t.me/getAlby"` +} + +// envconfig map decoder uses colon (:) as the default separator +// we have to override the decoder so we can use colon for the protocol prefix (e.g. "https:") + +type FooterLinkMap map[string]string + +func (flm *FooterLinkMap) Decode(value string) error { + m := map[string]string{} + for _, pair := range strings.Split(value, ";") { + kvpair := strings.Split(pair, "=") + if len(kvpair) != 2 { + return fmt.Errorf("invalid map item: %q", pair) + } + m[kvpair[0]] = kvpair[1] + } + *flm = m + return nil } diff --git a/static/css/style.css b/static/css/style.css index 4ed49e7..a99beb2 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -107,7 +107,6 @@ body { top: 24px; right: 24px; } - #progressbar { appearance: none; margin: 0; @@ -186,6 +185,9 @@ footer a { body { padding-right: 300px; } + .logo { + width: 200px; + } .sidebar { position: fixed; top: 0; @@ -249,5 +251,3 @@ footer a { } } - - diff --git a/static/img/alby.svg b/static/img/alby.svg new file mode 100644 index 0000000..60d1e61 --- /dev/null +++ b/static/img/alby.svg @@ -0,0 +1,22 @@ + diff --git a/templates/index.html b/templates/index.html index bae82a9..3be3cb8 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6,39 +6,18 @@ @charset "UTF-8"; - - - + + + - -