Change sitemap.txt to urllist.txt

This commit is contained in:
NielsAD
2018-09-12 14:25:26 +02:00
parent 910617f0c5
commit 883bea33cf
3 changed files with 5 additions and 8 deletions

9
fs.go
View File

@@ -465,12 +465,9 @@ func (fs *CachedFS) Sitemap(w http.ResponseWriter, r *http.Request) {
goto interr
}
l := len(path)
if l > 1 {
path = path[:l-1]
}
w.Write([]byte(path))
w.Write([]byte("https://"))
w.Write([]byte(r.Host))
w.Write([]byte(path[:len(path)-1]))
w.Write([]byte{'\n'})
}
err = rows.Err()

View File

@@ -90,7 +90,7 @@ func main() {
srv := &http.Server{Addr: *addr}
http.Handle("/idx/", limit.Handler(logRequest(http.StripPrefix("/idx/", fs))))
http.Handle("/dl/", limit.Handler(logRequest(http.StripPrefix("/dl/", nodir(http.FileServer(http.Dir(fs.Root)))))))
http.Handle("/sitemap.txt", http.HandlerFunc(fs.Sitemap))
http.Handle("/urllist.txt", http.HandlerFunc(fs.Sitemap))
http.Handle("/", pub)
go func() {

View File

@@ -1,4 +1,4 @@
User-agent: *
Disallow: /dl/
Disallow: /idx/
Sitemap: /sitemap.txt
Sitemap: /urllist.txt