git-preview @ main

static git web frontend but with images and html previews + code truncation

routes: split repo index and files views
Sun, 11 Dec 2022
2 files changed, 48 insertions(+), 4 deletions(-)
M routes/handler.go

@@ -8,7 +8,7 @@

func Handlers(c *config.Config) *flow.Mux { mux := flow.New() d := deps{c} - mux.HandleFunc("/:name", d.Repo, "GET") - mux.HandleFunc("/:name/tree/...", d.Repo, "GET") + mux.HandleFunc("/:name", d.RepoIndex, "GET") + mux.HandleFunc("/:name/tree/:ref/...", d.RepoFiles, "GET") return mux }
M routes/routes.go

@@ -8,6 +8,7 @@ "path/filepath"

"github.com/alexedwards/flow" gogit "github.com/go-git/go-git/v5" + "github.com/go-git/go-git/v5/plumbing" "icyphox.sh/legit/config" "icyphox.sh/legit/git" )

@@ -16,9 +17,39 @@ type deps struct {

c *config.Config }

… preview truncated