Skip to content

Commit

Permalink
Update favicon to new logo from bb-storage
Browse files Browse the repository at this point in the history
  • Loading branch information
moroten committed Oct 20, 2023
1 parent daafd4f commit 373c221
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion cmd/bb_browser/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ load("@io_bazel_rules_docker//go:image.bzl", "go_image")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@npm//:purgecss/package_json.bzl", purgecss_bin = "bin")

genrule(
name = "favicon",
srcs = ["@com_github_buildbarn_bb_storage//:buildbarn_logo_svg"],
outs = ["favicon.svg"],
cmd = "tr -d '\n' < $(location //:buildbarn_logo_svg) | sed -e 's/ content=\"[^\"]*\"//' -e 's/<!--[^!]*-->//g' > $@",
)

go_library(
name = "bb_browser_lib",
srcs = [
"browser_service.go",
"main.go",
],
embedsrcs = [
"favicon.png",
":favicon",
"stylesheet.css",
"templates/error.html",
"templates/footer.html",
Expand Down
Binary file removed cmd/bb_browser/favicon.png
Binary file not shown.
4 changes: 2 additions & 2 deletions cmd/bb_browser/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var (
templatesFS embed.FS
//go:embed stylesheet.css
stylesheet template.CSS
//go:embed favicon.png
//go:embed favicon.svg
favicon []byte
)

Expand Down Expand Up @@ -130,7 +130,7 @@ func main() {
routePrefix += "/"
}

faviconURL := template.URL("data:image/png;base64," + base64.StdEncoding.EncodeToString(favicon))
faviconURL := template.URL("data:image/svg+xml;base64," + base64.StdEncoding.EncodeToString(favicon))
templates, err := template.New("templates").Funcs(template.FuncMap{
"basename": path.Base,
"favicon_url": func() template.URL { return faviconURL },
Expand Down

0 comments on commit 373c221

Please sign in to comment.