Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to override branding #212

Merged
merged 1 commit into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions controllers/home.ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type HomepageContent struct {
BlockHeight int
Uris []string
Channels []Channel
Branding service.BrandingConfig
}

type Channel struct {
Expand Down Expand Up @@ -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)
Expand Down
33 changes: 33 additions & 0 deletions lib/service/config.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package service

import (
"fmt"
"strings"
)

type Config struct {
DatabaseUri string `envconfig:"DATABASE_URI" required:"true"`
SentryDSN string `envconfig:"SENTRY_DSN"`
Expand All @@ -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
}
6 changes: 3 additions & 3 deletions static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ body {
top: 24px;
right: 24px;
}

#progressbar {
appearance: none;
margin: 0;
Expand Down Expand Up @@ -186,6 +185,9 @@ footer a {
body {
padding-right: 300px;
}
.logo {
width: 200px;
}
.sidebar {
position: fixed;
top: 0;
Expand Down Expand Up @@ -249,5 +251,3 @@ footer a {
}

}


22 changes: 22 additions & 0 deletions static/img/alby.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading