diff options
Diffstat (limited to 'src/main/java/com/juick/server')
-rw-r--r-- | src/main/java/com/juick/server/ServerManager.java | 2 | ||||
-rw-r--r-- | src/main/java/com/juick/server/api/Service.java | 25 |
2 files changed, 1 insertions, 26 deletions
diff --git a/src/main/java/com/juick/server/ServerManager.java b/src/main/java/com/juick/server/ServerManager.java index a226bf29..5b859125 100644 --- a/src/main/java/com/juick/server/ServerManager.java +++ b/src/main/java/com/juick/server/ServerManager.java @@ -112,7 +112,7 @@ public class ServerManager implements NotificationListener { } messageEvent(jmsg, Collections.singletonList(serviceUser)); try { - emailManager.sendEmail("noreply@juick.com", serviceEmail, "New event", jsonMapper.writeValueAsString(event), null, Collections.emptyMap()); + emailManager.sendEmail("noreply@juick.com", serviceEmail, "New message", jsonMapper.writeValueAsString(jmsg), null, Collections.emptyMap()); } catch (JsonProcessingException e) { logger.warn("JSON exception", e); } diff --git a/src/main/java/com/juick/server/api/Service.java b/src/main/java/com/juick/server/api/Service.java index b1a9e73d..f137f2f7 100644 --- a/src/main/java/com/juick/server/api/Service.java +++ b/src/main/java/com/juick/server/api/Service.java @@ -159,31 +159,6 @@ public class Service { throw new HttpForbiddenException(); } } - @ApiIgnore - @PostMapping("/api/new_event") - @ResponseStatus(value = HttpStatus.OK) - public void processEvent(@Visitor User current, InputStream data) throws Exception { - if (current.getName().equals(serviceUser)) { - MimeMessage msg = new MimeMessage(session, data); - MimeMessageParser parser = new MimeMessageParser(msg); - parser.parse(); - final String[] body = { parser.getPlainContent() }; - if (body[0] == null) { - parser.getAttachmentList().stream() - .filter(a -> a.getContentType().equals("text/plain")).findFirst() - .ifPresent(a -> { - try { - body[0] = IOUtils.toString(a.getInputStream(), StandardCharsets.UTF_8); - } catch (IOException e) { - logger.info("attachment error", e); - } - }); - } - logger.info("got text event: {}", body[0]); - } else { - throw new HttpForbiddenException(); - } - } private void endSession(SseEmitter emitter) { serverManager.getSessions().stream() .filter(s -> s.getEmitter().equals(emitter)) |