Yōten: A social tracker for your language learning journey built on the atproto.

feat: add favicon

Signed-off-by: brookjeynes <me@brookjeynes.dev>

brookjeynes.dev 9f2b1a70 e9d30d4e

verified
+47
+2
internal/server/handlers/router.go
··· 44 44 r.Use(mw.LoadUnreadNotificationCount()) 45 45 46 46 r.Handle("/static/*", h.HandleStatic()) 47 + r.Get("/favicon.svg", h.HandleFavicon) 48 + r.Get("/favicon.ico", h.HandleFavicon) 47 49 48 50 r.Get("/", h.HandleIndexPage) 49 51 r.Get("/feed", h.HandleStudySessionFeed)
+14
internal/server/handlers/static.go
··· 5 5 "net/http" 6 6 "strings" 7 7 8 + "yoten.app/internal/server/views/partials" 8 9 "yoten.app/static" 9 10 ) 10 11 ··· 51 52 h.ServeHTTP(w, r) 52 53 }) 53 54 } 55 + 56 + func (h *Handler) HandleFavicon(w http.ResponseWriter, r *http.Request) { 57 + w.Header().Set("Content-Type", "image/svg+xml") 58 + w.Header().Set("Cache-Control", "public, max-age=31536000") // One year 59 + w.Header().Set("ETag", `"favicon-svg-v1"`) 60 + 61 + if match := r.Header.Get("If-None-Match"); match == `"favicon-svg-v1"` { 62 + w.WriteHeader(http.StatusNotModified) 63 + return 64 + } 65 + 66 + partials.Logo().Render(r.Context(), w) 67 + }
+31
internal/server/views/partials/logo.templ
··· 1 + package partials 2 + 3 + templ Logo() { 4 + <svg width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg"> 5 + <path 6 + d="M160 107.39C160 141.824 145.837 161.277 122.403 161.277C98.9686 161.277 71.9149 140.006 71.9149 105.573C71.9149 71.1399 77.4844 46.3196 100.919 46.3196C124.214 38.116 160 72.9573 160 107.39Z" 7 + fill="#F9FBF9" 8 + ></path> 9 + <circle cx="98.3957" cy="110.264" r="49.3079" fill="#A8DE9C"></circle> 10 + <rect x="81.3088" y="58.0269" width="17.5751" height="104.474" fill="#F9FBF9"></rect> 11 + <path 12 + d="M96.3814 99.0276L147.255 149.39L110.606 172.558L90.3659 167.161L60.7262 135.045L96.3814 99.0276Z" 13 + fill="#F9FBF9" 14 + ></path> 15 + <path 16 + d="M97.4468 113.215C97.4468 149.759 100.729 172.128 85.3191 172.128C69.9089 172.128 40 149.759 40 113.215C40 76.6708 54.6809 56.3327 70.0912 56.3327C90.8815 41.2416 97.4468 76.6708 97.4468 113.215Z" 17 + fill="#F9FBF9" 18 + ></path> 19 + <circle cx="98.8839" cy="109.776" r="62.6073" stroke="black" stroke-width="10"></circle> 20 + <rect x="73.1915" y="13.1915" width="51.0638" height="12.766" rx="2" fill="black"></rect> 21 + <rect 22 + x="98.6467" 23 + y="104.894" 24 + width="32.4789" 25 + height="6.60207" 26 + rx="3.30104" 27 + transform="rotate(44.7106 98.6467 104.894)" 28 + fill="black" 29 + ></rect> 30 + </svg> 31 + }