Skip to content

Commit

Permalink
feat: automatically register well-known recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Jul 27, 2024
1 parent 2d56022 commit bee7920
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/miniflux/miniflux.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ func (mf *Miniflux) GetDailyCron() func() error {
}

func (mf *Miniflux) GetWebHandler(utils *server.PluginWebUtilities) (string, http.HandlerFunc) {
if strings.HasPrefix(mf.opmlFilename, core.ContentDirectory) {
location := strings.TrimPrefix(mf.opmlFilename, core.ContentDirectory)
return wellKnownRecommendationsPath, func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, location, http.StatusFound)
}
}

return "", nil
}

Expand Down Expand Up @@ -131,3 +138,5 @@ func (u *Miniflux) fetch() (map[string][]feed, error) {

return feedsByCategory, nil
}

const wellKnownRecommendationsPath = "/.well-known/recommendations.opml"

0 comments on commit bee7920

Please sign in to comment.