diff --git a/android-chrome-192x192.png b/android-chrome-192x192.png new file mode 100644 index 0000000..d573cf9 Binary files /dev/null and b/android-chrome-192x192.png differ diff --git a/android-chrome-512x512.png b/android-chrome-512x512.png new file mode 100644 index 0000000..3a1f63e Binary files /dev/null and b/android-chrome-512x512.png differ diff --git a/apple-touch-icon.png b/apple-touch-icon.png new file mode 100644 index 0000000..9e79132 Binary files /dev/null and b/apple-touch-icon.png differ diff --git a/favicon-16x16.png b/favicon-16x16.png new file mode 100644 index 0000000..be33ce1 Binary files /dev/null and b/favicon-16x16.png differ diff --git a/favicon-32x32.png b/favicon-32x32.png new file mode 100644 index 0000000..6f47410 Binary files /dev/null and b/favicon-32x32.png differ diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..4e16465 Binary files /dev/null and b/favicon.ico differ diff --git a/flake.nix b/flake.nix index da2410d..56e8623 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,7 @@ packages = rec { slenpaste = pkgs.buildGoModule { pname = "slenpaste"; - version = "0.2.0"; + version = "0.2.1"; src = ./.; goPackagePath = "github.com/slendidev/slenpaste"; vendorHash = "sha256-MUvodL6K71SCfxu51T/Ka2/w32Kz+IXem1bYqXQLSaU="; diff --git a/main.go b/main.go index 8877ff6..b361a48 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "embed" "encoding/json" "flag" "fmt" @@ -27,11 +28,19 @@ var ( useHTTPS bool ) +//go:embed android-chrome-192x192.png android-chrome-512x512.png apple-touch-icon.png favicon-16x16.png favicon-32x32.png favicon.ico site.webmanifest +var assetsFS embed.FS + type meta struct { Expiry time.Time `json:"expiry"` ExpireOnView bool `json:"expire_on_view"` } +func init() { + // Ensure correct types for webmanifest on some systems + _ = mime.AddExtensionType(".webmanifest", "application/manifest+json") +} + func getLimiter(ip string) *rate.Limiter { limMu.Lock() defer limMu.Unlock() @@ -68,7 +77,7 @@ func randomID(n int) string { } func indexHandler(w http.ResponseWriter, r *http.Request) { - w.Header().Add("Content-Type", "text/html") + w.Header().Add("Content-Type", "text/html; charset=utf-8") scheme := "http" if useHTTPS { scheme = "https" @@ -80,7 +89,17 @@ func indexHandler(w http.ResponseWriter, r *http.Request) { + slenpaste + + + + + + + + +