flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit 956b1c0bb51c994ab55113553b2263759907c0d7
parent a7148e306bb7236ba5af92add0f79c4d66e81c65
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Thu,  2 Dec 2021 20:27:33 -0800

Only list finger users

Diffstat:
Mfinger.go | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/finger.go b/finger.go @@ -18,11 +18,20 @@ func runFingerServer() { Handler: finger.HandlerFunc(func(ctx context.Context, w io.Writer, q *finger.Query) { log.Printf("finger request: %v", q) if q.Username == "" { + var hasPlan []string users, err := getActiveUserNames() + for _, user := range users { + plan := path.Join(c.FilesDirectory, user, ".plan") + _, err := os.Stat(plan) + if err != nil { + hasPlan = append(hasPlan, user) + } + } if err != nil { w.Write([]byte("Error\n")) } - w.Write([]byte(strings.Join(users, "\n"))) + w.Write([]byte("Finger users on this server:\n============================\n\n")) + w.Write([]byte(strings.Join(hasPlan, "\n"))) return } userName := cleanPath(q.Username)