fixed cache server

This commit is contained in:
ston1th 2022-03-23 22:02:35 +01:00
commit 550bc1ee2c
2 changed files with 4 additions and 4 deletions

View file

@ -63,7 +63,7 @@ func (cs *CacheServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h := w.Header()
if option == "v" {
h.Set(csp, videoCSP)
err = video.Execute(w, r.URL.Path)
err = video.Execute(w, data{Paths: dirContents{Base: r.URL.Path}})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
@ -94,7 +94,7 @@ func (cs *CacheServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.Set(csp, indexCSP)
w.WriteHeader(i.Status())
err = cache.Execute(w, paths)
err = cache.Execute(w, data{Paths: paths})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return

View file

@ -6,14 +6,14 @@
<td class="listoptions">[dir]</td>
</tr>
<tr class="spacer"><td colspan="2"></td></tr>
{{range $s := .Dirs -}}
{{range $s := .Paths.Dirs -}}
<tr class="listitem">
<td class="listpath"><a href="{{$s.URI}}">{{$s.Name}}</a></td>
<td class="listoptions">[dir]</td>
</tr>
<tr class="spacer"><td colspan="2"></td></tr>
{{end -}}
{{range $s := .Files -}}
{{range $s := .Paths.Files -}}
<tr class="listitem">
<td class="listpath"><a id="{{$s.Anchor}}" href="{{$s.URI}}">{{$s.Name}}</a></td>
<td class="listoptions">