added cache only access server

This commit is contained in:
ston1th 2022-03-22 21:48:59 +01:00
commit b5ae5504a7
6 changed files with 217 additions and 8 deletions

View file

@ -91,7 +91,7 @@ func (r *responseInterceptor) Status() int {
return r.status
}
func (r *responseInterceptor) GetPaths(path string, fs *fs.FS) (dc dirContents, err error) {
func (r *responseInterceptor) GetPaths(path string, fs *fs.FS, relative bool) (dc dirContents, err error) {
buf := r.buf.Bytes()
buf = bytes.ReplaceAll(buf, []byte{'&'}, []byte("&"))
err = xml.Unmarshal(buf, &dc)
@ -106,6 +106,9 @@ func (r *responseInterceptor) GetPaths(path string, fs *fs.FS) (dc dirContents,
name := template.HTML(p)
full := path + "/" + p
uri := template.HTML(full)
if relative {
uri = template.HTML(p)
}
if p[len(p)-1] == '/' {
dc.Dirs = append(dc.Dirs, dir{
Name: name,