Bump
This commit is contained in:
parent
11fb233d11
commit
da3c29209f
|
@ -3,7 +3,7 @@ FROM golang:alpine
|
|||
EXPOSE 80/tcp
|
||||
|
||||
ENTRYPOINT ["gopherproxy"]
|
||||
CMD []
|
||||
CMD ["-bind", "0.0.0.0:80", "-uri", "floodgap.com"]
|
||||
|
||||
RUN \
|
||||
apk add --update git && \
|
||||
|
|
|
@ -23,9 +23,16 @@ type tplRow struct {
|
|||
type Handler func(w http.ResponseWriter, req *http.Request)
|
||||
|
||||
func renderDirectory(w http.ResponseWriter, tpl *template.Template, hostport string, d gopher.Directory) error {
|
||||
out := make([]tplRow, len(d))
|
||||
var title string
|
||||
|
||||
out := make([]tplRow, len(d.Items))
|
||||
|
||||
for i, x := range d.Items {
|
||||
if x.Type == gopher.INFO && x.Selector == "TITLE" {
|
||||
title = x.Description
|
||||
continue
|
||||
}
|
||||
|
||||
for i, x := range d {
|
||||
tr := tplRow{
|
||||
Text: x.Description,
|
||||
Type: x.Type.String(),
|
||||
|
@ -60,10 +67,14 @@ func renderDirectory(w http.ResponseWriter, tpl *template.Template, hostport str
|
|||
out[i] = tr
|
||||
}
|
||||
|
||||
if title == "" {
|
||||
title = hostport
|
||||
}
|
||||
|
||||
return tpl.Execute(w, struct {
|
||||
Title string
|
||||
Lines []tplRow
|
||||
}{hostport, out})
|
||||
}{title, out})
|
||||
}
|
||||
|
||||
// MakeGopherProxyHandler returns a Handler that proxies requests
|
||||
|
|
Loading…
Reference in New Issue