mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
return relative urls to rely less on publicUrl where possible (#1016)
This commit is contained in:
@@ -146,18 +146,14 @@ public class CategoryREST {
|
||||
offset, limit + 1, order, true, onlyIds, tag);
|
||||
|
||||
for (FeedEntryStatus status : list) {
|
||||
entries.getEntries()
|
||||
.add(Entry.build(status, config.getApplicationSettings().getPublicUrl(),
|
||||
config.getApplicationSettings().getImageProxyEnabled()));
|
||||
entries.getEntries().add(Entry.build(status, config.getApplicationSettings().getImageProxyEnabled()));
|
||||
}
|
||||
|
||||
} else if (STARRED.equals(id)) {
|
||||
entries.setName("Starred");
|
||||
List<FeedEntryStatus> starred = feedEntryStatusDAO.findStarred(user, newerThanDate, offset, limit + 1, order, !onlyIds);
|
||||
for (FeedEntryStatus status : starred) {
|
||||
entries.getEntries()
|
||||
.add(Entry.build(status, config.getApplicationSettings().getPublicUrl(),
|
||||
config.getApplicationSettings().getImageProxyEnabled()));
|
||||
entries.getEntries().add(Entry.build(status, config.getApplicationSettings().getImageProxyEnabled()));
|
||||
}
|
||||
} else {
|
||||
FeedCategory parent = feedCategoryDAO.findById(user, Long.valueOf(id));
|
||||
@@ -169,9 +165,7 @@ public class CategoryREST {
|
||||
offset, limit + 1, order, true, onlyIds, tag);
|
||||
|
||||
for (FeedEntryStatus status : list) {
|
||||
entries.getEntries()
|
||||
.add(Entry.build(status, config.getApplicationSettings().getPublicUrl(),
|
||||
config.getApplicationSettings().getImageProxyEnabled()));
|
||||
entries.getEntries().add(Entry.build(status, config.getApplicationSettings().getImageProxyEnabled()));
|
||||
}
|
||||
entries.setName(parent.getName());
|
||||
} else {
|
||||
@@ -476,7 +470,7 @@ public class CategoryREST {
|
||||
if (id == null && subscription.getCategory() == null
|
||||
|| subscription.getCategory() != null && Objects.equals(subscription.getCategory().getId(), id)) {
|
||||
UnreadCount uc = unreadCount.get(subscription.getId());
|
||||
Subscription sub = Subscription.build(subscription, config.getApplicationSettings().getPublicUrl(), uc);
|
||||
Subscription sub = Subscription.build(subscription, uc);
|
||||
category.getFeeds().add(sub);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,9 +177,7 @@ public class FeedREST {
|
||||
entryKeywords, newerThanDate, offset, limit + 1, order, true, onlyIds, null);
|
||||
|
||||
for (FeedEntryStatus status : list) {
|
||||
entries.getEntries()
|
||||
.add(Entry.build(status, config.getApplicationSettings().getPublicUrl(),
|
||||
config.getApplicationSettings().getImageProxyEnabled()));
|
||||
entries.getEntries().add(Entry.build(status, config.getApplicationSettings().getImageProxyEnabled()));
|
||||
}
|
||||
|
||||
boolean hasMore = entries.getEntries().size() > limit;
|
||||
@@ -346,7 +344,7 @@ public class FeedREST {
|
||||
return Response.status(Status.NOT_FOUND).build();
|
||||
}
|
||||
UnreadCount unreadCount = feedSubscriptionService.getUnreadCount(user).get(id);
|
||||
return Response.ok(Subscription.build(sub, config.getApplicationSettings().getPublicUrl(), unreadCount)).build();
|
||||
return Response.ok(Subscription.build(sub, unreadCount)).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -522,13 +520,6 @@ public class FeedREST {
|
||||
@Timed
|
||||
public Response importOpml(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
@ApiParam(value = "ompl file", required = true) @FormDataParam("file") InputStream input) {
|
||||
|
||||
String publicUrl = config.getApplicationSettings().getPublicUrl();
|
||||
if (StringUtils.isBlank(publicUrl)) {
|
||||
throw new WebApplicationException(
|
||||
Response.status(Status.INTERNAL_SERVER_ERROR).entity("Set the public URL in the admin section.").build());
|
||||
}
|
||||
|
||||
if (CommaFeedApplication.USERNAME_DEMO.equals(user.getName())) {
|
||||
return Response.status(Status.FORBIDDEN).entity("Import is disabled for the demo account").build();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user