added favicon
docker / docker (push) Successful in 2m6s

This commit is contained in:
tchivert authored and tom.chivert committed 2024-12-26 19:02:16 +01:00
1 parent 1aa710e712
commit d4f257b71a
3 files changed
+7 -5

No files matched your search

+1
View File
@@ -15,6 +15,7 @@ FROM alpine:latest
WORKDIR /app
COPY --from=build /build/iplookup ./
COPY template.html ./
COPY favicon.png ./
EXPOSE 8080
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

+6 -5
View File
@@ -420,11 +420,6 @@ func handler(w http.ResponseWriter, r *http.Request) {
fmt.Println("Request:", r)
}
if r.URL.Path == "/favicon.ico" {
http.Error(w, "Not found", http.StatusNotFound)
return
}
if r.Method != "GET" {
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
return
@@ -465,6 +460,12 @@ func handler(w http.ResponseWriter, r *http.Request) {
}
}
if r.URL.Path == "/favicon.ico" {
w.Header().Set("Content-Type", "image/png")
http.ServeFile(w, r, "favicon.png")
return
}
args := strings.Split(r.URL.Path, "/")
if len(args) > 1 && args[1] != "" {
rtype := reqtype(args[1])