routes: Add handler to generate tar gz file
Sun, 23 Jun 2024
3 files changed,
68 insertions(+),
0 deletions(-)
M
routes/handler.go
@@ -39,6 +39,7 @@ mux.HandleFunc("POST /{name}", d.Multiplex)
mux.HandleFunc("GET /{name}/tree/{ref}/{rest...}", d.RepoTree) mux.HandleFunc("GET /{name}/blob/{ref}/{rest...}", d.FileContent) mux.HandleFunc("GET /{name}/log/{ref}", d.Log) + mux.HandleFunc("GET /{name}/archive/{file}", d.Archive) mux.HandleFunc("GET /{name}/commit/{ref}", d.Diff) mux.HandleFunc("GET /{name}/refs/{$}", d.Refs) mux.HandleFunc("GET /{name}/{rest...}", d.Multiplex)
M
routes/routes.go
@@ -1,6 +1,7 @@
package routes import ( + "compress/gzip" "fmt" "html/template" "log"@@ -9,6 +10,7 @@ "os"
"path/filepath" "sort" "strconv"
… preview truncated
M
routes/util.go
@@ -3,6 +3,7 @@
import ( "io/fs" "log" + "net/http" "os" "path/filepath" "strings"@@ -88,3 +89,16 @@
func (d *deps) category(path string) string { return strings.TrimPrefix(filepath.Dir(strings.TrimPrefix(path, d.c.Repo.ScanPath)), string(os.PathSeparator)) }
… preview truncated