Skip to content

Commit

Permalink
feat: Refresh all feeds
Browse files Browse the repository at this point in the history
  • Loading branch information
cljoly committed Apr 2, 2023
1 parent 0f0d3ff commit b1cde00
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gemtext/templates/home.gmi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

=> /entry All Unread
=> /entry?starred=true&statuses=unread&statuses=read Starred
=> /refresh_all Refresh all

{{- with .Params }}

=> /entry?{{ . }} Entries with the current filter
Expand Down
17 changes: 17 additions & 0 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,23 @@ func markAsHandler(ctx context.Context, w gemini.ResponseWriter, r *gemini.Reque
w.WriteHeader(gemini.StatusRedirect, fmt.Sprintf("/entry?%s", query.Encode()))
}

func refreshAllHandler(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
miniflux := getMiniflux(ctx, w)
if miniflux == nil {
return
}

err := miniflux.RefreshAllFeeds()
if err != nil {
w.WriteHeader(gemini.StatusCGIError, "miniflux error")
log.Printf("error refreshing all feeds: %v", err)
return
}

// Go back to the home page after a full refresh
w.WriteHeader(gemini.StatusRedirect, "/")
}

func homeHandler(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
miniflux := getMiniflux(ctx, w)
if miniflux == nil {
Expand Down

0 comments on commit b1cde00

Please sign in to comment.