Fixed favicon

This commit is contained in:
Pablu23
2024-02-26 19:17:17 +01:00
parent 8c5be57459
commit 87ec7aa1a8
5 changed files with 13 additions and 16 deletions

View File

@@ -3,6 +3,7 @@ package server
import (
"bytes"
"cmp"
_ "embed"
"fmt"
"golang.org/x/text/cases"
"golang.org/x/text/language"
@@ -198,6 +199,17 @@ func (s *Server) HandleImage(w http.ResponseWriter, r *http.Request) {
}
}
//go:embed favicon.ico
var ico []byte
func (s *Server) HandleFavicon(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "image/webp")
_, err := w.Write(ico)
if err != nil {
fmt.Println(err)
}
}
func (s *Server) HandleNext(w http.ResponseWriter, r *http.Request) {
fmt.Println("Received Next")

View File

@@ -43,8 +43,6 @@ func New(provider provider.Provider, db *database.Manager) *Server {
Mutex: &sync.Mutex{},
}
s.AddIco()
return &s
}
@@ -209,16 +207,6 @@ func (s *Server) AppendImagesToBuf(html string) ([]view.Image, error) {
return images, nil
}
//go:embed favicon.ico
var ico []byte
func (s *Server) AddIco() {
buf := bytes.NewBuffer(ico)
s.Mutex.Lock()
s.ImageBuffers["favicon.ico"] = buf
s.Mutex.Unlock()
}
func addFileToRam(url string) (*bytes.Buffer, error) {
// Get the data
resp, err := http.Get(url)

View File

@@ -4,8 +4,6 @@
<meta charset="UTF-8">
<title>Main Menu</title>
<link href="/img/favicon.ico" rel="icon" type="image/x-icon">
<style>
body {
padding: 25px;

View File

@@ -4,8 +4,6 @@
<meta charset="UTF-8">
<title>{{.Title}}</title>
<link href="/img/favicon.ico" rel="icon" type="image/x-icon">
<style>
body {background-color: #171717}