| 1 | package home |
| 2 | |
| 3 | import ( |
| 4 | "embed" |
| 5 | |
| 6 | "github.com/go-chi/chi/v5" |
| 7 | ) |
| 8 | |
| 9 | //go:embed static/brand |
| 10 | var brandFS embed.FS |
| 11 | |
| 12 | // Brand assets are public on both Home origins. The closed file list avoids |
| 13 | // exposing directory listings or treating a request path as a file name. |
| 14 | func mountBrand(r chi.Router) { |
| 15 | for name, contentType := range map[string]string{ |
| 16 | "icon.svg": "image/svg+xml", |
| 17 | "icon-32.png": "image/png", |
| 18 | "apple-touch-icon.png": "image/png", |
| 19 | "brand.css": "text/css; charset=utf-8", |
| 20 | "LICENSE.lucide": "text/plain; charset=utf-8", |
| 21 | "docs.svg": "image/svg+xml", |
| 22 | "sheets.svg": "image/svg+xml", |
| 23 | "slides.svg": "image/svg+xml", |
| 24 | "calendar.svg": "image/svg+xml", |
| 25 | "calls.svg": "image/svg+xml", |
| 26 | "memoria.svg": "image/svg+xml", |
| 27 | "fichas.svg": "image/svg+xml", |
| 28 | "mail.svg": "image/svg+xml", |
| 29 | "files.svg": "image/svg+xml", |
| 30 | } { |
| 31 | body, err := brandFS.ReadFile("static/brand/" + name) |
| 32 | if err != nil { |
| 33 | panic(err) // A missing embedded release asset is a build error. |
| 34 | } |
| 35 | versionAsset("/static/brand/"+name, body) |
| 36 | r.Get("/static/brand/"+name, serveAsset(body, contentType)) |
| 37 | } |
| 38 | } |
| 39 | |