MCPcopy Create free account
hub / github.com/aptly-dev/aptly / reposListInAPIMode

Function reposListInAPIMode

api/repos.go:28–42  ·  view source on GitHub ↗

@Summary Serve HTML Listing @Description If ServeInAPIMode is enabled in aptly config, @Description this endpoint is enabled which returns an HTML listing of each repo that can be browsed @Tags Repos @Produce html @Success 200 {object} string "HTML" @Router /repos [get]

(localRepos map[string]utils.FileSystemPublishRoot)

Source from the content-addressed store, hash-verified

26// @Success 200 {object} string "HTML"
27// @Router /repos [get]
28func reposListInAPIMode(localRepos map[string]utils.FileSystemPublishRoot) gin.HandlerFunc {
29 return func(c *gin.Context) {
30 c.Writer.Header().Set("Content-Type", "text/html; charset=utf-8")
31 c.Writer.Flush()
32 _, _ = c.Writer.WriteString("<pre>\n")
33 if len(localRepos) == 0 {
34 _, _ = c.Writer.WriteString("<a href=\"-/\">default</a>\n")
35 }
36 for publishPrefix := range localRepos {
37 _, _ = c.Writer.WriteString(fmt.Sprintf("<a href=\"%[1]s/\">%[1]s</a>\n", publishPrefix))
38 }
39 _, _ = c.Writer.WriteString("</pre>")
40 c.Writer.Flush()
41 }
42}
43
44// @Summary Serve Packages
45// @Description If ServeInAPIMode is enabled in aptly config,

Callers 1

RouterFunction · 0.85

Calls 3

WriteStringMethod · 0.80
FlushMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected