1
0
mirror of https://github.com/juanfont/headscale.git synced 2025-11-10 01:20:58 +01:00

Added favicon handler to serve favicon.png

This commit is contained in:
TeejMcSteez 2025-10-31 02:59:57 -04:00
parent 0a43aab8f5
commit a594f9be98

View File

@ -1,6 +1,8 @@
package hscontrol package hscontrol
import ( import (
"bytes"
_ "embed"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
@ -8,6 +10,7 @@ import (
"net/http" "net/http"
"strconv" "strconv"
"strings" "strings"
"time"
"github.com/chasefleming/elem-go/styles" "github.com/chasefleming/elem-go/styles"
"github.com/gorilla/mux" "github.com/gorilla/mux"
@ -268,3 +271,10 @@ func (a *AuthProviderWeb) RegisterHandler(
writer.WriteHeader(http.StatusOK) writer.WriteHeader(http.StatusOK)
writer.Write([]byte(templates.RegisterWeb(registrationId).Render())) writer.Write([]byte(templates.RegisterWeb(registrationId).Render()))
} }
//go:embed assets/favicon.png
var favicon[] byte
func FaviconHandler(writer http.ResponseWriter, req *http.Request) {
writer.Header().Set("Content-Type", "image/x-icon")
http.ServeContent(writer, req, "favicon.ico", time.Unix(0, 0), bytes.NewReader(favicon))
}