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,
|
"file": file,
|
||||||
"fullname": c.Params("user") + "/" + c.Params("repo"),
|
"fullname": c.Params("user") + "/" + c.Params("repo"),
|
||||||
"name": c.Params("file"),
|
"name": c.Params("file"),
|
||||||
|
"branch": c.Params("branch"),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
app.Get("/avatar/:id", func(c *fiber.Ctx) error {
|
app.Get("/avatar/:id", func(c *fiber.Ctx) error {
|
||||||
|
@ -135,6 +136,15 @@ func main() {
|
||||||
c.Response().Header.Del(fiber.HeaderServer)
|
c.Response().Header.Del(fiber.HeaderServer)
|
||||||
return nil
|
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")
|
val, ok := os.LookupEnv("GOTHUB_PORT")
|
||||||
if !ok {
|
if !ok {
|
||||||
val = "3000"
|
val = "3000"
|
||||||
|
|
|
@ -192,6 +192,7 @@ a:hover {
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<pre class="filePre">{{ .file}}</pre>
|
<pre class="filePre">{{ .file}}</pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="downloadParent">
|
<div class="downloadParent">
|
||||||
<a href="/raw/{{.fullname}}/{{.name}}" class="downloadButton">Download</a>
|
<a href="/raw/{{.fullname}}/{{.branch}}/{{.name}}" class="downloadButton">Download</a>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</main>
|
</main>
|
|
@ -32,7 +32,7 @@
|
||||||
<ul class="filesUList">
|
<ul class="filesUList">
|
||||||
{{ range $key, $value := .files}}
|
{{ range $key, $value := .files}}
|
||||||
{{ if eq .Type "dir" }}
|
{{ 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 }}
|
{{ else }}
|
||||||
<li class="filesList"><a href="/file/{{.Fullname}}/{{.DefaultBranch}}/{{.Path}}">{{.Path}}</a></li>
|
<li class="filesList"><a href="/file/{{.Fullname}}/{{.DefaultBranch}}/{{.Path}}">{{.Path}}</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
読み込み中…
新しいイシューから参照