mirror of
https://codeberg.org/gothub/gothub
synced 2024-12-06 19:16:24 +01:00
add diff file download
This commit is contained in:
@@ -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
@@ -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
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user