forked from tangled.org/core
this repo has no description

appview/pages: add favicon

based on lowercase IBM Plex Mono `t`, italic variant.

thanks to @t1c.dev!

Signed-off-by: oppiliappan <me@oppi.li>

oppi.li 811331c8 e807c571

verified
Changed files
+47 -1
appview
pages
templates
state
+4
appview/pages/pages.go
···
return p.executeOrReload(name, w, "layouts/repobase", params)
}
+
func (p *Pages) Favicon(w io.Writer) error {
+
return p.executePlain("favicon", w, nil)
+
}
+
type LoginParams struct {
}
+26
appview/pages/templates/favicon.html
···
+
{{ define "favicon" }}
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
+
<style>
+
.favicon-text {
+
fill: #000000;
+
stroke: none;
+
}
+
+
@media (prefers-color-scheme: dark) {
+
.favicon-text {
+
fill: #ffffff;
+
stroke: none;
+
}
+
}
+
</style>
+
+
<g style="display:inline">
+
<path d="M0-2.117h62.177v25.135H0z" style="display:inline;fill:none;fill-opacity:1;stroke-width:.396875" transform="translate(11.01 6.9)"/>
+
<path d="M3.64 22.787c-1.697 0-2.943-.45-3.74-1.35-.77-.9-1.156-2.094-1.156-3.585 0-.36.013-.72.038-1.08.052-.385.129-.873.232-1.464L.44 6.826h-5.089l.733-4.394h3.2c.822 0 1.439-.168 1.85-.502.437-.334.72-.938.848-1.812l.771-4.703h5.243L6.84 2.432h7.787l-.733 4.394H6.107L4.257 17.93l.77.27 6.015-4.742 2.775 3.161-2.313 2.005c-.822.694-1.568 1.31-2.236 1.85-.668.515-1.31.952-1.927 1.311a7.406 7.406 0 0 1-1.774.733c-.59.18-1.233.27-1.927.27z"
+
aria-label="tangled.sh"
+
class="favicon-text"
+
style="font-size:16.2278px;font-family:'IBM Plex Mono';-inkscape-font-specification:'IBM Plex Mono, Normal';display:inline;fill-opacity:1"
+
transform="translate(11.01 6.9)"/>
+
</g>
+
</svg>
+
{{ end }}
+1 -1
appview/pages/templates/layouts/topbar.html
···
<nav class="space-x-4 px-6 py-2 rounded bg-white dark:bg-gray-800 dark:text-white drop-shadow-sm">
<div class="flex justify-between p-0 items-center">
<div id="left-items">
-
<a href="/" hx-boost="true" class="flex gap-2 font-semibold italic">
+
<a href="/" hx-boost="true" class="flex gap-2 font-bold italic">
tangled<sub>alpha</sub>
</a>
</div>
+3
appview/state/router.go
···
s.pages,
)
+
router.Get("/favicon.svg", s.Favicon)
+
router.Get("/favicon.ico", s.Favicon)
+
router.HandleFunc("/*", func(w http.ResponseWriter, r *http.Request) {
pat := chi.URLParam(r, "*")
if strings.HasPrefix(pat, "did:") || strings.HasPrefix(pat, "@") {
+13
appview/state/state.go
···
return state, nil
}
+
func (s *State) Favicon(w http.ResponseWriter, r *http.Request) {
+
w.Header().Set("Content-Type", "image/svg+xml")
+
w.Header().Set("Cache-Control", "public, max-age=31536000") // one year
+
w.Header().Set("ETag", `"favicon-svg-v1"`)
+
+
if match := r.Header.Get("If-None-Match"); match == `"favicon-svg-v1"` {
+
w.WriteHeader(http.StatusNotModified)
+
return
+
}
+
+
s.pages.Favicon(w)
+
}
+
func (s *State) TermsOfService(w http.ResponseWriter, r *http.Request) {
user := s.oauth.GetUser(r)
s.pages.TermsOfService(w, pages.TermsOfServiceParams{