Changes
3 changed files (+19/-2)
-
-
@@ -8,6 +8,7 @@ "net/http""os" "path/filepath" "sort" "strconv" "time" "git.icyphox.sh/legit/config"
-
@@ -199,6 +200,11 @@ return} func (d *deps) FileContent(w http.ResponseWriter, r *http.Request) { var raw bool if rawParam, err := strconv.ParseBool(r.URL.Query().Get("raw")); err == nil { raw = rawParam } name := flow.Param(r.Context(), "name") if d.isIgnored(name) { d.Write404(w)
-
@@ -222,7 +228,11 @@ data["ref"] = refdata["desc"] = getDescription(path) data["path"] = treePath d.showFile(contents, data, w) if raw { d.showRaw(contents, w) } else { d.showFile(contents, data, w) } return }
-
-
-
@@ -95,3 +95,10 @@ log.Println(err)return } } func (d *deps) showRaw(content string, w http.ResponseWriter) { w.WriteHeader(http.StatusOK) w.Header().Set("Content-Type", "text/plain") w.Write([]byte(content)) return }
-
-
-
@@ -5,7 +5,7 @@ {{ template "repoheader" . }}<body> {{ template "nav" . }} <main> <p>{{ .path }}</p> <p>{{ .path }} (<a style="color: gray" href="?raw=true">view raw</a>)</p> <div class="file-wrapper"> <table > <tbody><tr>
-