diff options
Diffstat (limited to 'juick-server/src/main/java/com/juick/server')
7 files changed, 14 insertions, 11 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/webhooks/MessengerWebhook.java b/juick-server/src/main/java/com/juick/server/api/webhooks/MessengerWebhook.java index e746b67d..0ba68182 100644 --- a/juick-server/src/main/java/com/juick/server/api/webhooks/MessengerWebhook.java +++ b/juick-server/src/main/java/com/juick/server/api/webhooks/MessengerWebhook.java @@ -44,7 +44,7 @@ public class MessengerWebhook { @Inject private MessengerManager messengerManager; - @RequestMapping(value = "/fbwbhk", method = RequestMethod.GET) + @RequestMapping(value = "/api/fbwbhk", method = RequestMethod.GET) public ResponseEntity<Integer> verifyHook(@RequestParam(name = "hub.mode") String hubMode, @RequestParam(name = "hub.challenge") Integer hubChallenge, @RequestParam(name = "hub.verify_token") String verifyToken) { @@ -53,7 +53,7 @@ public class MessengerWebhook { } throw new HttpForbiddenException(); } - @RequestMapping(value = "/fbwbhk", method = RequestMethod.POST) + @RequestMapping(value = "/api/fbwbhk", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) public void processUpdate(@RequestHeader(name = "X-Hub-Signature", required = false) String signature, InputStream body) throws IOException, MessengerVerificationException { String data = IOUtils.toString(body, StandardCharsets.UTF_8); diff --git a/juick-server/src/main/java/com/juick/server/api/webhooks/SkypeWebhook.java b/juick-server/src/main/java/com/juick/server/api/webhooks/SkypeWebhook.java index 425a9d10..d7dbe0ef 100644 --- a/juick-server/src/main/java/com/juick/server/api/webhooks/SkypeWebhook.java +++ b/juick-server/src/main/java/com/juick/server/api/webhooks/SkypeWebhook.java @@ -38,7 +38,7 @@ import java.nio.charset.StandardCharsets; @RestController public class SkypeWebhook { private static final Logger logger = LoggerFactory.getLogger(SkypeWebhook.class); - @RequestMapping(value = "/skypebotendpoint", method = RequestMethod.POST) + @RequestMapping(value = "/api/skypebotendpoint", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) public void doPost(InputStream body) throws IOException { String data = IOUtils.toString(body, StandardCharsets.UTF_8); diff --git a/juick-server/src/main/java/com/juick/server/api/webhooks/TelegramWebhook.java b/juick-server/src/main/java/com/juick/server/api/webhooks/TelegramWebhook.java index a8ffd6d1..7a5cebda 100644 --- a/juick-server/src/main/java/com/juick/server/api/webhooks/TelegramWebhook.java +++ b/juick-server/src/main/java/com/juick/server/api/webhooks/TelegramWebhook.java @@ -46,7 +46,7 @@ public class TelegramWebhook { @Inject private TelegramBotManager telegramBotManager; - @RequestMapping(value = "/tlgmbtwbhk", method = RequestMethod.POST) + @RequestMapping(value = "/api/tlgmbtwbhk", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) public void processUpdate(InputStream body) throws Exception { String data = IOUtils.toString(body, StandardCharsets.UTF_8); diff --git a/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java b/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java index 001f72fe..d9c59aa2 100644 --- a/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java +++ b/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java @@ -26,6 +26,7 @@ import com.juick.server.xmpp.iq.MessageQuery; import com.juick.server.xmpp.s2s.BasicXmppSession; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.*; +import org.springframework.core.Ordered; import org.springframework.core.convert.ConversionService; import org.springframework.format.support.DefaultFormattingConversionService; import org.springframework.scheduling.annotation.EnableAsync; @@ -34,6 +35,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.view.BeanNameViewResolver; import org.springframework.web.servlet.view.feed.AbstractRssFeedView; import org.springframework.web.socket.config.annotation.EnableWebSocket; +import org.springframework.web.socket.config.annotation.ServletWebSocketHandlerRegistry; import org.springframework.web.socket.config.annotation.WebSocketConfigurer; import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean; diff --git a/juick-server/src/main/java/com/juick/server/configuration/SecurityConfig.java b/juick-server/src/main/java/com/juick/server/configuration/SecurityConfig.java index cd2ab13a..676de56b 100644 --- a/juick-server/src/main/java/com/juick/server/configuration/SecurityConfig.java +++ b/juick-server/src/main/java/com/juick/server/configuration/SecurityConfig.java @@ -95,8 +95,6 @@ public class SecurityConfig { private String webDomain; @Resource private UserService userService; - @Inject - private HashParamAuthenticationFilter hashParamAuthenticationFilter; ApiConfig() { super(true); } @@ -107,7 +105,6 @@ public class SecurityConfig { @Override protected void configure(HttpSecurity http) throws Exception { - http.addFilterAfter(hashParamAuthenticationFilter, BasicAuthenticationFilter.class); http.antMatcher("/api/**").authorizeRequests() .antMatchers(HttpMethod.OPTIONS).permitAll() .antMatchers("/api/", "/api/messages", "/api/users", "/api/thread", "/api/tags", "/api/tlgmbtwbhk", "/api/fbwbhk", @@ -152,7 +149,7 @@ public class SecurityConfig { public void configure(WebSecurity web) { web.debug(false); web.ignoring().antMatchers("/api/v2/api-docs", "/api/configuration/ui", "/api/swagger-resources/**", - "/api/configuration/**", "/swagger-ui.html", "/webjars/**", "/ws/**", "/rss/**", "/h2-console/**"); + "/api/configuration/**", "/swagger-ui.html", "/webjars/**", "/h2-console/**"); } } @@ -203,7 +200,7 @@ public class SecurityConfig { @Override public void configure(WebSecurity web) throws Exception { web.debug(false); - web.ignoring().antMatchers("/style.css*", "/scripts.js*", "/h2-console/**", "/.well-known/**"); + web.ignoring().antMatchers("/style.css*", "/scripts.js*", "/h2-console/**", "/.well-known/**", "/ws/**", "/rss/**"); } } } diff --git a/juick-server/src/main/java/com/juick/server/www/controllers/AnythingFilter.java b/juick-server/src/main/java/com/juick/server/www/controllers/AnythingFilter.java index 9ab20003..4bdbf298 100644 --- a/juick-server/src/main/java/com/juick/server/www/controllers/AnythingFilter.java +++ b/juick-server/src/main/java/com/juick/server/www/controllers/AnythingFilter.java @@ -27,6 +27,10 @@ public class AnythingFilter extends OncePerRequestFilter { public void doFilterInternal(@Nonnull HttpServletRequest servletRequest, @Nonnull HttpServletResponse servletResponse, @Nonnull FilterChain filterChain) throws IOException, ServletException { + String upgrade = servletRequest.getHeader("Connection"); + if (upgrade != null && upgrade.equals("Upgrade")) { + filterChain.doFilter(servletRequest, servletResponse); + } UriComponents components = ServletUriComponentsBuilder.fromCurrentRequestUri().build(); String anything = components.getPath().substring(1); int before = NumberUtils.toInt(components.getQueryParams().getFirst("before"), 0); diff --git a/juick-server/src/main/java/com/juick/server/www/controllers/MessagesWWW.java b/juick-server/src/main/java/com/juick/server/www/controllers/MessagesWWW.java index 10136fcf..de50849d 100644 --- a/juick-server/src/main/java/com/juick/server/www/controllers/MessagesWWW.java +++ b/juick-server/src/main/java/com/juick/server/www/controllers/MessagesWWW.java @@ -73,7 +73,7 @@ public class MessagesWWW { model.addAttribute("isSubscribed", userService.isSubscribed(visitor.getUid(), user.getUid())); model.addAttribute("isInBL", userService.isInBL(visitor.getUid(), user.getUid())); model.addAttribute("isInBLAny", userService.isInBLAny(user.getUid(), visitor.getUid())); - model.addAttribute("statsIRead", userService.getUserFriends(user.getUid())); + model.addAttribute("statsIRead", userService.getUserFriends(user.getUid()).size()); model.addAttribute("statsMyReaders", userService.getStatsMyReaders(user.getUid())); model.addAttribute("statsMyBL", userService.getUserBLUsers(user.getUid()).size()); model.addAttribute("statsMessages", userService.getStatsMessages(user.getUid())); @@ -192,7 +192,7 @@ public class MessagesWWW { return "views/index"; } - @GetMapping("/{uname}/") + @GetMapping(path = "/{uname}/", headers = "Connection!=Upgrade") protected String doGetBlog( @RequestParam(required = false, name = "show") String paramShow, @RequestParam(required = false, name = "tag") String paramTagStr, |