forked from Archives/Athou_commafeed
cleanup
This commit is contained in:
@@ -17,7 +17,7 @@ public record Favicon(byte[] icon, MediaType mediaType) {
|
||||
try {
|
||||
return MediaType.valueOf(contentType);
|
||||
} catch (Exception e) {
|
||||
log.debug("invalid content type '{}' received, returning default value", contentType);
|
||||
log.debug("invalid content type '{}' received, returning default value", contentType, e);
|
||||
return DEFAULT_MEDIA_TYPE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,9 +164,11 @@ public class FeedRefreshEngine {
|
||||
Instant lastLoginThreshold = config.feedRefresh().userInactivityPeriod().isZero() ? null
|
||||
: Instant.now().minus(config.feedRefresh().userInactivityPeriod());
|
||||
List<Feed> feeds = feedDAO.findNextUpdatable(max, lastLoginThreshold);
|
||||
// update disabledUntil to prevent feeds from being returned again by feedDAO.findNextUpdatable()
|
||||
Instant nextUpdateDate = Instant.now().plus(config.feedRefresh().interval());
|
||||
feedDAO.setDisabledUntil(feeds.stream().map(AbstractModel::getId).toList(), nextUpdateDate);
|
||||
if (!feeds.isEmpty()) {
|
||||
// update disabledUntil to prevent feeds from being returned again by feedDAO.findNextUpdatable()
|
||||
Instant nextUpdateDate = Instant.now().plus(config.feedRefresh().interval());
|
||||
feedDAO.setDisabledUntil(feeds.stream().map(AbstractModel::getId).toList(), nextUpdateDate);
|
||||
}
|
||||
return feeds;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -30,7 +30,11 @@ public class OPMLImporter {
|
||||
private final FeedSubscriptionService feedSubscriptionService;
|
||||
|
||||
public void importOpml(User user, String xml) throws IllegalArgumentException, FeedException {
|
||||
xml = xml.substring(xml.indexOf('<'));
|
||||
int index = xml.indexOf('<');
|
||||
if (index == -1) {
|
||||
throw new IllegalArgumentException("Invalid OPML: no start tag found");
|
||||
}
|
||||
xml = xml.substring(index);
|
||||
WireFeedInput input = new WireFeedInput();
|
||||
Opml feed = (Opml) input.build(new StringReader(xml));
|
||||
List<Outline> outlines = feed.getOutlines();
|
||||
|
||||
@@ -337,7 +337,7 @@ public class CategoryREST {
|
||||
}
|
||||
|
||||
FeedCategory parent = null;
|
||||
if (req.getParentId() != null && !CategoryREST.ALL.equals(req.getParentId())
|
||||
if (req.getParentId() != null && !ALL.equals(req.getParentId())
|
||||
&& !Strings.CS.equals(req.getParentId(), String.valueOf(req.getId()))) {
|
||||
parent = feedCategoryDAO.findById(user, Long.valueOf(req.getParentId()));
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public class FeedREST {
|
||||
boolean hasMore = entries.getEntries().size() > limit;
|
||||
if (hasMore) {
|
||||
entries.setHasMore(true);
|
||||
entries.getEntries().remove(entries.getEntries().size() - 1);
|
||||
entries.getEntries().removeLast();
|
||||
}
|
||||
} else {
|
||||
return Response.status(Status.NOT_FOUND).entity("<message>feed not found</message>").build();
|
||||
|
||||
Reference in New Issue
Block a user