opml_export.go 624 B

1234567891011121314151617181920212223
  1. // SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
  2. // SPDX-License-Identifier: Apache-2.0
  3. package ui // import "miniflux.app/v2/internal/ui"
  4. import (
  5. "net/http"
  6. "miniflux.app/v2/internal/http/request"
  7. "miniflux.app/v2/internal/http/response/html"
  8. "miniflux.app/v2/internal/http/response/xml"
  9. "miniflux.app/v2/internal/reader/opml"
  10. )
  11. func (h *handler) exportFeeds(w http.ResponseWriter, r *http.Request) {
  12. opmlExport, err := opml.NewHandler(h.store).Export(request.UserID(r))
  13. if err != nil {
  14. html.ServerError(w, r, err)
  15. return
  16. }
  17. xml.Attachment(w, r, "feeds.opml", opmlExport)
  18. }