opml_export.go 632 B

12345678910111213141516171819202122232425
  1. // Copyright 2018 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package ui // import "miniflux.app/ui"
  5. import (
  6. "net/http"
  7. "miniflux.app/http/request"
  8. "miniflux.app/http/response/html"
  9. "miniflux.app/http/response/xml"
  10. "miniflux.app/reader/opml"
  11. )
  12. // Export generates the OPML file.
  13. func (c *Controller) Export(w http.ResponseWriter, r *http.Request) {
  14. opml, err := opml.NewHandler(c.store).Export(request.UserID(r))
  15. if err != nil {
  16. html.ServerError(w, r, err)
  17. return
  18. }
  19. xml.Attachment(w, r, "feeds.opml", opml)
  20. }