diff --git a/app.favicon.go b/app.favicon.go new file mode 100644 index 0000000..961d6ed --- /dev/null +++ b/app.favicon.go @@ -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) +} diff --git a/favicon/android-chrome-192x192.png b/favicon/android-chrome-192x192.png new file mode 100644 index 0000000..16b457e Binary files /dev/null and b/favicon/android-chrome-192x192.png differ diff --git a/favicon/android-chrome-512x512.png b/favicon/android-chrome-512x512.png new file mode 100644 index 0000000..d701c0d Binary files /dev/null and b/favicon/android-chrome-512x512.png differ diff --git a/favicon/apple-touch-icon.png b/favicon/apple-touch-icon.png new file mode 100644 index 0000000..44b11b8 Binary files /dev/null and b/favicon/apple-touch-icon.png differ diff --git a/favicon/favicon-16x16.png b/favicon/favicon-16x16.png new file mode 100644 index 0000000..a64441e Binary files /dev/null and b/favicon/favicon-16x16.png differ diff --git a/favicon/favicon-32x32.png b/favicon/favicon-32x32.png new file mode 100644 index 0000000..c0261c0 Binary files /dev/null and b/favicon/favicon-32x32.png differ diff --git a/favicon/favicon.ico b/favicon/favicon.ico new file mode 100644 index 0000000..0a456a6 Binary files /dev/null and b/favicon/favicon.ico differ diff --git a/favicon/favicon.txt b/favicon/favicon.txt new file mode 100644 index 0000000..2c2e810 --- /dev/null +++ b/favicon/favicon.txt @@ -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/) diff --git a/favicon/site.webmanifest b/favicon/site.webmanifest new file mode 100644 index 0000000..32a7512 --- /dev/null +++ b/favicon/site.webmanifest @@ -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"} \ No newline at end of file