Merge branch 'dev' of codeberg.org:gothub/gothub into dev

このコミットが含まれているのは:
Midou36O 2022-11-30 18:50:28 +01:00
コミット 2cecf472be
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: 08063D5407090BC2
4個のファイルの変更13行の追加2行の削除

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 }}