From 883bea33cf0f99ac83d48846ff6fb768acfae00f Mon Sep 17 00:00:00 2001 From: NielsAD Date: Wed, 12 Sep 2018 14:25:26 +0200 Subject: [PATCH] Change sitemap.txt to urllist.txt --- fs.go | 9 +++------ main.go | 2 +- public/robots.txt | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/fs.go b/fs.go index 5a8d382..eef9e45 100644 --- a/fs.go +++ b/fs.go @@ -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() diff --git a/main.go b/main.go index e05390b..10f1fcc 100644 --- a/main.go +++ b/main.go @@ -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() { diff --git a/public/robots.txt b/public/robots.txt index 00ee9cb..8b20c47 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,4 +1,4 @@ User-agent: * Disallow: /dl/ Disallow: /idx/ -Sitemap: /sitemap.txt +Sitemap: /urllist.txt