mirror of
https://github.com/miniflux/v2.git
synced 2025-08-11 17:51:01 +00:00
Add new API endpoint /icons/{iconID}
This commit is contained in:
parent
5774323f2e
commit
2002d60fbe
6 changed files with 62 additions and 10 deletions
|
@ -10,7 +10,7 @@ import (
|
|||
"miniflux.app/v2/internal/http/response/json"
|
||||
)
|
||||
|
||||
func (h *handler) feedIcon(w http.ResponseWriter, r *http.Request) {
|
||||
func (h *handler) getIconByFeedID(w http.ResponseWriter, r *http.Request) {
|
||||
feedID := request.RouteInt64Param(r, "feedID")
|
||||
|
||||
if !h.store.HasIcon(feedID) {
|
||||
|
@ -35,3 +35,24 @@ func (h *handler) feedIcon(w http.ResponseWriter, r *http.Request) {
|
|||
Data: icon.DataURL(),
|
||||
})
|
||||
}
|
||||
|
||||
func (h *handler) getIconByIconID(w http.ResponseWriter, r *http.Request) {
|
||||
iconID := request.RouteInt64Param(r, "iconID")
|
||||
|
||||
icon, err := h.store.IconByID(iconID)
|
||||
if err != nil {
|
||||
json.ServerError(w, r, err)
|
||||
return
|
||||
}
|
||||
|
||||
if icon == nil {
|
||||
json.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
json.OK(w, r, &feedIconResponse{
|
||||
ID: icon.ID,
|
||||
MimeType: icon.MimeType,
|
||||
Data: icon.DataURL(),
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue