]> Sergey Matveev's repositories - tofuproxy.git/commitdiff
go.stargrave.org/feeder is another feeder
authorSergey Matveev <stargrave@stargrave.org>
Fri, 18 Feb 2022 07:23:31 +0000 (10:23 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 18 Feb 2022 07:23:31 +0000 (10:23 +0300)
doc/index.texi
rounds/redirectHTML.go

index 63c0254663d5efb84d2c784bd541f84324b53dd8..ae61d9f03966e08d92433ee664fb6fe3f77d9786 100644 (file)
@@ -56,6 +56,7 @@ input dialogue is shown. It automatically loads initial form values from
 Permanent HTTP redirects are replaces with non-refreshing HTML page with
 the link, to make you explicitly allow that step. Temporary redirects
 are followed if it is neither @url{https://newsboat.org/, Newsboat}
+nor @url{https://www.feeder.stargrave.org/, go.stargrave.org/feeder}
 user-agent, not image paths.
 
 @item
index a5d4bd779f6e430b2008d12e1d6389c0d885b743..2e286d3208ba3da10ab100ac09fe466a98f8abe6 100644 (file)
@@ -44,8 +44,14 @@ var imageExts = map[string]struct{}{
        ".webp": {},
 }
 
-func isNewsboat(req *http.Request) bool {
-       return strings.Contains(req.Header.Get("User-Agent"), "newsboat/")
+func isFeeder(req *http.Request) bool {
+       if strings.Contains(req.Header.Get("User-Agent"), "newsboat/") {
+               return true
+       }
+       if strings.Contains(req.Header.Get("User-Agent"), "go.stargrave.org-feeder/") {
+               return true
+       }
+       return false
 }
 
 func RoundRedirectHTML(
@@ -62,7 +68,7 @@ func RoundRedirectHTML(
        case http.StatusMovedPermanently, http.StatusPermanentRedirect:
                redirType = "permanent"
        case http.StatusFound, http.StatusSeeOther, http.StatusTemporaryRedirect:
-               if isNewsboat(req) {
+               if isFeeder(req) {
                        return true, nil
                }
                if _, ok := imageExts[filepath.Ext(req.URL.Path)]; ok {