diff options
author | Runxi Yu <me@runxiyu.org> | 2025-04-06 09:26:46 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-04-06 09:27:53 +0800 |
commit | da1d8f4e7c332c7109427915e6459b10209cedce (patch) | |
tree | 280b921be3b51f93d82d916b4eaa89387b7102cc /internal/unsorted/http_handle_repo_index.go | |
parent | git2c, git2d: Rename cmd1 and cmd2 descriptively (diff) | |
download | forge-da1d8f4e7c332c7109427915e6459b10209cedce.tar.gz forge-da1d8f4e7c332c7109427915e6459b10209cedce.tar.zst forge-da1d8f4e7c332c7109427915e6459b10209cedce.zip |
Move the Go stuff to ./forged/v0.1.32
Diffstat (limited to 'internal/unsorted/http_handle_repo_index.go')
-rw-r--r-- | internal/unsorted/http_handle_repo_index.go | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/internal/unsorted/http_handle_repo_index.go b/internal/unsorted/http_handle_repo_index.go deleted file mode 100644 index 03eed77..0000000 --- a/internal/unsorted/http_handle_repo_index.go +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: AGPL-3.0-only -// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org> - -package unsorted - -import ( - "net/http" - - "go.lindenii.runxiyu.org/forge/internal/git2c" - "go.lindenii.runxiyu.org/forge/internal/render" - "go.lindenii.runxiyu.org/forge/internal/web" -) - -// httpHandleRepoIndex provides the front page of a repo using git2d. -func (s *Server) httpHandleRepoIndex(w http.ResponseWriter, req *http.Request, params map[string]any) { - repoName := params["repo_name"].(string) - groupPath := params["group_path"].([]string) - - _, repoPath, _, _, _, _, _ := s.getRepoInfo(req.Context(), groupPath, repoName, "") // TODO: Don't use getRepoInfo - - client, err := git2c.NewClient(s.config.Git.Socket) - if err != nil { - web.ErrorPage500(s.templates, w, params, err.Error()) - return - } - defer client.Close() - - commits, readme, err := client.CmdIndex(repoPath) - if err != nil { - web.ErrorPage500(s.templates, w, params, err.Error()) - return - } - - params["commits"] = commits - params["readme_filename"] = readme.Filename - _, params["readme"] = render.Readme(readme.Content, readme.Filename) - - s.renderTemplate(w, "repo_index", params) - - // TODO: Caching -} |