|
|
@@ -13,6 +13,7 @@ import (
|
|
|
"miniflux.app/http/request"
|
|
|
"miniflux.app/http/response/json"
|
|
|
"miniflux.app/model"
|
|
|
+ "miniflux.app/reader/processor"
|
|
|
"miniflux.app/storage"
|
|
|
"miniflux.app/validator"
|
|
|
)
|
|
|
@@ -172,6 +173,46 @@ func (h *handler) toggleBookmark(w http.ResponseWriter, r *http.Request) {
|
|
|
json.NoContent(w, r)
|
|
|
}
|
|
|
|
|
|
+func (h *handler) fetchContent(w http.ResponseWriter, r *http.Request) {
|
|
|
+ loggedUserID := request.UserID(r)
|
|
|
+ entryID := request.RouteInt64Param(r, "entryID")
|
|
|
+
|
|
|
+ entryBuilder := h.store.NewEntryQueryBuilder(loggedUserID)
|
|
|
+ entryBuilder.WithEntryID(entryID)
|
|
|
+ entryBuilder.WithoutStatus(model.EntryStatusRemoved)
|
|
|
+
|
|
|
+ entry, err := entryBuilder.GetEntry()
|
|
|
+ if err != nil {
|
|
|
+ json.ServerError(w, r, err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if entry == nil {
|
|
|
+ json.NotFound(w, r)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ feedBuilder := storage.NewFeedQueryBuilder(h.store, loggedUserID)
|
|
|
+ feedBuilder.WithFeedID(entry.FeedID)
|
|
|
+ feed, err := feedBuilder.GetFeed()
|
|
|
+ if err != nil {
|
|
|
+ json.ServerError(w, r, err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if feed == nil {
|
|
|
+ json.NotFound(w, r)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if err := processor.ProcessEntryWebPage(feed, entry); err != nil {
|
|
|
+ json.ServerError(w, r, err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ json.OK(w, r, map[string]string{"content": entry.Content})
|
|
|
+}
|
|
|
+
|
|
|
func configureFilters(builder *storage.EntryQueryBuilder, r *http.Request) {
|
|
|
beforeEntryID := request.QueryInt64Param(r, "before_entry_id", 0)
|
|
|
if beforeEntryID > 0 {
|