diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2021-02-21 23:29:00 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2021-02-21 23:29:00 +0100 |
commit | 82aea26e5dda91e2ca5734e81925776dcbeea362 (patch) | |
tree | e0d8e2eeec6360ea73b71283ff13fe0e6bc7534a | |
parent | 2e86352fa4c5dc5d9b3b2af5d223977cc3109a61 (diff) | |
download | fbfeed-82aea26e5dda91e2ca5734e81925776dcbeea362.tar.gz fbfeed-82aea26e5dda91e2ca5734e81925776dcbeea362.tar.bz2 fbfeed-82aea26e5dda91e2ca5734e81925776dcbeea362.zip |
Present usage on empty path.
-rw-r--r-- | main.go | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -105,7 +105,16 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/favicon.ico" { return } + + if r.URL.Path == "/" { + http.Error(w, fmt.Sprintf("usage: %s/@facebookGroupName", r.Host), 400) + return + } + group := r.URL.Path[1:] + if group[0] == '@' { + group = group[1:] + } if strings.HasSuffix(group, ".rss") { group = strings.TrimSuffix(group, ".rss") outputMode = "rss" @@ -121,7 +130,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } if c == nil || len(c.Items) < 1 { - http.Error(w, fmt.Sprintf("%s", "group not found"), 400) + http.Error(w, fmt.Sprintf("%s", "Group not found."), 400) return } |