normalize line endings

This commit is contained in:
Athou
2025-03-10 08:38:21 +01:00
parent ec4554c76e
commit fb7f041454
223 changed files with 18091 additions and 18093 deletions

View File

@@ -1,41 +1,41 @@
package com.commafeed.frontend.servlet;
import jakarta.inject.Singleton;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import com.commafeed.backend.dao.UserSettingsDAO;
import com.commafeed.backend.model.User;
import com.commafeed.backend.model.UserSettings;
import com.commafeed.security.AuthenticationContext;
import lombok.RequiredArgsConstructor;
@Path("/custom_css.css")
@Produces("text/css")
@RequiredArgsConstructor
@Singleton
public class CustomCssServlet {
private final AuthenticationContext authenticationContext;
private final UserSettingsDAO userSettingsDAO;
@GET
@Transactional
public String get() {
User user = authenticationContext.getCurrentUser();
if (user == null) {
return "";
}
UserSettings settings = userSettingsDAO.findByUser(user);
if (settings == null) {
return "";
}
return settings.getCustomCss();
}
}
package com.commafeed.frontend.servlet;
import jakarta.inject.Singleton;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import com.commafeed.backend.dao.UserSettingsDAO;
import com.commafeed.backend.model.User;
import com.commafeed.backend.model.UserSettings;
import com.commafeed.security.AuthenticationContext;
import lombok.RequiredArgsConstructor;
@Path("/custom_css.css")
@Produces("text/css")
@RequiredArgsConstructor
@Singleton
public class CustomCssServlet {
private final AuthenticationContext authenticationContext;
private final UserSettingsDAO userSettingsDAO;
@GET
@Transactional
public String get() {
User user = authenticationContext.getCurrentUser();
if (user == null) {
return "";
}
UserSettings settings = userSettingsDAO.findByUser(user);
if (settings == null) {
return "";
}
return settings.getCustomCss();
}
}

View File

@@ -1,41 +1,41 @@
package com.commafeed.frontend.servlet;
import jakarta.inject.Singleton;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import com.commafeed.backend.dao.UserSettingsDAO;
import com.commafeed.backend.model.User;
import com.commafeed.backend.model.UserSettings;
import com.commafeed.security.AuthenticationContext;
import lombok.RequiredArgsConstructor;
@Path("/custom_js.js")
@Produces("application/javascript")
@RequiredArgsConstructor
@Singleton
public class CustomJsServlet {
private final AuthenticationContext authenticationContext;
private final UserSettingsDAO userSettingsDAO;
@GET
@Transactional
public String get() {
User user = authenticationContext.getCurrentUser();
if (user == null) {
return "";
}
UserSettings settings = userSettingsDAO.findByUser(user);
if (settings == null) {
return "";
}
return settings.getCustomJs();
}
}
package com.commafeed.frontend.servlet;
import jakarta.inject.Singleton;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import com.commafeed.backend.dao.UserSettingsDAO;
import com.commafeed.backend.model.User;
import com.commafeed.backend.model.UserSettings;
import com.commafeed.security.AuthenticationContext;
import lombok.RequiredArgsConstructor;
@Path("/custom_js.js")
@Produces("application/javascript")
@RequiredArgsConstructor
@Singleton
public class CustomJsServlet {
private final AuthenticationContext authenticationContext;
private final UserSettingsDAO userSettingsDAO;
@GET
@Transactional
public String get() {
User user = authenticationContext.getCurrentUser();
if (user == null) {
return "";
}
UserSettings settings = userSettingsDAO.findByUser(user);
if (settings == null) {
return "";
}
return settings.getCustomJs();
}
}

View File

@@ -1,34 +1,34 @@
package com.commafeed.frontend.servlet;
import java.time.Instant;
import java.util.Date;
import jakarta.annotation.security.PermitAll;
import jakarta.inject.Singleton;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.NewCookie;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
import org.eclipse.microprofile.config.inject.ConfigProperty;
@Path("/logout")
@PermitAll
@Singleton
public class LogoutServlet {
private final UriInfo uri;
private final String cookieName;
public LogoutServlet(UriInfo uri, @ConfigProperty(name = "quarkus.http.auth.form.cookie-name") String cookieName) {
this.uri = uri;
this.cookieName = cookieName;
}
@GET
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();
}
}
package com.commafeed.frontend.servlet;
import java.time.Instant;
import java.util.Date;
import jakarta.annotation.security.PermitAll;
import jakarta.inject.Singleton;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.NewCookie;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
import org.eclipse.microprofile.config.inject.ConfigProperty;
@Path("/logout")
@PermitAll
@Singleton
public class LogoutServlet {
private final UriInfo uri;
private final String cookieName;
public LogoutServlet(UriInfo uri, @ConfigProperty(name = "quarkus.http.auth.form.cookie-name") String cookieName) {
this.uri = uri;
this.cookieName = cookieName;
}
@GET
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();
}
}

View File

@@ -1,75 +1,75 @@
package com.commafeed.frontend.servlet;
import java.net.URI;
import java.util.List;
import jakarta.inject.Singleton;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
import org.apache.commons.lang3.StringUtils;
import com.commafeed.backend.dao.FeedCategoryDAO;
import com.commafeed.backend.dao.FeedEntryStatusDAO;
import com.commafeed.backend.dao.FeedSubscriptionDAO;
import com.commafeed.backend.model.FeedCategory;
import com.commafeed.backend.model.FeedEntryStatus;
import com.commafeed.backend.model.FeedSubscription;
import com.commafeed.backend.model.User;
import com.commafeed.backend.model.UserSettings.ReadingOrder;
import com.commafeed.backend.service.FeedEntryService;
import com.commafeed.frontend.resource.CategoryREST;
import com.commafeed.security.AuthenticationContext;
import com.google.common.collect.Iterables;
import lombok.RequiredArgsConstructor;
@Path("/next")
@RequiredArgsConstructor
@Singleton
public class NextUnreadServlet {
private final FeedSubscriptionDAO feedSubscriptionDAO;
private final FeedEntryStatusDAO feedEntryStatusDAO;
private final FeedCategoryDAO feedCategoryDAO;
private final FeedEntryService feedEntryService;
private final AuthenticationContext authenticationContext;
private final UriInfo uri;
@GET
@Transactional
public Response get(@QueryParam("category") String categoryId, @QueryParam("order") @DefaultValue("desc") ReadingOrder order) {
User user = authenticationContext.getCurrentUser();
if (user == null) {
return Response.temporaryRedirect(uri.getBaseUri()).build();
}
FeedEntryStatus s = null;
if (StringUtils.isBlank(categoryId) || CategoryREST.ALL.equals(categoryId)) {
List<FeedSubscription> subs = feedSubscriptionDAO.findAll(user);
List<FeedEntryStatus> statuses = feedEntryStatusDAO.findBySubscriptions(user, subs, true, null, null, 0, 1, order, true, null,
null, null);
s = Iterables.getFirst(statuses, null);
} else {
FeedCategory category = feedCategoryDAO.findById(user, Long.valueOf(categoryId));
if (category != null) {
List<FeedCategory> children = feedCategoryDAO.findAllChildrenCategories(user, category);
List<FeedSubscription> subscriptions = feedSubscriptionDAO.findByCategories(user, children);
List<FeedEntryStatus> statuses = feedEntryStatusDAO.findBySubscriptions(user, subscriptions, true, null, null, 0, 1, order,
true, null, null, null);
s = Iterables.getFirst(statuses, null);
}
}
if (s != null) {
feedEntryService.markEntry(user, s.getEntry().getId(), true);
}
String url = s == null ? uri.getBaseUri().toString() : s.getEntry().getUrl();
return Response.temporaryRedirect(URI.create(url)).build();
}
}
package com.commafeed.frontend.servlet;
import java.net.URI;
import java.util.List;
import jakarta.inject.Singleton;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
import org.apache.commons.lang3.StringUtils;
import com.commafeed.backend.dao.FeedCategoryDAO;
import com.commafeed.backend.dao.FeedEntryStatusDAO;
import com.commafeed.backend.dao.FeedSubscriptionDAO;
import com.commafeed.backend.model.FeedCategory;
import com.commafeed.backend.model.FeedEntryStatus;
import com.commafeed.backend.model.FeedSubscription;
import com.commafeed.backend.model.User;
import com.commafeed.backend.model.UserSettings.ReadingOrder;
import com.commafeed.backend.service.FeedEntryService;
import com.commafeed.frontend.resource.CategoryREST;
import com.commafeed.security.AuthenticationContext;
import com.google.common.collect.Iterables;
import lombok.RequiredArgsConstructor;
@Path("/next")
@RequiredArgsConstructor
@Singleton
public class NextUnreadServlet {
private final FeedSubscriptionDAO feedSubscriptionDAO;
private final FeedEntryStatusDAO feedEntryStatusDAO;
private final FeedCategoryDAO feedCategoryDAO;
private final FeedEntryService feedEntryService;
private final AuthenticationContext authenticationContext;
private final UriInfo uri;
@GET
@Transactional
public Response get(@QueryParam("category") String categoryId, @QueryParam("order") @DefaultValue("desc") ReadingOrder order) {
User user = authenticationContext.getCurrentUser();
if (user == null) {
return Response.temporaryRedirect(uri.getBaseUri()).build();
}
FeedEntryStatus s = null;
if (StringUtils.isBlank(categoryId) || CategoryREST.ALL.equals(categoryId)) {
List<FeedSubscription> subs = feedSubscriptionDAO.findAll(user);
List<FeedEntryStatus> statuses = feedEntryStatusDAO.findBySubscriptions(user, subs, true, null, null, 0, 1, order, true, null,
null, null);
s = Iterables.getFirst(statuses, null);
} else {
FeedCategory category = feedCategoryDAO.findById(user, Long.valueOf(categoryId));
if (category != null) {
List<FeedCategory> children = feedCategoryDAO.findAllChildrenCategories(user, category);
List<FeedSubscription> subscriptions = feedSubscriptionDAO.findByCategories(user, children);
List<FeedEntryStatus> statuses = feedEntryStatusDAO.findBySubscriptions(user, subscriptions, true, null, null, 0, 1, order,
true, null, null, null);
s = Iterables.getFirst(statuses, null);
}
}
if (s != null) {
feedEntryService.markEntry(user, s.getEntry().getId(), true);
}
String url = s == null ? uri.getBaseUri().toString() : s.getEntry().getUrl();
return Response.temporaryRedirect(URI.create(url)).build();
}
}

View File

@@ -1,34 +1,34 @@
package com.commafeed.frontend.servlet;
import jakarta.annotation.security.PermitAll;
import jakarta.inject.Singleton;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import org.apache.hc.core5.http.HttpStatus;
import com.commafeed.CommaFeedConfiguration;
import lombok.RequiredArgsConstructor;
@Path("/robots.txt")
@PermitAll
@Produces(MediaType.TEXT_PLAIN)
@RequiredArgsConstructor
@Singleton
public class RobotsTxtDisallowAllServlet {
private final CommaFeedConfiguration config;
@GET
public Response get() {
if (config.hideFromWebCrawlers()) {
return Response.ok("User-agent: *\nDisallow: /").build();
} else {
return Response.status(HttpStatus.SC_NOT_FOUND).build();
}
}
package com.commafeed.frontend.servlet;
import jakarta.annotation.security.PermitAll;
import jakarta.inject.Singleton;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import org.apache.hc.core5.http.HttpStatus;
import com.commafeed.CommaFeedConfiguration;
import lombok.RequiredArgsConstructor;
@Path("/robots.txt")
@PermitAll
@Produces(MediaType.TEXT_PLAIN)
@RequiredArgsConstructor
@Singleton
public class RobotsTxtDisallowAllServlet {
private final CommaFeedConfiguration config;
@GET
public Response get() {
if (config.hideFromWebCrawlers()) {
return Response.ok("User-agent: *\nDisallow: /").build();
} else {
return Response.status(HttpStatus.SC_NOT_FOUND).build();
}
}
}