diff options
author | Frédéric Guillot <fred@miniflux.net> | 2017-12-03 17:44:27 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2017-12-03 17:44:27 -0800 |
commit | bc20e0884b3ca051ae77e1bb6e2de11419d36d4d (patch) | |
tree | 993ff7aad2b98d5fe71b2decde7b36c4dd99d184 /model/icon.go | |
parent | ae62e543d3a1173cd39f1910cb67c95a56a7a6a4 (diff) |
Add Fever API
Diffstat (limited to 'model/icon.go')
-rw-r--r-- | model/icon.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/model/icon.go b/model/icon.go index 7bf12bf..3608a0a 100644 --- a/model/icon.go +++ b/model/icon.go @@ -4,6 +4,11 @@ package model +import ( + "encoding/base64" + "fmt" +) + // Icon represents a website icon (favicon) type Icon struct { ID int64 `json:"id"` @@ -12,6 +17,14 @@ type Icon struct { Content []byte `json:"content"` } +// DataURL returns the data URL of the icon. +func (i *Icon) DataURL() string { + return fmt.Sprintf("%s;base64,%s", i.MimeType, base64.StdEncoding.EncodeToString(i.Content)) +} + +// Icons represents a list of icon. +type Icons []*Icon + // FeedIcon is a jonction table between feeds and icons type FeedIcon struct { FeedID int64 `json:"feed_id"` |