chore: add favicon

This commit is contained in:
xuu 2023-11-09 11:42:33 -07:00
parent f71e50fbe6
commit 4a6dc34692
Signed by: xuu
GPG Key ID: 8B3B0604F164E04F
9 changed files with 46 additions and 0 deletions

39
app.favicon.go Normal file
View File

@ -0,0 +1,39 @@
package main
import (
"context"
"embed"
"io/fs"
"net/http"
"go.sour.is/pkg/lg"
"go.sour.is/pkg/service"
)
var _ = apps.Register(10, func(ctx context.Context, svc *service.Harness) error {
_, span := lg.Span(ctx)
defer span.End()
svc.Add(&favicon{})
return nil
})
//go:embed favicon/*
var faviconAsset embed.FS
type favicon struct{}
func (favicon) RegisterHTTP(mux *http.ServeMux) {
dir, _ := fs.Sub(faviconAsset, "favicon")
srv := http.FileServer(http.FS(dir))
mux.Handle("/favicon.ico", srv)
mux.Handle("/favicon.txt", srv)
mux.Handle("/favicon-16x16.png", srv)
mux.Handle("/favicon-32x32.png", srv)
mux.Handle("/android-chrome-192x192.png", srv)
mux.Handle("/android-chrome-512x512.png", srv)
mux.Handle("/apple-touch-icon.png", srv)
mux.Handle("/site.webmanifest", srv)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
favicon/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

BIN
favicon/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

BIN
favicon/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

6
favicon/favicon.txt Normal file
View File

@ -0,0 +1,6 @@
This favicon was generated using the following graphics from Twitter Twemoji:
- Graphics Title: 1f4cb.svg
- Graphics Author: Copyright 2020 Twitter, Inc and other contributors (https://github.com/twitter/twemoji)
- Graphics Source: https://github.com/twitter/twemoji/blob/master/assets/svg/1f4cb.svg
- Graphics License: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

1
favicon/site.webmanifest Normal file
View File

@ -0,0 +1 @@
{"name":"sour.is paste","short_name":"paste","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}