Update header, and fix raw from fileview.
Signed-off-by: Odyssey <odyssey346@disroot.org>
このコミットが含まれているのは:
コミット
0c6b23cde0
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>
|
読み込み中…
新しいイシューから参照