Rohan Verma



Commit Diff


commit - 0e598bf53d52445de4fdf56f076763573947a91e
commit + 0e66fa10efa458237250b10f12467c49104e30dc
blob - 9358b57d14e3d7cfd2aebe0516ad0c6f62ee39bb
blob + e9d1da12f19339f89a364299cb8ebe2152dde288
--- main.go
+++ main.go
@@ -23,6 +23,9 @@ const (
 //go:embed index.html
 var indexHTML string
 
+//go:embed favicon.ico
+var favicon []byte
+
 type (
 	Link    struct{ Title, URL string }
 	WebRes  struct{ Title, URL, Desc string; Sub []Link }
@@ -307,6 +310,12 @@ func main() {
 	go func() { for range time.Tick(30 * time.Minute) { ramMu.Lock(); clear(ram); ramMu.Unlock() } }()
 
 	port := env("PORT", "11081")
+
+	http.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {
+		w.Header().Set("Content-Type", "image/x-icon")
+		w.Write(favicon)
+	})
+
 	http.HandleFunc("/", home)
 	http.HandleFunc("/search", search)
 	os.Stderr.WriteString(":" + port + " cache=" + cdir + "\n")