Merge branch 'dev' of codeberg.org:gothub/gothub into dev
このコミットが含まれているのは:
コミット
2cecf472be
10
main.go
10
main.go
|
@ -115,6 +115,7 @@ func main() {
|
|||
"file": file,
|
||||
"fullname": c.Params("user") + "/" + c.Params("repo"),
|
||||
"name": c.Params("file"),
|
||||
"branch": c.Params("branch"),
|
||||
})
|
||||
})
|
||||
app.Get("/avatar/:id", func(c *fiber.Ctx) error {
|
||||
|
@ -135,6 +136,15 @@ func main() {
|
|||
c.Response().Header.Del(fiber.HeaderServer)
|
||||
return nil
|
||||
})
|
||||
app.Get("/raw/:user/:repo/:branch/:file", ratelimiter, func(c *fiber.Ctx) error {
|
||||
url := "https://raw.githubusercontent.com/" + c.Params("user") + "/" + c.Params("repo") + "/" + c.Params("branch") + "/" + c.Params("file")
|
||||
if err := proxy.Do(c, url); err != nil {
|
||||
return err
|
||||
}
|
||||
// Remove Server header from response
|
||||
c.Response().Header.Del(fiber.HeaderServer)
|
||||
return nil
|
||||
})
|
||||
val, ok := os.LookupEnv("GOTHUB_PORT")
|
||||
if !ok {
|
||||
val = "3000"
|
||||
|
|
|
@ -192,6 +192,7 @@ a:hover {
|
|||
color: var(--text);
|
||||
padding: 8px;
|
||||
border-radius: 8px;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<pre class="filePre">{{ .file}}</pre>
|
||||
</div>
|
||||
<div class="downloadParent">
|
||||
<a href="/raw/{{.fullname}}/{{.name}}" class="downloadButton">Download</a>
|
||||
<a href="/raw/{{.fullname}}/{{.branch}}/{{.name}}" class="downloadButton">Download</a>
|
||||
</div>
|
||||
{{end}}
|
||||
</main>
|
|
@ -32,7 +32,7 @@
|
|||
<ul class="filesUList">
|
||||
{{ range $key, $value := .files}}
|
||||
{{ if eq .Type "dir" }}
|
||||
<li class="filesList"><a href="/file/{{.Fullname}}/{{.DefaultBranch}}/{{.Path}}" class="filesA">{{.Path}} (directory)</a></li>
|
||||
<li class="filesList"><a href="#" class="filesA">{{.Path}} (directory)</a></li>
|
||||
{{ else }}
|
||||
<li class="filesList"><a href="/file/{{.Fullname}}/{{.DefaultBranch}}/{{.Path}}">{{.Path}}</a></li>
|
||||
{{ end }}
|
||||
|
|
読み込み中…
新しいイシューから参照