diff options
author | Runxi Yu <me@runxiyu.org> | 2025-04-06 01:55:21 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-04-06 02:08:58 +0800 |
commit | faa5ca8fab23176d390e9522f1485d467851545b (patch) | |
tree | d3b1d081e0ea5e7f71a94dc1d301e2540a8abcc8 /http_handle_index.go | |
parent | Slight refactor on NewServer (diff) | |
download | forge-faa5ca8fab23176d390e9522f1485d467851545b.tar.gz forge-faa5ca8fab23176d390e9522f1485d467851545b.tar.zst forge-faa5ca8fab23176d390e9522f1485d467851545b.zip |
Move stuff into internal/unsortedv0.1.28
Diffstat (limited to 'http_handle_index.go')
-rw-r--r-- | http_handle_index.go | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/http_handle_index.go b/http_handle_index.go deleted file mode 100644 index c1efd98..0000000 --- a/http_handle_index.go +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-License-Identifier: AGPL-3.0-only -// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org> - -package forge - -import ( - "net/http" - "runtime" - - "github.com/dustin/go-humanize" - "go.lindenii.runxiyu.org/forge/internal/web" -) - -// httpHandleIndex provides the main index page which includes a list of groups -// and some global information such as SSH keys. -func (s *Server) httpHandleIndex(writer http.ResponseWriter, request *http.Request, params map[string]any) { - var err error - var groups []nameDesc - - groups, err = s.queryNameDesc(request.Context(), "SELECT name, COALESCE(description, '') FROM groups WHERE parent_group IS NULL") - if err != nil { - web.ErrorPage500(s.templates, writer, params, "Error querying groups: "+err.Error()) - return - } - params["groups"] = groups - - // Memory currently allocated - memstats := runtime.MemStats{} //exhaustruct:ignore - runtime.ReadMemStats(&memstats) - params["mem"] = humanize.IBytes(memstats.Alloc) - s.renderTemplate(writer, "index", params) -} |