From 735bfd81223430b900d996b30c22b82b8e3a1146 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 30 Jun 2025 08:43:50 -0500 Subject: [PATCH] start /lookup --- Makefile | 2 ++ http.go | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Makefile b/Makefile index 1c1720f..4f6b3de 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,8 @@ install: prod: build make stop cp gowebd /usr/bin/gowebd + # allow the binary to open ports below 1024 + setcap 'cap_net_bind_service=+ep' /usr/bin/gowebd make start make log diff --git a/http.go b/http.go index 38e07cf..fbd9fc5 100644 --- a/http.go +++ b/http.go @@ -78,6 +78,20 @@ func okHandler(w http.ResponseWriter, r *http.Request) { return } + if route == "/lookup" { + w.Header().Set("Content-Type", "text") + fmt.Fprintf(w, "go.wit.com/apps/utils/gowebd Version: %s\n", argv.Version()) + fmt.Fprintf(w, "\n") + + all := forge.Repos.SortByFullPath() + for all.Scan() { + repo := all.Next() + + fmt.Fprintf(w, "Namespace=%s FullPath=%s %s\n", repo.Namespace, repo.FullPath) + } + return + } + if route == "/goReference.svg" { writeFile(w, "goReference.svg") return