git-preview @ main

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

routes: file content view
Sun, 11 Dec 2022
4 files changed, 70 insertions(+), 18 deletions(-)
M routes/handler.go

@@ -9,6 +9,7 @@ func Handlers(c *config.Config) *flow.Mux {

mux := flow.New() d := deps{c} mux.HandleFunc("/:name", d.RepoIndex, "GET") - mux.HandleFunc("/:name/tree/:ref/...", d.RepoFiles, "GET") + mux.HandleFunc("/:name/tree/:ref/...", d.RepoTree, "GET") + mux.HandleFunc("/:name/blob/:ref/...", d.FileContent, "GET") return mux }
M routes/routes.go

@@ -1,7 +1,6 @@

package routes import ( - "html/template" "log" "net/http" "path/filepath"

@@ -42,11 +41,11 @@ log.Println(err)

return }

… preview truncated

M routes/template.go

@@ -2,11 +2,12 @@ package routes

import ( "html/template" + "log" "net/http" - "os" "path/filepath" "icyphox.sh/legit/config" + "icyphox.sh/legit/git"

… preview truncated

… and 1 more changed files not shown in this preview