From a6013bfefe2d41315c7ea286bb0fe25532c62ee6 Mon Sep 17 00:00:00 2001 From: selfhst-bot Date: Tue, 10 Mar 2026 05:37:12 -0400 Subject: [PATCH] v4.0.2 (Custom icon fix, root path info) --- CHANGELOG.md | 7 +++++++ build/VERSION | 2 +- build/main.go | 23 +++++++++++++++++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d41b572..66fd622c 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# v4.0.2 + +## What's Changed + +* Fixed custom icon issue where names converted to lowercase for cache keys were also being used to look up the file path, causing requests for icons with uppercase characters to fail ([#751](https://github.com/selfhst/icons/issues/751)) +* Added server name and sample endpoints to the root path ([#752](https://github.com/selfhst/icons/issues/752)) + # v4.0.1 ## What's Changed diff --git a/build/VERSION b/build/VERSION index cc868b62..4bac418e 100755 --- a/build/VERSION +++ b/build/VERSION @@ -1 +1 @@ -4.0.1 \ No newline at end of file +4.0.2 \ No newline at end of file diff --git a/build/main.go b/build/main.go index 8c32ae1a..87ccb1b4 100755 --- a/build/main.go +++ b/build/main.go @@ -558,7 +558,17 @@ func handleCustomIcon(w http.ResponseWriter, r *http.Request) { filename = strings.ToLower(filename) - customPath := filepath.Join(config.LocalPath, "custom", filename) + actualFilename := filename + if entries, err := os.ReadDir(filepath.Join(config.LocalPath, "custom")); err == nil { + for _, entry := range entries { + if strings.ToLower(entry.Name()) == filename { + actualFilename = entry.Name() + break + } + } + } + + customPath := filepath.Join(config.LocalPath, "custom", actualFilename) stat, err := os.Stat(customPath) if err != nil { @@ -633,6 +643,15 @@ func main() { mux := http.NewServeMux() + mux.HandleFunc("GET /", func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/" { + http.NotFound(w, r) + return + } + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + fmt.Fprintf(w, "selfh.st/icons\n\nEndpoints:\n GET /{iconname}\n GET /{iconname}/{colorcode}\n GET /custom/{filename}\n GET /health\n") + }) + mux.HandleFunc("GET /health", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) }) @@ -704,4 +723,4 @@ func main() { } log.Println("Server stopped. Bye for now!") -} +} \ No newline at end of file