mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
let quarkus generate the documentation
This commit is contained in:
@@ -10,6 +10,7 @@ import com.codahale.metrics.Timer;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
@RegisterForReflection(
|
||||
registerFullHierarchy = true,
|
||||
targets = {
|
||||
// metrics
|
||||
MetricRegistry.class, Meter.class, Gauge.class, Counter.class, Timer.class, Histogram.class,
|
||||
|
||||
@@ -4,9 +4,9 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -15,7 +15,7 @@ import lombok.Data;
|
||||
@RegisterForReflection
|
||||
public class Category implements Serializable {
|
||||
|
||||
@Schema(description = "category id", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "category id", required = true)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "parent category id")
|
||||
@@ -24,18 +24,18 @@ public class Category implements Serializable {
|
||||
@Schema(description = "parent category name")
|
||||
private String parentName;
|
||||
|
||||
@Schema(description = "category id", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "category id", required = true)
|
||||
private String name;
|
||||
|
||||
@Schema(description = "category children categories", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "category children categories", required = true)
|
||||
private List<Category> children = new ArrayList<>();
|
||||
|
||||
@Schema(description = "category feeds", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "category feeds", required = true)
|
||||
private List<Subscription> feeds = new ArrayList<>();
|
||||
|
||||
@Schema(description = "whether the category is expanded or collapsed", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "whether the category is expanded or collapsed", required = true)
|
||||
private boolean expanded;
|
||||
|
||||
@Schema(description = "position of the category in the list", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "position of the category in the list", required = true)
|
||||
private int position;
|
||||
}
|
||||
@@ -4,9 +4,9 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -15,22 +15,22 @@ import lombok.Data;
|
||||
@RegisterForReflection
|
||||
public class Entries implements Serializable {
|
||||
|
||||
@Schema(description = "name of the feed or the category requested", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "name of the feed or the category requested", required = true)
|
||||
private String name;
|
||||
|
||||
@Schema(description = "error or warning message")
|
||||
private String message;
|
||||
|
||||
@Schema(description = "times the server tried to refresh the feed and failed", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "times the server tried to refresh the feed and failed", required = true)
|
||||
private int errorCount;
|
||||
|
||||
@Schema(description = "URL of the website, extracted from the feed, only filled if querying for feed entries, not category entries")
|
||||
private String feedLink;
|
||||
|
||||
@Schema(description = "list generation timestamp", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "list generation timestamp", required = true)
|
||||
private long timestamp;
|
||||
|
||||
@Schema(description = "if the query has more elements", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "if the query has more elements", required = true)
|
||||
private boolean hasMore;
|
||||
|
||||
@Schema(description = "the requested offset")
|
||||
@@ -39,12 +39,12 @@ public class Entries implements Serializable {
|
||||
@Schema(description = "the requested limit")
|
||||
private int limit;
|
||||
|
||||
@Schema(description = "list of entries", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "list of entries", required = true)
|
||||
private List<Entry> entries = new ArrayList<>();
|
||||
|
||||
@Schema(
|
||||
description = "if true, the unread flag was ignored in the request, all entries are returned regardless of their read status",
|
||||
requiredMode = RequiredMode.REQUIRED)
|
||||
required = true)
|
||||
private boolean ignoredReadStatus;
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import com.commafeed.backend.feed.FeedUtils;
|
||||
import com.commafeed.backend.model.FeedEntry;
|
||||
@@ -20,8 +22,6 @@ import com.rometools.rome.feed.synd.SyndEntry;
|
||||
import com.rometools.rome.feed.synd.SyndEntryImpl;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -30,22 +30,22 @@ import lombok.Data;
|
||||
@RegisterForReflection
|
||||
public class Entry implements Serializable {
|
||||
|
||||
@Schema(description = "entry id", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "entry id", required = true)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "entry guid", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "entry guid", required = true)
|
||||
private String guid;
|
||||
|
||||
@Schema(description = "entry title", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "entry title", required = true)
|
||||
private String title;
|
||||
|
||||
@Schema(description = "entry content", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "entry content", required = true)
|
||||
private String content;
|
||||
|
||||
@Schema(description = "comma-separated list of categories")
|
||||
private String categories;
|
||||
|
||||
@Schema(description = "whether entry content and title are rtl", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "whether entry content and title are rtl", required = true)
|
||||
private boolean rtl;
|
||||
|
||||
@Schema(description = "entry author")
|
||||
@@ -69,40 +69,40 @@ public class Entry implements Serializable {
|
||||
@Schema(description = "entry media thumbnail height, if any")
|
||||
private Integer mediaThumbnailHeight;
|
||||
|
||||
@Schema(description = "entry publication date", type = "number", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "entry publication date", type = SchemaType.INTEGER, required = true)
|
||||
private Instant date;
|
||||
|
||||
@Schema(description = "entry insertion date in the database", type = "number", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "entry insertion date in the database", type = SchemaType.INTEGER, required = true)
|
||||
private Instant insertedDate;
|
||||
|
||||
@Schema(description = "feed id", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "feed id", required = true)
|
||||
private String feedId;
|
||||
|
||||
@Schema(description = "feed name", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "feed name", required = true)
|
||||
private String feedName;
|
||||
|
||||
@Schema(description = "this entry's feed url", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "this entry's feed url", required = true)
|
||||
private String feedUrl;
|
||||
|
||||
@Schema(description = "this entry's website url", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "this entry's website url", required = true)
|
||||
private String feedLink;
|
||||
|
||||
@Schema(description = "The favicon url to use for this feed", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "The favicon url to use for this feed", required = true)
|
||||
private String iconUrl;
|
||||
|
||||
@Schema(description = "entry url", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "entry url", required = true)
|
||||
private String url;
|
||||
|
||||
@Schema(description = "read status", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "read status", required = true)
|
||||
private boolean read;
|
||||
|
||||
@Schema(description = "starred status", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "starred status", required = true)
|
||||
private boolean starred;
|
||||
|
||||
@Schema(description = "whether the entry is still markable (old entry statuses are discarded)", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "whether the entry is still markable (old entry statuses are discarded)", required = true)
|
||||
private boolean markable;
|
||||
|
||||
@Schema(description = "tags", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "tags", required = true)
|
||||
private List<String> tags;
|
||||
|
||||
public static Entry build(FeedEntryStatus status, boolean proxyImages) {
|
||||
|
||||
@@ -2,9 +2,9 @@ package com.commafeed.frontend.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -13,10 +13,10 @@ import lombok.Data;
|
||||
@RegisterForReflection
|
||||
public class FeedInfo implements Serializable {
|
||||
|
||||
@Schema(description = "url", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "url", required = true)
|
||||
private String url;
|
||||
|
||||
@Schema(description = "title", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "title", required = true)
|
||||
private String title;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ package com.commafeed.frontend.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -16,34 +16,34 @@ public class ServerInfo implements Serializable {
|
||||
@Schema
|
||||
private String announcement;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private String version;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private String gitCommit;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private boolean allowRegistrations;
|
||||
|
||||
@Schema
|
||||
private String googleAnalyticsCode;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private boolean smtpEnabled;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private boolean demoAccountEnabled;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private boolean websocketEnabled;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private long websocketPingInterval;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private long treeReloadInterval;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private long forceRefreshCooldownDuration;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@ package com.commafeed.frontend.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import com.commafeed.backend.model.UserSettings.IconDisplayMode;
|
||||
import com.commafeed.backend.model.UserSettings.ReadingMode;
|
||||
import com.commafeed.backend.model.UserSettings.ReadingOrder;
|
||||
import com.commafeed.backend.model.UserSettings.ScrollMode;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -18,19 +18,19 @@ import lombok.Data;
|
||||
@RegisterForReflection
|
||||
public class Settings implements Serializable {
|
||||
|
||||
@Schema(description = "user's preferred language, english if none", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "user's preferred language, english if none", required = true)
|
||||
private String language;
|
||||
|
||||
@Schema(description = "user reads all entries or unread entries only", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "user reads all entries or unread entries only", required = true)
|
||||
private ReadingMode readingMode;
|
||||
|
||||
@Schema(description = "user reads entries in ascending or descending order", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "user reads entries in ascending or descending order", required = true)
|
||||
private ReadingOrder readingOrder;
|
||||
|
||||
@Schema(description = "user wants category and feeds with no unread entries shown", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "user wants category and feeds with no unread entries shown", required = true)
|
||||
private boolean showRead;
|
||||
|
||||
@Schema(description = "In expanded view, scroll through entries mark them as read", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "In expanded view, scroll through entries mark them as read", required = true)
|
||||
private boolean scrollMarks;
|
||||
|
||||
@Schema(description = "user's custom css for the website")
|
||||
@@ -39,72 +39,70 @@ public class Settings implements Serializable {
|
||||
@Schema(description = "user's custom js for the website")
|
||||
private String customJs;
|
||||
|
||||
@Schema(description = "user's preferred scroll speed when navigating between entries", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "user's preferred scroll speed when navigating between entries", required = true)
|
||||
private int scrollSpeed;
|
||||
|
||||
@Schema(description = "whether to scroll to the selected entry", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "whether to scroll to the selected entry", required = true)
|
||||
private ScrollMode scrollMode;
|
||||
|
||||
@Schema(description = "number of entries to keep above the selected entry when scrolling", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "number of entries to keep above the selected entry when scrolling", required = true)
|
||||
private int entriesToKeepOnTopWhenScrolling;
|
||||
|
||||
@Schema(description = "whether to show the star icon in the header of entries", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "whether to show the star icon in the header of entries", required = true)
|
||||
private IconDisplayMode starIconDisplayMode;
|
||||
|
||||
@Schema(description = "whether to show the external link icon in the header of entries", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "whether to show the external link icon in the header of entries", required = true)
|
||||
private IconDisplayMode externalLinkIconDisplayMode;
|
||||
|
||||
@Schema(description = "ask for confirmation when marking all entries as read", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "ask for confirmation when marking all entries as read", required = true)
|
||||
private boolean markAllAsReadConfirmation;
|
||||
|
||||
@Schema(
|
||||
description = "navigate to the next unread category or feed after marking all entries as read",
|
||||
requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "navigate to the next unread category or feed after marking all entries as read", required = true)
|
||||
private boolean markAllAsReadNavigateToNextUnread;
|
||||
|
||||
@Schema(description = "show commafeed's own context menu on right click", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "show commafeed's own context menu on right click", required = true)
|
||||
private boolean customContextMenu;
|
||||
|
||||
@Schema(description = "on mobile, show action buttons at the bottom of the screen", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "on mobile, show action buttons at the bottom of the screen", required = true)
|
||||
private boolean mobileFooter;
|
||||
|
||||
@Schema(description = "show unread count in the title", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "show unread count in the title", required = true)
|
||||
private boolean unreadCountTitle;
|
||||
|
||||
@Schema(description = "show unread count in the favicon", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "show unread count in the favicon", required = true)
|
||||
private boolean unreadCountFavicon;
|
||||
|
||||
@Schema(description = "primary theme color to use in the UI")
|
||||
private String primaryColor;
|
||||
|
||||
@Schema(description = "sharing settings", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "sharing settings", required = true)
|
||||
private SharingSettings sharingSettings = new SharingSettings();
|
||||
|
||||
@Schema(description = "User sharing settings")
|
||||
@Data
|
||||
public static class SharingSettings implements Serializable {
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private boolean email;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private boolean gmail;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private boolean facebook;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private boolean twitter;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private boolean tumblr;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private boolean pocket;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private boolean instapaper;
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private boolean buffer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,15 @@ package com.commafeed.frontend.model;
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import com.commafeed.backend.feed.FeedUtils;
|
||||
import com.commafeed.backend.model.Feed;
|
||||
import com.commafeed.backend.model.FeedCategory;
|
||||
import com.commafeed.backend.model.FeedSubscription;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -19,34 +20,34 @@ import lombok.Data;
|
||||
@RegisterForReflection
|
||||
public class Subscription implements Serializable {
|
||||
|
||||
@Schema(description = "subscription id", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "subscription id", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "subscription name", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "subscription name", required = true)
|
||||
private String name;
|
||||
|
||||
@Schema(description = "error message while fetching the feed")
|
||||
private String message;
|
||||
|
||||
@Schema(description = "error count", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "error count", required = true)
|
||||
private int errorCount;
|
||||
|
||||
@Schema(description = "last time the feed was refreshed", type = "number")
|
||||
@Schema(description = "last time the feed was refreshed", type = SchemaType.INTEGER)
|
||||
private Instant lastRefresh;
|
||||
|
||||
@Schema(description = "next time the feed refresh is planned, null if refresh is already queued", type = "number")
|
||||
@Schema(description = "next time the feed refresh is planned, null if refresh is already queued", type = SchemaType.INTEGER)
|
||||
private Instant nextRefresh;
|
||||
|
||||
@Schema(description = "this subscription's feed url", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "this subscription's feed url", required = true)
|
||||
private String feedUrl;
|
||||
|
||||
@Schema(description = "this subscription's website url", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "this subscription's website url", required = true)
|
||||
private String feedLink;
|
||||
|
||||
@Schema(description = "The favicon url to use for this feed", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "The favicon url to use for this feed", required = true)
|
||||
private String iconUrl;
|
||||
|
||||
@Schema(description = "unread count", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "unread count", required = true)
|
||||
private long unread;
|
||||
|
||||
@Schema(description = "category id")
|
||||
@@ -55,7 +56,7 @@ public class Subscription implements Serializable {
|
||||
@Schema(description = "position of the subscription's in the list")
|
||||
private int position;
|
||||
|
||||
@Schema(description = "date of the newest item", type = "number")
|
||||
@Schema(description = "date of the newest item", type = SchemaType.INTEGER)
|
||||
private Instant newestItemTime;
|
||||
|
||||
@Schema(description = "JEXL string evaluated on new entries to mark them as read if they do not match")
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.commafeed.frontend.model;
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -19,7 +21,7 @@ public class UnreadCount implements Serializable {
|
||||
@Schema
|
||||
private long unreadCount;
|
||||
|
||||
@Schema(type = "number")
|
||||
@Schema(type = SchemaType.INTEGER)
|
||||
private Instant newestItemTime;
|
||||
|
||||
public UnreadCount() {
|
||||
|
||||
@@ -3,9 +3,10 @@ package com.commafeed.frontend.model;
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -14,10 +15,10 @@ import lombok.Data;
|
||||
@RegisterForReflection
|
||||
public class UserModel implements Serializable {
|
||||
|
||||
@Schema(description = "user id", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "user id", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "user name", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "user name", required = true)
|
||||
private String name;
|
||||
|
||||
@Schema(description = "user email, if any")
|
||||
@@ -29,19 +30,19 @@ public class UserModel implements Serializable {
|
||||
@Schema(description = "user password, never returned by the api")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "account status", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "account status", required = true)
|
||||
private boolean enabled;
|
||||
|
||||
@Schema(description = "account creation date", type = "number")
|
||||
@Schema(description = "account creation date", type = SchemaType.INTEGER)
|
||||
private Instant created;
|
||||
|
||||
@Schema(description = "last login date", type = "number")
|
||||
@Schema(description = "last login date", type = SchemaType.INTEGER)
|
||||
private Instant lastLogin;
|
||||
|
||||
@Schema(description = "user is admin", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "user is admin", required = true)
|
||||
private boolean admin;
|
||||
|
||||
@Schema(description = "user last force refresh", type = "number")
|
||||
@Schema(description = "user last force refresh", type = SchemaType.INTEGER)
|
||||
private Instant lastForceRefresh;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.io.Serializable;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -14,7 +14,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class AddCategoryRequest implements Serializable {
|
||||
|
||||
@Schema(description = "name", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "name", required = true)
|
||||
@NotEmpty
|
||||
@Size(max = 128)
|
||||
private String name;
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.commafeed.frontend.model.request;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -14,7 +14,7 @@ public class AdminSaveUserRequest implements Serializable {
|
||||
@Schema(description = "user id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "user name", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "user name", required = true)
|
||||
private String name;
|
||||
|
||||
@Schema(description = "user email, if any")
|
||||
@@ -23,9 +23,9 @@ public class AdminSaveUserRequest implements Serializable {
|
||||
@Schema(description = "user password")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "account status", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "account status", required = true)
|
||||
private boolean enabled;
|
||||
|
||||
@Schema(description = "user is admin", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "user is admin", required = true)
|
||||
private boolean admin;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import java.io.Serializable;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -13,7 +13,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class CategoryModificationRequest implements Serializable {
|
||||
|
||||
@Schema(description = "id", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "id", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "new name, null if not changed")
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.commafeed.frontend.model.request;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -11,10 +11,10 @@ import lombok.Data;
|
||||
@Data
|
||||
public class CollapseRequest implements Serializable {
|
||||
|
||||
@Schema(description = "category id", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "category id", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "collapse", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "collapse", required = true)
|
||||
private boolean collapse;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.io.Serializable;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -14,7 +14,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class FeedInfoRequest implements Serializable {
|
||||
|
||||
@Schema(description = "feed url", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "feed url", required = true)
|
||||
@NotEmpty
|
||||
@Size(max = 4096)
|
||||
private String url;
|
||||
|
||||
@@ -4,8 +4,8 @@ import java.io.Serializable;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -13,7 +13,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class FeedModificationRequest implements Serializable {
|
||||
|
||||
@Schema(description = "id", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "id", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "new name, null if not changed")
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.commafeed.frontend.model.request;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -11,7 +11,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class IDRequest implements Serializable {
|
||||
|
||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(required = true)
|
||||
private Long id;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import java.util.List;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -15,31 +15,26 @@ import lombok.Data;
|
||||
@Data
|
||||
public class MarkRequest implements Serializable {
|
||||
|
||||
@Schema(description = "entry id, category id, 'all' or 'starred'", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "entry id, category id, 'all' or 'starred'", required = true)
|
||||
@NotEmpty
|
||||
@Size(max = 128)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "mark as read or unread", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "mark as read or unread", required = true)
|
||||
private boolean read;
|
||||
|
||||
@Schema(description = "mark only entries older than this", requiredMode = RequiredMode.NOT_REQUIRED)
|
||||
@Schema(description = "mark only entries older than this")
|
||||
private Long olderThan;
|
||||
|
||||
@Schema(
|
||||
description = "pass the timestamp you got from the entry list to avoid marking entries that may have been fetched in the mean time and never displayed",
|
||||
requiredMode = RequiredMode.NOT_REQUIRED)
|
||||
description = "pass the timestamp you got from the entry list to avoid marking entries that may have been fetched in the mean time and never displayed")
|
||||
private Long insertedBefore;
|
||||
|
||||
@Schema(
|
||||
description = "only mark read if a feed has these keywords in the title or rss content",
|
||||
requiredMode = RequiredMode.NOT_REQUIRED)
|
||||
@Schema(description = "only mark read if a feed has these keywords in the title or rss content")
|
||||
@Size(max = 128)
|
||||
private String keywords;
|
||||
|
||||
@Schema(
|
||||
description = "if marking a category or 'all', exclude those subscriptions from the marking",
|
||||
requiredMode = RequiredMode.NOT_REQUIRED)
|
||||
@Schema(description = "if marking a category or 'all', exclude those subscriptions from the marking")
|
||||
private List<Long> excludedSubscriptions;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.util.List;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -14,7 +14,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class MultipleMarkRequest implements Serializable {
|
||||
|
||||
@Schema(description = "list of mark requests", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "list of mark requests", required = true)
|
||||
private List<@Valid MarkRequest> requests;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -15,7 +15,7 @@ import lombok.Data;
|
||||
@Schema
|
||||
public class PasswordResetRequest implements Serializable {
|
||||
|
||||
@Schema(description = "email address for password recovery", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "email address for password recovery", required = true)
|
||||
@Email
|
||||
@NotEmpty
|
||||
@Size(max = 255)
|
||||
|
||||
@@ -5,17 +5,17 @@ import java.io.Serializable;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import com.commafeed.security.password.ValidPassword;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@Schema(description = "Profile modification request")
|
||||
@Data
|
||||
public class ProfileModificationRequest implements Serializable {
|
||||
@Schema(description = "current user password, required to change profile data", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "current user password, required to change profile data", required = true)
|
||||
@NotEmpty
|
||||
@Size(max = 128)
|
||||
private String currentPassword;
|
||||
|
||||
@@ -6,10 +6,10 @@ import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import com.commafeed.security.password.ValidPassword;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -17,17 +17,17 @@ import lombok.Data;
|
||||
@Schema
|
||||
public class RegistrationRequest implements Serializable {
|
||||
|
||||
@Schema(description = "username, between 3 and 32 characters", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "username, between 3 and 32 characters", required = true)
|
||||
@NotEmpty
|
||||
@Size(min = 3, max = 32)
|
||||
private String name;
|
||||
|
||||
@Schema(description = "password, minimum 6 characters", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "password, minimum 6 characters", required = true)
|
||||
@NotEmpty
|
||||
@ValidPassword
|
||||
private String password;
|
||||
|
||||
@Schema(description = "email address for password recovery", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "email address for password recovery", required = true)
|
||||
@Email
|
||||
@NotEmpty
|
||||
@Size(max = 255)
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.io.Serializable;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -14,15 +14,15 @@ import lombok.Data;
|
||||
@Data
|
||||
public class StarRequest implements Serializable {
|
||||
|
||||
@Schema(description = "id", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "id", required = true)
|
||||
@NotEmpty
|
||||
@Size(max = 128)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "feed id", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "feed id", required = true)
|
||||
private Long feedId;
|
||||
|
||||
@Schema(description = "starred or not", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "starred or not", required = true)
|
||||
private boolean starred;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.io.Serializable;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -14,12 +14,12 @@ import lombok.Data;
|
||||
@Data
|
||||
public class SubscribeRequest implements Serializable {
|
||||
|
||||
@Schema(description = "url of the feed", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "url of the feed", required = true)
|
||||
@NotEmpty
|
||||
@Size(max = 4096)
|
||||
private String url;
|
||||
|
||||
@Schema(description = "name of the feed for the user", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "name of the feed for the user", required = true)
|
||||
@NotEmpty
|
||||
@Size(max = 128)
|
||||
private String title;
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.commafeed.frontend.model.request;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -12,10 +12,10 @@ import lombok.Data;
|
||||
@Data
|
||||
public class TagRequest implements Serializable {
|
||||
|
||||
@Schema(description = "entry id", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "entry id", required = true)
|
||||
private Long entryId;
|
||||
|
||||
@Schema(description = "tags", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "tags", required = true)
|
||||
private List<String> tags;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.commafeed.frontend.resource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -18,6 +20,9 @@ import jakarta.ws.rs.core.Response;
|
||||
import jakarta.ws.rs.core.Response.Status;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||
import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
|
||||
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
|
||||
|
||||
import com.codahale.metrics.MetricRegistry;
|
||||
import com.commafeed.CommaFeedConstants;
|
||||
@@ -36,13 +41,6 @@ import com.commafeed.security.Roles;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Path("/rest/admin")
|
||||
@@ -120,11 +118,8 @@ public class AdminREST {
|
||||
@Path("/user/get/{id}")
|
||||
@GET
|
||||
@Transactional
|
||||
@Operation(
|
||||
summary = "Get user information",
|
||||
description = "Get user information",
|
||||
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = UserModel.class))) })
|
||||
public Response adminGetUser(@Parameter(description = "user id", required = true) @PathParam("id") Long id) {
|
||||
@Operation(summary = "Get user information", description = "Get user information")
|
||||
public UserModel adminGetUser(@Parameter(description = "user id", required = true) @PathParam("id") Long id) {
|
||||
Preconditions.checkNotNull(id);
|
||||
User u = userDAO.findById(id);
|
||||
UserModel userModel = new UserModel();
|
||||
@@ -133,17 +128,14 @@ public class AdminREST {
|
||||
userModel.setEmail(u.getEmail());
|
||||
userModel.setEnabled(!u.isDisabled());
|
||||
userModel.setAdmin(userRoleDAO.findAll(u).stream().anyMatch(r -> r.getRole() == Role.ADMIN));
|
||||
return Response.ok(userModel).build();
|
||||
return userModel;
|
||||
}
|
||||
|
||||
@Path("/user/getAll")
|
||||
@GET
|
||||
@Transactional
|
||||
@Operation(
|
||||
summary = "Get all users",
|
||||
description = "Get all users",
|
||||
responses = { @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = UserModel.class)))) })
|
||||
public Response adminGetUsers() {
|
||||
@Operation(summary = "Get all users", description = "Get all users")
|
||||
public List<UserModel> adminGetUsers() {
|
||||
Map<Long, UserModel> users = new HashMap<>();
|
||||
for (UserRole role : userRoleDAO.findAll()) {
|
||||
User u = role.getUser();
|
||||
@@ -162,7 +154,7 @@ public class AdminREST {
|
||||
userModel.setAdmin(true);
|
||||
}
|
||||
}
|
||||
return Response.ok(users.values()).build();
|
||||
return new ArrayList<>(users.values());
|
||||
}
|
||||
|
||||
@Path("/user/delete")
|
||||
|
||||
@@ -28,6 +28,12 @@ import jakarta.ws.rs.core.UriInfo;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Content;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
|
||||
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
|
||||
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
|
||||
|
||||
import com.commafeed.CommaFeedConfiguration;
|
||||
import com.commafeed.backend.dao.FeedCategoryDAO;
|
||||
@@ -60,13 +66,6 @@ import com.rometools.rome.feed.synd.SyndFeed;
|
||||
import com.rometools.rome.feed.synd.SyndFeedImpl;
|
||||
import com.rometools.rome.io.SyndFeedOutput;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -95,10 +94,11 @@ public class CategoryREST {
|
||||
@Path("/entries")
|
||||
@GET
|
||||
@Transactional
|
||||
@Operation(
|
||||
summary = "Get category entries",
|
||||
description = "Get a list of category entries",
|
||||
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = Entries.class))) })
|
||||
@Operation(summary = "Get category entries", description = "Get a list of category entries")
|
||||
@APIResponse(
|
||||
responseCode = "200",
|
||||
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = Entries.class)) })
|
||||
@APIResponse(responseCode = "404", description = "category not found")
|
||||
public Response getCategoryEntries(
|
||||
@Parameter(description = "id of the category, 'all' or 'starred'", required = true) @QueryParam("id") String id,
|
||||
@Parameter(
|
||||
@@ -269,11 +269,8 @@ public class CategoryREST {
|
||||
@Path("/add")
|
||||
@POST
|
||||
@Transactional
|
||||
@Operation(
|
||||
summary = "Add a category",
|
||||
description = "Add a new feed category",
|
||||
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = Long.class))) })
|
||||
public Response addCategory(@Valid @Parameter(required = true) AddCategoryRequest req) {
|
||||
@Operation(summary = "Add a category", description = "Add a new feed category")
|
||||
public Long addCategory(@Valid @Parameter(required = true) AddCategoryRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getName());
|
||||
|
||||
@@ -290,7 +287,7 @@ public class CategoryREST {
|
||||
cat.setParent(parent);
|
||||
}
|
||||
feedCategoryDAO.persist(cat);
|
||||
return Response.ok(cat.getId()).build();
|
||||
return cat.getId();
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -390,23 +387,18 @@ public class CategoryREST {
|
||||
@GET
|
||||
@Path("/unreadCount")
|
||||
@Transactional
|
||||
@Operation(
|
||||
summary = "Get unread count for feed subscriptions",
|
||||
responses = { @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = UnreadCount.class)))) })
|
||||
public Response getUnreadCount() {
|
||||
@Operation(summary = "Get unread count for feed subscriptions")
|
||||
public List<UnreadCount> getUnreadCount() {
|
||||
User user = authenticationContext.getCurrentUser();
|
||||
Map<Long, UnreadCount> unreadCount = feedSubscriptionService.getUnreadCount(user);
|
||||
return Response.ok(Lists.newArrayList(unreadCount.values())).build();
|
||||
return Lists.newArrayList(unreadCount.values());
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/get")
|
||||
@Transactional
|
||||
@Operation(
|
||||
summary = "Get root category",
|
||||
description = "Get all categories and subscriptions of the user",
|
||||
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = Category.class))) })
|
||||
public Response getRootCategory() {
|
||||
@Operation(summary = "Get root category", description = "Get all categories and subscriptions of the user")
|
||||
public Category getRootCategory() {
|
||||
User user = authenticationContext.getCurrentUser();
|
||||
|
||||
List<FeedCategory> categories = feedCategoryDAO.findAll(user);
|
||||
@@ -417,7 +409,7 @@ public class CategoryREST {
|
||||
root.setId("all");
|
||||
root.setName("All");
|
||||
|
||||
return Response.ok(root).build();
|
||||
return root;
|
||||
}
|
||||
|
||||
private Category buildCategory(Long id, List<FeedCategory> categories, List<FeedSubscription> subscriptions,
|
||||
|
||||
@@ -14,6 +14,10 @@ import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||
import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
|
||||
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
|
||||
|
||||
import com.commafeed.backend.dao.FeedEntryTagDAO;
|
||||
import com.commafeed.backend.model.User;
|
||||
import com.commafeed.backend.service.FeedEntryService;
|
||||
@@ -26,9 +30,6 @@ import com.commafeed.security.AuthenticationContext;
|
||||
import com.commafeed.security.Roles;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Path("/rest/entry")
|
||||
|
||||
@@ -29,6 +29,12 @@ import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.apache.hc.core5.http.HttpStatus;
|
||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Content;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
|
||||
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
|
||||
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
|
||||
import org.jboss.resteasy.reactive.Cache;
|
||||
import org.jboss.resteasy.reactive.RestForm;
|
||||
|
||||
@@ -80,12 +86,6 @@ import com.rometools.rome.io.FeedException;
|
||||
import com.rometools.rome.io.SyndFeedOutput;
|
||||
import com.rometools.rome.io.WireFeedOutput;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -131,10 +131,11 @@ public class FeedREST {
|
||||
@Path("/entries")
|
||||
@GET
|
||||
@Transactional
|
||||
@Operation(
|
||||
summary = "Get feed entries",
|
||||
description = "Get a list of feed entries",
|
||||
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = Entries.class))) })
|
||||
@Operation(summary = "Get feed entries", description = "Get a list of feed entries")
|
||||
@APIResponse(
|
||||
responseCode = "200",
|
||||
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = Entries.class)) })
|
||||
@APIResponse(responseCode = "404", description = "feed not found")
|
||||
public Response getFeedEntries(@Parameter(description = "id of the feed", required = true) @QueryParam("id") String id,
|
||||
@Parameter(
|
||||
description = "all entries or only unread ones",
|
||||
@@ -251,10 +252,11 @@ public class FeedREST {
|
||||
@POST
|
||||
@Path("/fetch")
|
||||
@Transactional
|
||||
@Operation(
|
||||
summary = "Fetch a feed",
|
||||
description = "Fetch a feed by its url",
|
||||
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = FeedInfo.class))) })
|
||||
@Operation(summary = "Fetch a feed", description = "Fetch a feed by its url")
|
||||
@APIResponse(
|
||||
responseCode = "200",
|
||||
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = FeedInfo.class)) })
|
||||
@APIResponse(responseCode = "404", description = "feed not found")
|
||||
public Response fetchFeed(@Valid @Parameter(description = "feed url", required = true) FeedInfoRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getUrl());
|
||||
@@ -309,9 +311,11 @@ public class FeedREST {
|
||||
@GET
|
||||
@Path("/get/{id}")
|
||||
@Transactional
|
||||
@Operation(
|
||||
summary = "get feed",
|
||||
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = Subscription.class))) })
|
||||
@Operation(summary = "get feed")
|
||||
@APIResponse(
|
||||
responseCode = "200",
|
||||
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = Subscription.class)) })
|
||||
@APIResponse(responseCode = "404", description = "feed not found")
|
||||
public Response getFeed(@Parameter(description = "user id", required = true) @PathParam("id") Long id) {
|
||||
Preconditions.checkNotNull(id);
|
||||
|
||||
@@ -345,10 +349,10 @@ public class FeedREST {
|
||||
@POST
|
||||
@Path("/subscribe")
|
||||
@Transactional
|
||||
@Operation(
|
||||
summary = "Subscribe to a feed",
|
||||
description = "Subscribe to a feed",
|
||||
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = Long.class))) })
|
||||
@Operation(summary = "Subscribe to a feed", description = "Subscribe to a feed")
|
||||
@APIResponse(
|
||||
responseCode = "200",
|
||||
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = Long.class)) })
|
||||
public Response subscribe(@Valid @Parameter(description = "subscription request", required = true) SubscribeRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getTitle());
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
package com.commafeed.frontend.resource;
|
||||
|
||||
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
|
||||
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
|
||||
import io.swagger.v3.oas.annotations.info.Info;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityScheme;
|
||||
import io.swagger.v3.oas.annotations.servers.Server;
|
||||
import jakarta.ws.rs.core.Application;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.OpenAPIDefinition;
|
||||
import org.eclipse.microprofile.openapi.annotations.enums.SecuritySchemeType;
|
||||
import org.eclipse.microprofile.openapi.annotations.info.Info;
|
||||
import org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement;
|
||||
import org.eclipse.microprofile.openapi.annotations.security.SecurityScheme;
|
||||
import org.eclipse.microprofile.openapi.annotations.servers.Server;
|
||||
|
||||
@OpenAPIDefinition(
|
||||
info = @Info(title = "CommaFeed API"),
|
||||
info = @Info(title = "CommaFeed API", version = "1.0.0"),
|
||||
servers = { @Server(description = "CommaFeed API", url = "/") },
|
||||
security = { @SecurityRequirement(name = "basicAuth") })
|
||||
@SecurityScheme(name = "basicAuth", type = SecuritySchemeType.HTTP, scheme = "basic")
|
||||
public class OpenAPI {
|
||||
@SecurityScheme(securitySchemeName = "basicAuth", type = SecuritySchemeType.HTTP, scheme = "basic")
|
||||
public class OpenAPI extends Application {
|
||||
}
|
||||
|
||||
@@ -13,6 +13,10 @@ import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import jakarta.ws.rs.core.Response.Status;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||
import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
|
||||
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
|
||||
|
||||
import com.commafeed.CommaFeedConfiguration;
|
||||
import com.commafeed.CommaFeedVersion;
|
||||
import com.commafeed.backend.HttpGetter;
|
||||
@@ -21,12 +25,6 @@ import com.commafeed.backend.feed.ImageProxyUrl;
|
||||
import com.commafeed.frontend.model.ServerInfo;
|
||||
import com.commafeed.security.Roles;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Path("/rest/server")
|
||||
@@ -46,11 +44,8 @@ public class ServerREST {
|
||||
@GET
|
||||
@PermitAll
|
||||
@Transactional
|
||||
@Operation(
|
||||
summary = "Get server infos",
|
||||
description = "Get server infos",
|
||||
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = ServerInfo.class))) })
|
||||
public Response getServerInfos() {
|
||||
@Operation(summary = "Get server infos", description = "Get server infos")
|
||||
public ServerInfo getServerInfos() {
|
||||
ServerInfo infos = new ServerInfo();
|
||||
infos.setAnnouncement(config.announcement().orElse(null));
|
||||
infos.setVersion(version.getVersion());
|
||||
@@ -63,7 +58,7 @@ public class ServerREST {
|
||||
infos.setWebsocketPingInterval(config.websocket().pingInterval().toMillis());
|
||||
infos.setTreeReloadInterval(config.websocket().treeReloadInterval().toMillis());
|
||||
infos.setForceRefreshCooldownDuration(config.feedRefresh().forceRefreshCooldownDuration().toMillis());
|
||||
return Response.ok(infos).build();
|
||||
return infos;
|
||||
}
|
||||
|
||||
@Path("/proxy")
|
||||
|
||||
@@ -28,6 +28,9 @@ import jakarta.ws.rs.core.UriInfo;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.hc.core5.net.URIBuilder;
|
||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||
import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
|
||||
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
|
||||
|
||||
import com.commafeed.CommaFeedConfiguration;
|
||||
import com.commafeed.CommaFeedConstants;
|
||||
@@ -56,12 +59,6 @@ import com.commafeed.security.AuthenticationContext;
|
||||
import com.commafeed.security.Roles;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -88,11 +85,8 @@ public class UserREST {
|
||||
@Path("/settings")
|
||||
@GET
|
||||
@Transactional
|
||||
@Operation(
|
||||
summary = "Retrieve user settings",
|
||||
description = "Retrieve user settings",
|
||||
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = Settings.class))) })
|
||||
public Response getUserSettings() {
|
||||
@Operation(summary = "Retrieve user settings", description = "Retrieve user settings")
|
||||
public Settings getUserSettings() {
|
||||
Settings s = new Settings();
|
||||
|
||||
User user = authenticationContext.getCurrentUser();
|
||||
@@ -155,7 +149,7 @@ public class UserREST {
|
||||
s.setUnreadCountTitle(false);
|
||||
s.setUnreadCountFavicon(true);
|
||||
}
|
||||
return Response.ok(s).build();
|
||||
return s;
|
||||
}
|
||||
|
||||
@Path("/settings")
|
||||
@@ -208,10 +202,8 @@ public class UserREST {
|
||||
@Path("/profile")
|
||||
@GET
|
||||
@Transactional
|
||||
@Operation(
|
||||
summary = "Retrieve user's profile",
|
||||
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = UserModel.class))) })
|
||||
public Response getUserProfile() {
|
||||
@Operation(summary = "Retrieve user's profile")
|
||||
public UserModel getUserProfile() {
|
||||
User user = authenticationContext.getCurrentUser();
|
||||
|
||||
UserModel userModel = new UserModel();
|
||||
@@ -226,7 +218,7 @@ public class UserREST {
|
||||
userModel.setAdmin(true);
|
||||
}
|
||||
}
|
||||
return Response.ok(userModel).build();
|
||||
return userModel;
|
||||
}
|
||||
|
||||
@Path("/profile")
|
||||
|
||||
@@ -27,6 +27,7 @@ import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.MultivaluedMap;
|
||||
import jakarta.ws.rs.core.UriInfo;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||
import org.jboss.resteasy.reactive.server.multipart.FormValue;
|
||||
import org.jboss.resteasy.reactive.server.multipart.MultipartFormDataInput;
|
||||
|
||||
@@ -51,7 +52,6 @@ import com.commafeed.frontend.resource.fever.FeverResponse.FeverFeedGroup;
|
||||
import com.commafeed.frontend.resource.fever.FeverResponse.FeverGroup;
|
||||
import com.commafeed.frontend.resource.fever.FeverResponse.FeverItem;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,6 @@ import lombok.RequiredArgsConstructor;
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@RequiredArgsConstructor
|
||||
@Singleton
|
||||
@Hidden
|
||||
public class FeverREST {
|
||||
|
||||
private static final String PATH = "/user/{userId}{optionalTrailingFever : (/fever)?}{optionalTrailingSlash : (/)?}";
|
||||
@@ -91,6 +90,7 @@ public class FeverREST {
|
||||
@Path(PATH)
|
||||
@POST
|
||||
@Transactional
|
||||
@Operation(hidden = true)
|
||||
public FeverResponse formUrlencoded(@Context UriInfo uri, @PathParam("userId") Long userId, MultivaluedMap<String, String> form) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
uri.getQueryParameters().forEach((k, v) -> params.put(k, v.get(0)));
|
||||
@@ -103,6 +103,7 @@ public class FeverREST {
|
||||
@Path(PATH)
|
||||
@POST
|
||||
@Transactional
|
||||
@Operation(hidden = true)
|
||||
public FeverResponse noForm(@Context UriInfo uri, @PathParam("userId") Long userId) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
uri.getQueryParameters().forEach((k, v) -> params.put(k, v.get(0)));
|
||||
@@ -114,6 +115,7 @@ public class FeverREST {
|
||||
@Path(PATH)
|
||||
@GET
|
||||
@Transactional
|
||||
@Operation(hidden = true)
|
||||
public FeverResponse get(@Context UriInfo uri, @PathParam("userId") Long userId) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
uri.getQueryParameters().forEach((k, v) -> params.put(k, v.get(0)));
|
||||
@@ -126,6 +128,7 @@ public class FeverREST {
|
||||
@Path(PATH)
|
||||
@POST
|
||||
@Transactional
|
||||
@Operation(hidden = true)
|
||||
public FeverResponse formData(@Context UriInfo uri, @PathParam("userId") Long userId, MultipartFormDataInput form) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
uri.getQueryParameters().forEach((k, v) -> params.put(k, v.get(0)));
|
||||
|
||||
@@ -6,6 +6,8 @@ import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||
|
||||
import com.commafeed.backend.dao.UserSettingsDAO;
|
||||
import com.commafeed.backend.model.User;
|
||||
import com.commafeed.backend.model.UserSettings;
|
||||
@@ -24,6 +26,7 @@ public class CustomCssServlet {
|
||||
|
||||
@GET
|
||||
@Transactional
|
||||
@Operation(hidden = true)
|
||||
public String get() {
|
||||
User user = authenticationContext.getCurrentUser();
|
||||
if (user == null) {
|
||||
|
||||
@@ -6,6 +6,8 @@ import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
|
||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||
|
||||
import com.commafeed.backend.dao.UserSettingsDAO;
|
||||
import com.commafeed.backend.model.User;
|
||||
import com.commafeed.backend.model.UserSettings;
|
||||
@@ -24,6 +26,7 @@ public class CustomJsServlet {
|
||||
|
||||
@GET
|
||||
@Transactional
|
||||
@Operation(hidden = true)
|
||||
public String get() {
|
||||
User user = authenticationContext.getCurrentUser();
|
||||
if (user == null) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import jakarta.ws.rs.core.Response;
|
||||
import jakarta.ws.rs.core.UriInfo;
|
||||
|
||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||
|
||||
@Path("/logout")
|
||||
@PermitAll
|
||||
@@ -27,6 +28,7 @@ public class LogoutServlet {
|
||||
}
|
||||
|
||||
@GET
|
||||
@Operation(hidden = true)
|
||||
public Response get() {
|
||||
NewCookie removeCookie = new NewCookie.Builder(cookieName).maxAge(0).expiry(Date.from(Instant.EPOCH)).path("/").build();
|
||||
return Response.temporaryRedirect(uri.getBaseUri()).cookie(removeCookie).build();
|
||||
|
||||
@@ -13,6 +13,7 @@ import jakarta.ws.rs.core.Response;
|
||||
import jakarta.ws.rs.core.UriInfo;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||
|
||||
import com.commafeed.backend.dao.FeedCategoryDAO;
|
||||
import com.commafeed.backend.dao.FeedEntryStatusDAO;
|
||||
@@ -42,6 +43,7 @@ public class NextUnreadServlet {
|
||||
|
||||
@GET
|
||||
@Transactional
|
||||
@Operation(hidden = true)
|
||||
public Response get(@QueryParam("category") String categoryId, @QueryParam("order") @DefaultValue("desc") ReadingOrder order) {
|
||||
User user = authenticationContext.getCurrentUser();
|
||||
if (user == null) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
import org.apache.hc.core5.http.HttpStatus;
|
||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||
|
||||
import com.commafeed.CommaFeedConfiguration;
|
||||
|
||||
@@ -24,6 +25,7 @@ public class RobotsTxtDisallowAllServlet {
|
||||
private final CommaFeedConfiguration config;
|
||||
|
||||
@GET
|
||||
@Operation(hidden = true)
|
||||
public Response get() {
|
||||
if (config.hideFromWebCrawlers()) {
|
||||
return Response.ok("User-agent: *\nDisallow: /").build();
|
||||
|
||||
Reference in New Issue
Block a user