mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
build icon url server side
This commit is contained in:
@@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.commafeed.backend.feeds.FeedUtils;
|
||||
import com.commafeed.backend.model.FeedEntry;
|
||||
import com.commafeed.backend.model.FeedEntryStatus;
|
||||
import com.sun.syndication.feed.synd.SyndContentImpl;
|
||||
@@ -22,7 +23,7 @@ import com.wordnik.swagger.annotations.ApiProperty;
|
||||
@ApiClass("Entry details")
|
||||
public class Entry implements Serializable {
|
||||
|
||||
public static Entry build(FeedEntryStatus status) {
|
||||
public static Entry build(FeedEntryStatus status, String publicUrl) {
|
||||
Entry entry = new Entry();
|
||||
|
||||
FeedEntry feedEntry = status.getEntry();
|
||||
@@ -44,6 +45,8 @@ public class Entry implements Serializable {
|
||||
entry.setFeedId(String.valueOf(status.getSubscription().getId()));
|
||||
entry.setFeedUrl(status.getSubscription().getFeed().getUrl());
|
||||
entry.setFeedLink(status.getSubscription().getFeed().getLink());
|
||||
entry.setIconUrl(FeedUtils.getFaviconUrl(status.getSubscription()
|
||||
.getFeed().getLink(), publicUrl));
|
||||
|
||||
return entry;
|
||||
}
|
||||
@@ -98,6 +101,9 @@ public class Entry implements Serializable {
|
||||
@ApiProperty("this entry's website url")
|
||||
private String feedLink;
|
||||
|
||||
@ApiProperty(value = "The favicon url to use for this feed")
|
||||
private String iconUrl;
|
||||
|
||||
@ApiProperty("entry url")
|
||||
private String url;
|
||||
|
||||
@@ -227,4 +233,12 @@ public class Entry implements Serializable {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getIconUrl() {
|
||||
return iconUrl;
|
||||
}
|
||||
|
||||
public void setIconUrl(String iconUrl) {
|
||||
this.iconUrl = iconUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.commafeed.backend.feeds.FeedUtils;
|
||||
import com.commafeed.backend.model.Feed;
|
||||
import com.commafeed.backend.model.FeedCategory;
|
||||
import com.commafeed.backend.model.FeedSubscription;
|
||||
@@ -21,7 +22,7 @@ import com.wordnik.swagger.annotations.ApiProperty;
|
||||
public class Subscription implements Serializable {
|
||||
|
||||
public static Subscription build(FeedSubscription subscription,
|
||||
long unreadCount) {
|
||||
String publicUrl, long unreadCount) {
|
||||
Date now = Calendar.getInstance().getTime();
|
||||
FeedCategory category = subscription.getCategory();
|
||||
Feed feed = subscription.getFeed();
|
||||
@@ -32,6 +33,7 @@ public class Subscription implements Serializable {
|
||||
sub.setErrorCount(feed.getErrorCount());
|
||||
sub.setFeedUrl(feed.getUrl());
|
||||
sub.setFeedLink(feed.getLink());
|
||||
sub.setIconUrl(FeedUtils.getFaviconUrl(feed.getLink(), publicUrl));
|
||||
sub.setLastRefresh(feed.getLastUpdated());
|
||||
sub.setNextRefresh((feed.getDisabledUntil() != null && feed
|
||||
.getDisabledUntil().before(now)) ? null : feed
|
||||
@@ -66,6 +68,9 @@ public class Subscription implements Serializable {
|
||||
@ApiProperty(value = "this subscription's website url", required = true)
|
||||
private String feedLink;
|
||||
|
||||
@ApiProperty(value = "The favicon url to use for this feed")
|
||||
private String iconUrl;
|
||||
|
||||
@ApiProperty(value = "unread count", required = true)
|
||||
private long unread;
|
||||
|
||||
@@ -152,4 +157,12 @@ public class Subscription implements Serializable {
|
||||
this.nextRefresh = nextRefresh;
|
||||
}
|
||||
|
||||
public String getIconUrl() {
|
||||
return iconUrl;
|
||||
}
|
||||
|
||||
public void setIconUrl(String iconUrl) {
|
||||
this.iconUrl = iconUrl;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user