aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-02-08 22:06:08 +0300
committerGravatar Vitaly Takmazov2018-02-08 22:06:08 +0300
commit7414f1034d32c249294a081f1e176a9266fc92ac (patch)
treec780ea6f8a4a4d4db22147b1eea151317765abce /juick-server/src
parentc97d1475dc0faa0e791257ca6c6a8561df2ffa90 (diff)
reorganize project structure
Diffstat (limited to 'juick-server/src')
-rw-r--r--juick-server/src/main/java/com/juick/api/configuration/ApiSecurityInitializer.java37
-rw-r--r--juick-server/src/main/java/com/juick/api/controllers/Others.java66
-rw-r--r--juick-server/src/main/java/com/juick/server/CrosspostManager.java (renamed from juick-server/src/main/java/com/juick/api/CrosspostManager.java)2
-rw-r--r--juick-server/src/main/java/com/juick/server/EmailManager.java (renamed from juick-server/src/main/java/com/juick/api/EmailManager.java)2
-rw-r--r--juick-server/src/main/java/com/juick/server/FacebookPageManager.java (renamed from juick-server/src/main/java/com/juick/api/FacebookPageManager.java)2
-rw-r--r--juick-server/src/main/java/com/juick/server/MessengerManager.java (renamed from juick-server/src/main/java/com/juick/api/MessengerManager.java)6
-rw-r--r--juick-server/src/main/java/com/juick/server/ServerManager.java (renamed from juick-server/src/main/java/com/juick/api/ApiServer.java)13
-rw-r--r--juick-server/src/main/java/com/juick/server/TelegramBotManager.java (renamed from juick-server/src/main/java/com/juick/api/TelegramBotManager.java)8
-rw-r--r--juick-server/src/main/java/com/juick/server/TopManager.java (renamed from juick-server/src/main/java/com/juick/api/TopManager.java)2
-rw-r--r--juick-server/src/main/java/com/juick/server/WebsocketManager.java (renamed from juick-server/src/main/java/com/juick/api/WebsocketManager.java)2
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Index.java (renamed from juick-server/src/main/java/com/juick/api/controllers/ApiController.java)6
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Messages.java (renamed from juick-server/src/main/java/com/juick/api/controllers/Messages.java)3
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Notifications.java (renamed from juick-server/src/main/java/com/juick/api/controllers/Notifications.java)2
-rw-r--r--juick-server/src/main/java/com/juick/server/api/PM.java (renamed from juick-server/src/main/java/com/juick/api/controllers/PM.java)41
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Post.java (renamed from juick-server/src/main/java/com/juick/api/controllers/Post.java)20
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Service.java (renamed from juick-server/src/main/java/com/juick/api/controllers/Service.java)2
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Tags.java (renamed from juick-server/src/main/java/com/juick/api/controllers/Tags.java)2
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Users.java (renamed from juick-server/src/main/java/com/juick/api/controllers/Users.java)2
-rw-r--r--juick-server/src/main/java/com/juick/server/api/webhooks/MessengerWebhook.java (renamed from juick-server/src/main/java/com/juick/api/controllers/MessengerWebhook.java)4
-rw-r--r--juick-server/src/main/java/com/juick/server/api/webhooks/SkypeWebhook.java (renamed from juick-server/src/main/java/com/juick/api/controllers/SkypeEndpoint.java)6
-rw-r--r--juick-server/src/main/java/com/juick/server/api/webhooks/TelegramWebhook.java (renamed from juick-server/src/main/java/com/juick/api/controllers/TelegramWebhook.java)4
-rw-r--r--juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java (renamed from juick-server/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java)15
-rw-r--r--juick-server/src/main/java/com/juick/server/configuration/ApiInitializer.java (renamed from juick-server/src/main/java/com/juick/api/configuration/ApiInitializer.java)2
-rw-r--r--juick-server/src/main/java/com/juick/server/configuration/ApiSecurityConfig.java (renamed from juick-server/src/main/java/com/juick/api/configuration/ApiSecurityConfig.java)2
-rw-r--r--juick-server/src/main/java/com/juick/server/util/JsonpAdvice.java (renamed from juick-server/src/main/java/com/juick/api/controllers/util/JsonpAdvice.java)2
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/MessagesTests.java (renamed from juick-server/src/test/java/com/juick/api/tests/MessagesTests.java)8
26 files changed, 86 insertions, 175 deletions
diff --git a/juick-server/src/main/java/com/juick/api/configuration/ApiSecurityInitializer.java b/juick-server/src/main/java/com/juick/api/configuration/ApiSecurityInitializer.java
deleted file mode 100644
index 259315fb..00000000
--- a/juick-server/src/main/java/com/juick/api/configuration/ApiSecurityInitializer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2008-2017, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package com.juick.api.configuration;
-
-/**
- * Created by vitalyster on 25.11.2016.
- */
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
-
-import javax.servlet.ServletContext;
-
-public class ApiSecurityInitializer extends AbstractSecurityWebApplicationInitializer {
- private final Logger logger = LoggerFactory.getLogger(getClass());
-
- @Override
- protected void afterSpringSecurityFilterChain(ServletContext servletContext) {
- logger.info("SpringSecurityFilterChain initialized");
- }
-}
diff --git a/juick-server/src/main/java/com/juick/api/controllers/Others.java b/juick-server/src/main/java/com/juick/api/controllers/Others.java
deleted file mode 100644
index 4245de81..00000000
--- a/juick-server/src/main/java/com/juick/api/controllers/Others.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2008-2017, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package com.juick.api.controllers;
-
-import com.juick.User;
-import com.juick.server.helpers.PrivateChats;
-import com.juick.server.util.HttpForbiddenException;
-import com.juick.server.util.HttpNotFoundException;
-import com.juick.server.util.UserUtils;
-import com.juick.service.PMQueriesService;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.inject.Inject;
-import java.util.List;
-
-/**
- * @author ugnich
- */
-@RestController
-public class Others {
- @Inject
- private PMQueriesService pmQueriesService;
-
- @RequestMapping(value = "groups_pms", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
- public PrivateChats doGetGroupsPMs(
- @RequestParam(defaultValue = "5") int cnt) {
- User visitor = UserUtils.getCurrentUser();
- int vuid = visitor.getUid();
- if (vuid == 0) {
- throw new HttpForbiddenException();
- }
- if (cnt < 3) {
- cnt = 3;
- }
- if (cnt > 10) {
- cnt = 10;
- }
-
- List<User> lastconv = pmQueriesService.getPMLastConversationsUsers(vuid, cnt);
- if (lastconv != null && !lastconv.isEmpty()) {
- PrivateChats pms = new PrivateChats();
- pms.setUsers(lastconv);
- return pms;
- }
- throw new HttpNotFoundException();
- }
-}
diff --git a/juick-server/src/main/java/com/juick/api/CrosspostManager.java b/juick-server/src/main/java/com/juick/server/CrosspostManager.java
index a601d7b7..edffaf71 100644
--- a/juick-server/src/main/java/com/juick/api/CrosspostManager.java
+++ b/juick-server/src/main/java/com/juick/server/CrosspostManager.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api;
+package com.juick.server;
import com.juick.Message;
import com.juick.server.component.MessageEvent;
diff --git a/juick-server/src/main/java/com/juick/api/EmailManager.java b/juick-server/src/main/java/com/juick/server/EmailManager.java
index fa86b406..4c9bf3da 100644
--- a/juick-server/src/main/java/com/juick/api/EmailManager.java
+++ b/juick-server/src/main/java/com/juick/server/EmailManager.java
@@ -1,4 +1,4 @@
-package com.juick.api;
+package com.juick.server;
import com.juick.Message;
import com.juick.server.component.MessageEvent;
diff --git a/juick-server/src/main/java/com/juick/api/FacebookPageManager.java b/juick-server/src/main/java/com/juick/server/FacebookPageManager.java
index e9ed0e59..971b206c 100644
--- a/juick-server/src/main/java/com/juick/api/FacebookPageManager.java
+++ b/juick-server/src/main/java/com/juick/server/FacebookPageManager.java
@@ -1,4 +1,4 @@
-package com.juick.api;
+package com.juick.server;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/juick-server/src/main/java/com/juick/api/MessengerManager.java b/juick-server/src/main/java/com/juick/server/MessengerManager.java
index 7341b946..2979fa28 100644
--- a/juick-server/src/main/java/com/juick/api/MessengerManager.java
+++ b/juick-server/src/main/java/com/juick/server/MessengerManager.java
@@ -1,4 +1,4 @@
-package com.juick.api;
+package com.juick.server;
import com.github.messenger4j.Messenger;
import com.github.messenger4j.exception.MessengerApiException;
@@ -49,7 +49,7 @@ public class MessengerManager implements ApplicationListener<MessageEvent> {
@Inject
private MessengerService messengerService;
@Inject
- private ApiServer apiServer;
+ private ServerManager serverManager;
@Value("${fb_page_access_token:12345678}")
private String facebookPageAccessToken;
@@ -95,7 +95,7 @@ public class MessengerManager implements ApplicationListener<MessageEvent> {
final String text = textMessageEvent.text();
logger.info("Received text message from '{}' at '{}' with content: {} (mid: {})",
senderId, timestamp, text, messageId);
- apiServer.processMessage(user_from, text, null);
+ serverManager.processMessage(user_from, text, null);
messengerNotify(senderId, "Message sent", null);
}
}
diff --git a/juick-server/src/main/java/com/juick/api/ApiServer.java b/juick-server/src/main/java/com/juick/server/ServerManager.java
index 51097440..79ccb1e4 100644
--- a/juick-server/src/main/java/com/juick/api/ApiServer.java
+++ b/juick-server/src/main/java/com/juick/server/ServerManager.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api;
+package com.juick.server;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -26,12 +26,12 @@ import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
import org.springframework.web.socket.TextMessage;
import rocks.xmpp.addr.Jid;
import rocks.xmpp.core.XmppException;
import rocks.xmpp.core.session.Extension;
import rocks.xmpp.core.session.XmppSessionConfiguration;
-import rocks.xmpp.core.session.debug.LogbackDebugger;
import rocks.xmpp.core.stanza.model.Message;
import rocks.xmpp.extensions.component.accept.ExternalComponent;
import rocks.xmpp.extensions.oob.model.x.OobX;
@@ -52,8 +52,9 @@ import java.util.stream.Collectors;
/**
* @author Ugnich Anton
*/
-public class ApiServer implements AutoCloseable {
- private static Logger logger = LoggerFactory.getLogger(ApiServer.class);
+@Component
+public class ServerManager implements AutoCloseable {
+ private static Logger logger = LoggerFactory.getLogger(ServerManager.class);
private ExternalComponent xmpp;
@@ -93,9 +94,9 @@ public class ApiServer implements AutoCloseable {
if (xmpp != null)
xmpp.close();
- logger.info("ExternalComponent on juick-api destroyed");
+ logger.info("ExternalComponent on juick-server destroyed");
} catch (Exception e) {
- logger.warn("Exception occurs on juick-api destroy", e);
+ logger.warn("Exception occurs on juick-server destroy", e);
}
}
diff --git a/juick-server/src/main/java/com/juick/api/TelegramBotManager.java b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
index 6f2e50d1..564a2255 100644
--- a/juick-server/src/main/java/com/juick/api/TelegramBotManager.java
+++ b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api;
+package com.juick.server;
import com.juick.User;
import com.juick.server.component.MessageEvent;
@@ -79,7 +79,7 @@ public class TelegramBotManager implements ApplicationListener<MessageEvent> {
@Inject
private UserService userService;
@Inject
- private ApiServer apiServer;
+ private ServerManager serverManager;
@Value("${upload_tmp_dir:/var/www/juick.com/i/tmp/}")
private String tmpDir;
@@ -179,7 +179,7 @@ public class TelegramBotManager implements ApplicationListener<MessageEvent> {
int rid = Integer.valueOf(uriComponents.getFragment());
prefix = String.format("#%d/%d ", mid, rid);
}
- apiServer.processMessage(user_from, prefix + text, attachment);
+ serverManager.processMessage(user_from, prefix + text, attachment);
telegramNotify(message.from().id().longValue(), "Reply sent");
} else {
logger.warn("invalid path: {}", path);
@@ -196,7 +196,7 @@ public class TelegramBotManager implements ApplicationListener<MessageEvent> {
"Can not reply to this message", replyMessage.messageId());
}
} else {
- apiServer.processMessage(user_from, text, attachment);
+ serverManager.processMessage(user_from, text, attachment);
telegramNotify(message.from().id().longValue(), "Message sent");
}
}
diff --git a/juick-server/src/main/java/com/juick/api/TopManager.java b/juick-server/src/main/java/com/juick/server/TopManager.java
index b8123639..77518d37 100644
--- a/juick-server/src/main/java/com/juick/api/TopManager.java
+++ b/juick-server/src/main/java/com/juick/server/TopManager.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api;
+package com.juick.server;
import com.juick.Message;
import com.juick.service.MessagesService;
diff --git a/juick-server/src/main/java/com/juick/api/WebsocketManager.java b/juick-server/src/main/java/com/juick/server/WebsocketManager.java
index 2ed70b3c..6e3fbea2 100644
--- a/juick-server/src/main/java/com/juick/api/WebsocketManager.java
+++ b/juick-server/src/main/java/com/juick/server/WebsocketManager.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api;
+package com.juick.server;
import com.juick.User;
import com.juick.server.helpers.AnonymousUser;
diff --git a/juick-server/src/main/java/com/juick/api/controllers/ApiController.java b/juick-server/src/main/java/com/juick/server/api/Index.java
index 0929d1ea..dba8357d 100644
--- a/juick-server/src/main/java/com/juick/api/controllers/ApiController.java
+++ b/juick-server/src/main/java/com/juick/server/api/Index.java
@@ -15,10 +15,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.controllers;
+package com.juick.server.api;
import com.juick.Status;
-import com.juick.api.WebsocketManager;
+import com.juick.server.WebsocketManager;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -36,7 +36,7 @@ import java.net.URI;
*/
@ApiIgnore
@RestController
-public class ApiController {
+public class Index {
@Inject
private WebsocketManager wsHandler;
diff --git a/juick-server/src/main/java/com/juick/api/controllers/Messages.java b/juick-server/src/main/java/com/juick/server/api/Messages.java
index e16e46d5..21156d79 100644
--- a/juick-server/src/main/java/com/juick/api/controllers/Messages.java
+++ b/juick-server/src/main/java/com/juick/server/api/Messages.java
@@ -15,12 +15,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.controllers;
+package com.juick.server.api;
import com.juick.Status;
import com.juick.Tag;
import com.juick.User;
-import com.juick.server.util.HttpBadRequestException;
import com.juick.server.util.HttpForbiddenException;
import com.juick.server.util.UserUtils;
import com.juick.service.MessagesService;
diff --git a/juick-server/src/main/java/com/juick/api/controllers/Notifications.java b/juick-server/src/main/java/com/juick/server/api/Notifications.java
index e4474e6e..5f849080 100644
--- a/juick-server/src/main/java/com/juick/api/controllers/Notifications.java
+++ b/juick-server/src/main/java/com/juick/server/api/Notifications.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.controllers;
+package com.juick.server.api;
import com.juick.Message;
import com.juick.Status;
diff --git a/juick-server/src/main/java/com/juick/api/controllers/PM.java b/juick-server/src/main/java/com/juick/server/api/PM.java
index 87858e8c..4c3128ed 100644
--- a/juick-server/src/main/java/com/juick/api/controllers/PM.java
+++ b/juick-server/src/main/java/com/juick/server/api/PM.java
@@ -15,17 +15,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.controllers;
+package com.juick.server.api;
import com.juick.User;
-import com.juick.api.ApiServer;
+import com.juick.server.ServerManager;
import com.juick.server.helpers.AnonymousUser;
-import com.juick.server.util.HttpBadRequestException;
-import com.juick.server.util.HttpForbiddenException;
+import com.juick.server.helpers.PrivateChats;
+import com.juick.server.util.*;
import com.juick.service.PMQueriesService;
import com.juick.service.UserService;
-import com.juick.server.util.UserUtils;
-import com.juick.server.util.WebUtils;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -47,7 +45,7 @@ public class PM {
@Inject
private PMQueriesService pmQueriesService;
@Inject
- private ApiServer apiServer;
+ private ServerManager serverManager;
@RequestMapping(value = "/pm", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public List<com.juick.Message> doGetPM(
@@ -100,10 +98,10 @@ public class PM {
jmsg.setText(body);
jmsg.setTo(userTo);
msg.addExtension(jmsg);
- apiServer.sendMessage(msg);
+ serverManager.sendMessage(msg);
msg.setTo(Jid.of(String.format("%d@ws.juick.com", userTo.getUid())));
- apiServer.sendMessage(msg);
+ serverManager.sendMessage(msg);
List<String> jids = userService.getJIDsbyUID(userTo.getUid());
for (String jid : jids) {
@@ -117,11 +115,34 @@ public class PM {
mm.setFrom(Jid.of("juick", "juick.com", "Juick"));
mm.setBody("Private message from @" + jmsg.getUser().getName() + ":\n" + body);
}
- apiServer.sendMessage(mm);
+ serverManager.sendMessage(mm);
}
return jmsg;
}
throw new HttpBadRequestException();
}
+ @RequestMapping(value = "groups_pms", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ public PrivateChats doGetGroupsPMs(
+ @RequestParam(defaultValue = "5") int cnt) {
+ User visitor = UserUtils.getCurrentUser();
+ int vuid = visitor.getUid();
+ if (vuid == 0) {
+ throw new HttpForbiddenException();
+ }
+ if (cnt < 3) {
+ cnt = 3;
+ }
+ if (cnt > 10) {
+ cnt = 10;
+ }
+
+ List<User> lastconv = pmQueriesService.getPMLastConversationsUsers(vuid, cnt);
+ if (lastconv != null && !lastconv.isEmpty()) {
+ PrivateChats pms = new PrivateChats();
+ pms.setUsers(lastconv);
+ return pms;
+ }
+ throw new HttpNotFoundException();
+ }
}
diff --git a/juick-server/src/main/java/com/juick/api/controllers/Post.java b/juick-server/src/main/java/com/juick/server/api/Post.java
index a89786b1..7f014d9e 100644
--- a/juick-server/src/main/java/com/juick/api/controllers/Post.java
+++ b/juick-server/src/main/java/com/juick/server/api/Post.java
@@ -15,11 +15,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.controllers;
+package com.juick.server.api;
import com.juick.User;
-import com.juick.api.ApiServer;
-import com.juick.api.EmailManager;
+import com.juick.server.ServerManager;
+import com.juick.server.EmailManager;
import com.juick.server.util.*;
import com.juick.service.MessagesService;
import com.juick.service.SubscriptionService;
@@ -61,12 +61,12 @@ import java.util.UUID;
*/
@RestController
public class Post {
- private static Logger logger = LoggerFactory.getLogger(ApiServer.class);
+ private static Logger logger = LoggerFactory.getLogger(ServerManager.class);
@Inject
private UserService userService;
@Inject
- private ApiServer apiServer;
+ private ServerManager serverManager;
@Inject
private MessagesService messagesService;
@Inject
@@ -103,7 +103,7 @@ public class Post {
throw new HttpBadRequestException();
}
}
- apiServer.processMessage(visitor, body, attachmentFName);
+ serverManager.processMessage(visitor, body, attachmentFName);
}
@RequestMapping(value = "/comment", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@@ -193,13 +193,13 @@ public class Post {
mid + "/" + ridnew + " http://juick.com/" + mid + "#" + ridnew);
xmsg.setTo(Jid.of("juick@s2s.juick.com"));
- apiServer.sendMessage(xmsg);
+ serverManager.sendMessage(xmsg);
xmsg.setTo(Jid.of("juick@ws.juick.com"));
- apiServer.sendMessage(xmsg);
+ serverManager.sendMessage(xmsg);
xmsg.setTo(Jid.of("juick@push.juick.com"));
- apiServer.sendMessage(xmsg);
+ serverManager.sendMessage(xmsg);
return jmsg;
}
@@ -270,7 +270,7 @@ public class Post {
String attachmentUrl = String.format("juick://%s", attachmentFName[0]);
xmsg.addExtension(new OobX(new URI(attachmentUrl), "!!!!Juick!!"));
}
- apiServer.sendMessage(xmsg);
+ serverManager.sendMessage(xmsg);
} catch (URISyntaxException e1) {
logger.warn("attachment error", e1);
}
diff --git a/juick-server/src/main/java/com/juick/api/controllers/Service.java b/juick-server/src/main/java/com/juick/server/api/Service.java
index 9e7f3333..12ffee9c 100644
--- a/juick-server/src/main/java/com/juick/api/controllers/Service.java
+++ b/juick-server/src/main/java/com/juick/server/api/Service.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.controllers;
+package com.juick.server.api;
import com.juick.Message;
import com.juick.User;
diff --git a/juick-server/src/main/java/com/juick/api/controllers/Tags.java b/juick-server/src/main/java/com/juick/server/api/Tags.java
index 85bb1ba4..8ced4ec9 100644
--- a/juick-server/src/main/java/com/juick/api/controllers/Tags.java
+++ b/juick-server/src/main/java/com/juick/server/api/Tags.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.controllers;
+package com.juick.server.api;
import com.juick.User;
import com.juick.server.helpers.TagStats;
diff --git a/juick-server/src/main/java/com/juick/api/controllers/Users.java b/juick-server/src/main/java/com/juick/server/api/Users.java
index b221d9fe..8b273354 100644
--- a/juick-server/src/main/java/com/juick/api/controllers/Users.java
+++ b/juick-server/src/main/java/com/juick/server/api/Users.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.controllers;
+package com.juick.server.api;
import com.juick.User;
import com.juick.server.util.HttpForbiddenException;
diff --git a/juick-server/src/main/java/com/juick/api/controllers/MessengerWebhook.java b/juick-server/src/main/java/com/juick/server/api/webhooks/MessengerWebhook.java
index 835165ba..e746b67d 100644
--- a/juick-server/src/main/java/com/juick/api/controllers/MessengerWebhook.java
+++ b/juick-server/src/main/java/com/juick/server/api/webhooks/MessengerWebhook.java
@@ -15,10 +15,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.controllers;
+package com.juick.server.api.webhooks;
import com.github.messenger4j.exception.MessengerVerificationException;
-import com.juick.api.MessengerManager;
+import com.juick.server.MessengerManager;
import com.juick.server.util.HttpForbiddenException;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
diff --git a/juick-server/src/main/java/com/juick/api/controllers/SkypeEndpoint.java b/juick-server/src/main/java/com/juick/server/api/webhooks/SkypeWebhook.java
index 91a617b4..425a9d10 100644
--- a/juick-server/src/main/java/com/juick/api/controllers/SkypeEndpoint.java
+++ b/juick-server/src/main/java/com/juick/server/api/webhooks/SkypeWebhook.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.controllers;
+package com.juick.server.api.webhooks;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
@@ -36,8 +36,8 @@ import java.nio.charset.StandardCharsets;
*/
@ApiIgnore
@RestController
-public class SkypeEndpoint {
- private static final Logger logger = LoggerFactory.getLogger(SkypeEndpoint.class);
+public class SkypeWebhook {
+ private static final Logger logger = LoggerFactory.getLogger(SkypeWebhook.class);
@RequestMapping(value = "/skypebotendpoint", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.OK)
public void doPost(InputStream body) throws IOException {
diff --git a/juick-server/src/main/java/com/juick/api/controllers/TelegramWebhook.java b/juick-server/src/main/java/com/juick/server/api/webhooks/TelegramWebhook.java
index 31e7b4ea..9c4f64ce 100644
--- a/juick-server/src/main/java/com/juick/api/controllers/TelegramWebhook.java
+++ b/juick-server/src/main/java/com/juick/server/api/webhooks/TelegramWebhook.java
@@ -15,9 +15,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.controllers;
+package com.juick.server.api.webhooks;
-import com.juick.api.TelegramBotManager;
+import com.juick.server.TelegramBotManager;
import org.apache.commons.io.IOUtils;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
diff --git a/juick-server/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java b/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java
index ea59ac52..3839248d 100644
--- a/juick-server/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java
+++ b/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java
@@ -15,17 +15,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.configuration;
+package com.juick.server.configuration;
-import com.juick.api.ApiServer;
-import com.juick.api.WebsocketManager;
+import com.juick.server.ServerManager;
+import com.juick.server.WebsocketManager;
import com.juick.server.component.JuickServerComponent;
import com.juick.server.component.JuickServerReconnectManager;
-import com.juick.server.configuration.BaseWebConfiguration;
import com.juick.service.UserService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.*;
-import org.springframework.core.Ordered;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
@@ -34,7 +32,6 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
import org.springframework.web.socket.client.WebSocketConnectionManager;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
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;
@@ -60,7 +57,7 @@ import java.util.Collections;
@EnableScheduling
@EnableWebSocket
@PropertySource("classpath:juick.conf")
-@ComponentScan(basePackages = "com.juick")
+@ComponentScan(basePackages = "com.juick.server")
public class ApiAppConfiguration extends BaseWebConfiguration implements WebSocketConfigurer {
@Inject
UserService userService;
@@ -89,10 +86,6 @@ public class ApiAppConfiguration extends BaseWebConfiguration implements WebSock
return new StandardWebSocketClient();
}
@Bean
- public ApiServer apiServer() {
- return new ApiServer();
- }
- @Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
diff --git a/juick-server/src/main/java/com/juick/api/configuration/ApiInitializer.java b/juick-server/src/main/java/com/juick/server/configuration/ApiInitializer.java
index 8f35e3f7..b25edd9a 100644
--- a/juick-server/src/main/java/com/juick/api/configuration/ApiInitializer.java
+++ b/juick-server/src/main/java/com/juick/server/configuration/ApiInitializer.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.configuration;
+package com.juick.server.configuration;
import com.juick.configuration.DataConfiguration;
import com.juick.server.configuration.JuickServerWebsocketConfiguration;
diff --git a/juick-server/src/main/java/com/juick/api/configuration/ApiSecurityConfig.java b/juick-server/src/main/java/com/juick/server/configuration/ApiSecurityConfig.java
index 2ae1d9e5..4f7045a6 100644
--- a/juick-server/src/main/java/com/juick/api/configuration/ApiSecurityConfig.java
+++ b/juick-server/src/main/java/com/juick/server/configuration/ApiSecurityConfig.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.configuration;
+package com.juick.server.configuration;
import com.juick.service.UserService;
import com.juick.service.security.JuickUserDetailsService;
diff --git a/juick-server/src/main/java/com/juick/api/controllers/util/JsonpAdvice.java b/juick-server/src/main/java/com/juick/server/util/JsonpAdvice.java
index 90a01da0..457a7df7 100644
--- a/juick-server/src/main/java/com/juick/api/controllers/util/JsonpAdvice.java
+++ b/juick-server/src/main/java/com/juick/server/util/JsonpAdvice.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.controllers.util;
+package com.juick.server.util;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.AbstractJsonpResponseBodyAdvice;
diff --git a/juick-server/src/test/java/com/juick/api/tests/MessagesTests.java b/juick-server/src/test/java/com/juick/server/tests/MessagesTests.java
index fff7e02c..53267a0f 100644
--- a/juick-server/src/test/java/com/juick/api/tests/MessagesTests.java
+++ b/juick-server/src/test/java/com/juick/server/tests/MessagesTests.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.api.tests;
+package com.juick.server.tests;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -23,9 +23,9 @@ import com.juick.ExternalToken;
import com.juick.Message;
import com.juick.Tag;
import com.juick.User;
-import com.juick.api.EmailManager;
-import com.juick.api.configuration.ApiAppConfiguration;
-import com.juick.api.configuration.ApiSecurityConfig;
+import com.juick.server.EmailManager;
+import com.juick.server.configuration.ApiAppConfiguration;
+import com.juick.server.configuration.ApiSecurityConfig;
import com.juick.configuration.RepositoryConfiguration;
import com.juick.server.helpers.TagStats;
import com.juick.service.ImagesService;