add diff file download

This commit is contained in:
Arya Kiran
2023-07-23 13:16:39 +05:30
parent 8fddeca8b4
commit 4dddeae12d
2 changed files with 10 additions and 1 deletions
+9
View File
@@ -140,6 +140,15 @@ func Serve(port string) {
})
app.Get("/:user/:repo", pages.HandleRepo)
app.Get("/:user/:repo/commit/:commit", pages.HandleCommit)
app.Get("/diff/:user/:repo/commit/:commit", func(c *fiber.Ctx) error {
if proxying == "true" {
utils.ProxyRequest(c, "https://github.com/"+c.Params("user")+"/"+c.Params("repo")+"/commit/"+c.Params("commit")+".diff")
return nil
} else {
c.Redirect("https://github.com/" + c.Params("user") + "/" + c.Params("repo") + "/commit/" + c.Params("commit") + ".diff")
return nil
}
})
app.Get("/:user/:repo/info/+", func(c *fiber.Ctx) error {
// This is needed but it looks like git doesn't send it. Or maybe i just shouldn't program at midnight
param := "?service=git-upload-pack"
+1 -1
View File
@@ -19,7 +19,7 @@
<div class="user-container">
<h3>{{.CommitHashShortened}} | {{.CommitName}}</h3>
<a
href="/{{.FullName}}/{{.CommitHashShortened}}.diff"
href="/diff/{{.FullName}}/commit/{{.CommitHashShortened}}"
class="button secondary"
>Raw</a
>