aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/server')
-rw-r--r--src/main/java/com/juick/server/ActivityPubManager.java9
-rw-r--r--src/main/java/com/juick/server/CommandsManager.java16
-rw-r--r--src/main/java/com/juick/server/EmailManager.java6
-rw-r--r--src/main/java/com/juick/server/ServerManager.java12
-rw-r--r--src/main/java/com/juick/server/SignatureManager.java2
-rw-r--r--src/main/java/com/juick/server/TelegramBotManager.java40
-rw-r--r--src/main/java/com/juick/server/TopManager.java6
-rw-r--r--src/main/java/com/juick/server/TwitterManager.java8
-rw-r--r--src/main/java/com/juick/server/XMPPManager.java20
-rw-r--r--src/main/java/com/juick/server/api/ApiSocialLogin.java15
-rw-r--r--src/main/java/com/juick/server/api/Messages.java18
-rw-r--r--src/main/java/com/juick/server/api/Notifications.java8
-rw-r--r--src/main/java/com/juick/server/api/PM.java12
-rw-r--r--src/main/java/com/juick/server/api/Post.java16
-rw-r--r--src/main/java/com/juick/server/api/Service.java4
-rw-r--r--src/main/java/com/juick/server/api/SystemActivity.java4
-rw-r--r--src/main/java/com/juick/server/api/Tags.java2
-rw-r--r--src/main/java/com/juick/server/api/Users.java8
-rw-r--r--src/main/java/com/juick/server/api/activity/Profile.java4
-rw-r--r--src/main/java/com/juick/server/api/rss/Feeds.java2
-rw-r--r--src/main/java/com/juick/server/api/rss/MessagesView.java4
-rw-r--r--src/main/java/com/juick/server/api/webfinger/Resource.java2
-rw-r--r--src/main/java/com/juick/server/util/ImageUtils.java2
-rw-r--r--src/main/java/com/juick/server/util/TagUtils.java2
-rw-r--r--src/main/java/com/juick/server/www/WebApp.java4
-rw-r--r--src/main/java/com/juick/server/www/controllers/Help.java2
-rw-r--r--src/main/java/com/juick/server/www/controllers/Login.java2
-rw-r--r--src/main/java/com/juick/server/www/controllers/MessagesWWW.java40
-rw-r--r--src/main/java/com/juick/server/www/controllers/Settings.java2
-rw-r--r--src/main/java/com/juick/server/www/controllers/SignUp.java2
-rw-r--r--src/main/java/com/juick/server/www/controllers/SocialLogin.java14
-rw-r--r--src/main/java/com/juick/server/www/filters/AnythingFilter.java7
32 files changed, 148 insertions, 147 deletions
diff --git a/src/main/java/com/juick/server/ActivityPubManager.java b/src/main/java/com/juick/server/ActivityPubManager.java
index 5e71aafb..739b8b58 100644
--- a/src/main/java/com/juick/server/ActivityPubManager.java
+++ b/src/main/java/com/juick/server/ActivityPubManager.java
@@ -17,10 +17,11 @@
package com.juick.server;
-import com.juick.Message;
-import com.juick.Reaction;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Reaction;
+import com.juick.model.User;
import com.juick.formatters.PlainTextFormatter;
+import com.juick.model.Tag;
import com.juick.server.api.SystemActivity.ActivityType;
import com.juick.server.api.activity.model.Context;
import com.juick.server.api.activity.model.activities.*;
@@ -286,7 +287,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
uri.replacePath(String.format("/n/%d-%d", mid, rid));
return uri.toUriString();
}
- public String tagUri(com.juick.Tag tag) {
+ public String tagUri(Tag tag) {
UriComponentsBuilder uri = UriComponentsBuilder.fromUriString(baseUri);
return uri.replacePath(String.format("/t/%s", tag.getName())).toUriString();
}
diff --git a/src/main/java/com/juick/server/CommandsManager.java b/src/main/java/com/juick/server/CommandsManager.java
index 82076e3c..494094eb 100644
--- a/src/main/java/com/juick/server/CommandsManager.java
+++ b/src/main/java/com/juick/server/CommandsManager.java
@@ -17,9 +17,9 @@
package com.juick.server;
-import com.juick.Message;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.formatters.PlainTextFormatter;
import com.juick.model.CommandResult;
import com.juick.model.TagStats;
@@ -182,7 +182,7 @@ public class CommandsManager {
if (!user_to.isAnonymous()) {
if (!userService.isInBLAny(user_to.getUid(), user_from.getUid())) {
if (pmQueriesService.createPM(user_from.getUid(), user_to.getUid(), body)) {
- com.juick.Message jmsg = new com.juick.Message();
+ Message jmsg = new Message();
jmsg.setUser(user_from);
jmsg.setTo(user_to);
jmsg.setText(body);
@@ -313,7 +313,7 @@ public class CommandsManager {
public CommandResult commandRecommend(User user, URI attachment, String... arguments) {
int mid = NumberUtils.toInt(arguments[0], 0);
if (mid > 0) {
- Optional<com.juick.Message> msg = messagesService.getMessage(mid);
+ Optional<Message> msg = messagesService.getMessage(mid);
if (msg.isPresent()) {
if (msg.get().getUser() == user) {
return CommandResult.fromString("You can't recommend your own messages.");
@@ -432,10 +432,10 @@ public class CommandsManager {
if (mid == 0) {
return CommandResult.fromString("Error");
}
- Optional<com.juick.Message> msg = messagesService.getMessage(mid);
+ Optional<Message> msg = messagesService.getMessage(mid);
if (msg.isPresent()) {
if (showReplies) {
- List<com.juick.Message> replies = messagesService.getReplies(user, mid);
+ List<Message> replies = messagesService.getReplies(user, mid);
applicationEventPublisher.publishEvent(
new SystemEvent(this, SystemActivity.read(user, msg.get())));
replies.add(0, msg.get());
@@ -450,7 +450,7 @@ public class CommandsManager {
public CommandResult commandShowReply(User user, URI attachment, String... arguments) {
int mid = NumberUtils.toInt(arguments[0], 0);
int rid = NumberUtils.toInt(arguments[1], 0);
- com.juick.Message reply = messagesService.getReply(mid, rid);
+ Message reply = messagesService.getReply(mid, rid);
if (reply != null) {
return CommandResult.fromString(PlainTextFormatter.formatPost(reply));
}
diff --git a/src/main/java/com/juick/server/EmailManager.java b/src/main/java/com/juick/server/EmailManager.java
index 04eb0466..d4e521e4 100644
--- a/src/main/java/com/juick/server/EmailManager.java
+++ b/src/main/java/com/juick/server/EmailManager.java
@@ -17,8 +17,8 @@
package com.juick.server;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.server.api.SystemActivity;
import com.juick.service.EmailService;
import com.juick.service.MessagesService;
@@ -78,7 +78,7 @@ public class EmailManager implements NotificationListener {
processMessage(msg, subscribers);
}
}
- private void processMessage(com.juick.Message msg, List<User> subscribedUsers) {
+ private void processMessage(Message msg, List<User> subscribedUsers) {
if (msg.isService()) {
return;
}
diff --git a/src/main/java/com/juick/server/ServerManager.java b/src/main/java/com/juick/server/ServerManager.java
index a35a66e8..8a70251f 100644
--- a/src/main/java/com/juick/server/ServerManager.java
+++ b/src/main/java/com/juick/server/ServerManager.java
@@ -18,8 +18,8 @@ package com.juick.server;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.server.api.SystemActivity;
import com.juick.service.MessagesService;
@@ -78,16 +78,16 @@ public class ServerManager implements NotificationListener {
}
- private void onJuickPM(final User to, final com.juick.Message jmsg) {
+ private void onJuickPM(final User to, final Message jmsg) {
messageEvent(jmsg, Arrays.asList(to, jmsg.getUser()));
}
- private void onJuickMessagePost(final com.juick.Message jmsg, List<User> subscribedUsers) {
+ private void onJuickMessagePost(final Message jmsg, List<User> subscribedUsers) {
messageEvent(jmsg, subscribedUsers);
messageEvent(jmsg, Collections.singletonList(AnonymousUser.INSTANCE));
}
- private void onJuickMessageReply(final com.juick.Message jmsg, final List<User> subscribedUsers) {
+ private void onJuickMessageReply(final Message jmsg, final List<User> subscribedUsers) {
messageEvent(jmsg, subscribedUsers);
messageEvent(jmsg, Collections.singletonList(AnonymousUser.INSTANCE));
}
@@ -113,7 +113,7 @@ public class ServerManager implements NotificationListener {
logger.warn("JSON exception", e);
}
}
- private void processMessage(User from, com.juick.Message jmsg, List<User> subscribers) {
+ private void processMessage(User from, Message jmsg, List<User> subscribers) {
List<User> subscribedUsers = ListUtils.union(subscribers, Collections.singletonList(jmsg.getUser()));
if (jmsg.isService()) {
logger.info("Message read event from {} for {}", from.getUid(), jmsg.getMid());
diff --git a/src/main/java/com/juick/server/SignatureManager.java b/src/main/java/com/juick/server/SignatureManager.java
index 6a273b76..c622c7e2 100644
--- a/src/main/java/com/juick/server/SignatureManager.java
+++ b/src/main/java/com/juick/server/SignatureManager.java
@@ -18,7 +18,7 @@
package com.juick.server;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.server.api.activity.model.Context;
import com.juick.server.api.activity.model.objects.Person;
diff --git a/src/main/java/com/juick/server/TelegramBotManager.java b/src/main/java/com/juick/server/TelegramBotManager.java
index f8948a68..f35a73d3 100644
--- a/src/main/java/com/juick/server/TelegramBotManager.java
+++ b/src/main/java/com/juick/server/TelegramBotManager.java
@@ -17,7 +17,7 @@
package com.juick.server;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.model.CommandResult;
import com.juick.server.api.SystemActivity;
@@ -139,17 +139,17 @@ public class TelegramBotManager implements NotificationListener {
int mid = originalMessageData.get().getLeft();
int rid = originalMessageData.get().getRight();
// TODO: this is copypaste from api, need switch to api
- com.juick.Message originalMessage = rid == 0 ? messagesService.getMessage(mid).orElseThrow(IllegalStateException::new)
+ com.juick.model.Message originalMessage = rid == 0 ? messagesService.getMessage(mid).orElseThrow(IllegalStateException::new)
: messagesService.getReply(mid, rid);
User author = originalMessage.getUser();
String newMessageText = StringUtils.defaultString(message.text());
if (user_from.equals(author) && canUpdateMessage(originalMessage, newMessageText)) {
if (messagesService.updateMessage(mid, rid, newMessageText)) {
- telegramNotify(message.chat().id(), "Message updated", new com.juick.Message());
+ telegramNotify(message.chat().id(), "Message updated", new com.juick.model.Message());
return;
}
}
- telegramNotify(message.chat().id(), "Error updating message", new com.juick.Message());
+ telegramNotify(message.chat().id(), "Error updating message", new com.juick.model.Message());
}
} else {
User user_from = userService.getUserByUID(telegramService.getUser(message.chat().id())).orElse(AnonymousUser.INSTANCE);
@@ -195,7 +195,7 @@ public class TelegramBotManager implements NotificationListener {
String msgUrl = "http://juick.com/login?hash=" + userService.getHashByUID(user_from.getUid());
String msg = String.format("Hi, %s!\nYou can post messages and images to Juick there.\n" +
"Tap to [log into website](%s) to get more info", user_from.getName(), msgUrl);
- telegramNotify(message.from().id().longValue(), msg, new com.juick.Message());
+ telegramNotify(message.from().id().longValue(), msg, new com.juick.model.Message());
} else {
Message replyMessage = message.replyToMessage();
if (replyMessage != null) {
@@ -235,11 +235,11 @@ public class TelegramBotManager implements NotificationListener {
}
} else {
telegramNotify(message.from().id().longValue(),
- "Can not reply to this message", replyMessage.messageId(), new com.juick.Message());
+ "Can not reply to this message", replyMessage.messageId(), new com.juick.model.Message());
}
} else {
telegramNotify(message.from().id().longValue(),
- "Can not reply to this message", replyMessage.messageId(), new com.juick.Message());
+ "Can not reply to this message", replyMessage.messageId(), new com.juick.model.Message());
}
} else {
executeCommand(message.messageId(), message.from().id().longValue(),
@@ -262,7 +262,7 @@ public class TelegramBotManager implements NotificationListener {
/*
validate user input
*/
- private boolean canUpdateMessage(com.juick.Message message, String newData) {
+ private boolean canUpdateMessage(com.juick.model.Message message, String newData) {
if (StringUtils.isEmpty(newData)) {
// allow empty text only when image is present
return StringUtils.isNotEmpty(message.getAttachmentType());
@@ -274,13 +274,13 @@ public class TelegramBotManager implements NotificationListener {
try {
CommandResult result = commandsManager.processCommand(user_from, text, attachment);
if (result.getNewMessage().isPresent()) {
- com.juick.Message newMessage = result.getNewMessage().get();
+ com.juick.model.Message newMessage = result.getNewMessage().get();
messagesService.setMessageProperty(newMessage.getMid(), newMessage.getRid(), "durovId",
String.valueOf(messageId));
}
String messageTxt = StringUtils.isNotEmpty(result.getMarkdown()) ? result.getMarkdown()
: "Unknown error or unsupported command";
- telegramNotify(userId, messageTxt, new com.juick.Message());
+ telegramNotify(userId, messageTxt, new com.juick.model.Message());
} catch (Exception e) {
logger.warn("telegram exception", e);
}
@@ -290,11 +290,11 @@ public class TelegramBotManager implements NotificationListener {
return e.offset() == 0 && e.type().equals(MessageEntity.Type.text_link) && e.length() == 2;
}
- public void telegramNotify(Long chatId, String msg, @Nonnull com.juick.Message source) {
+ public void telegramNotify(Long chatId, String msg, @Nonnull com.juick.model.Message source) {
telegramNotify(chatId, msg, 0, source);
}
- public void telegramNotify(Long chatId, String msg, Integer replyTo, @Nonnull com.juick.Message source) {
+ public void telegramNotify(Long chatId, String msg, Integer replyTo, @Nonnull com.juick.model.Message source) {
String attachment = MessageUtils.attachmentUrl(source);
boolean isSendTxt = true;
if (!StringUtils.isEmpty(attachment)) {
@@ -339,7 +339,7 @@ public class TelegramBotManager implements NotificationListener {
}
}
- private void processTelegramResponse(Long chatId, SendResponse response, com.juick.Message source) {
+ private void processTelegramResponse(Long chatId, SendResponse response, com.juick.model.Message source) {
int userId = telegramService.getUser(chatId);
if (!response.isOk()) {
if (response.errorCode() == 403) {
@@ -406,7 +406,7 @@ public class TelegramBotManager implements NotificationListener {
processFollow(activity.getFrom(), activity.getTo());
}
}
- private void processMessage(com.juick.Message jmsg, List<User> subscribedUsers) {
+ private void processMessage(com.juick.model.Message jmsg, List<User> subscribedUsers) {
if (jmsg.isService()) {
return;
}
@@ -432,17 +432,17 @@ public class TelegramBotManager implements NotificationListener {
}
}
- private void processLike(User liker, com.juick.Message message, List<User> subscribers) {
+ private void processLike(User liker, com.juick.model.Message message, List<User> subscribers) {
if (!liker.getName().equals(serviceUser)) {
logger.info("Like received in tg listener");
if (!userService.isInBLAny(message.getUser().getUid(), liker.getUid())) {
telegramService.getTelegramIdentifiers(Collections.singletonList(message.getUser()))
.forEach(c -> telegramNotify(c, String.format("%s recommends your [post](%s)",
- MessageUtils.getMarkdownUser(liker), formatUrl(message)), new com.juick.Message()));
+ MessageUtils.getMarkdownUser(liker), formatUrl(message)), new com.juick.model.Message()));
}
telegramService.getTelegramIdentifiers(subscribers)
.forEach(c -> telegramNotify(c, String.format("%s recommends you someone's [post](%s)",
- MessageUtils.getMarkdownUser(liker), formatUrl(message)), new com.juick.Message()));
+ MessageUtils.getMarkdownUser(liker), formatUrl(message)), new com.juick.model.Message()));
}
}
@@ -451,15 +451,15 @@ public class TelegramBotManager implements NotificationListener {
}
- private void processTop(com.juick.Message message) {
+ private void processTop(com.juick.model.Message message) {
telegramService.getTelegramIdentifiers(Collections.singletonList(message.getUser()))
.forEach(c -> telegramNotify(c, String.format("Your [post](%s) became popular!",
- formatUrl(message)), new com.juick.Message()));
+ formatUrl(message)), new com.juick.model.Message()));
}
private void processFollow(User subscriber, List<User> target) {
telegramService.getTelegramIdentifiers(target)
.forEach(c -> telegramNotify(c, String.format("%s subscribed to your blog",
- MessageUtils.getMarkdownUser(subscriber)), new com.juick.Message()));
+ MessageUtils.getMarkdownUser(subscriber)), new com.juick.model.Message()));
}
}
diff --git a/src/main/java/com/juick/server/TopManager.java b/src/main/java/com/juick/server/TopManager.java
index 97ff8780..338b0e49 100644
--- a/src/main/java/com/juick/server/TopManager.java
+++ b/src/main/java/com/juick/server/TopManager.java
@@ -17,9 +17,9 @@
package com.juick.server;
-import com.juick.Message;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.server.api.SystemActivity;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
diff --git a/src/main/java/com/juick/server/TwitterManager.java b/src/main/java/com/juick/server/TwitterManager.java
index 4022ef67..1b66358d 100644
--- a/src/main/java/com/juick/server/TwitterManager.java
+++ b/src/main/java/com/juick/server/TwitterManager.java
@@ -16,8 +16,8 @@
*/
package com.juick.server;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.server.api.SystemActivity;
import com.juick.service.UserService;
import com.juick.service.component.*;
@@ -63,7 +63,7 @@ public class TwitterManager implements NotificationListener {
serviceUser = userService.getUserByName(serviceUsername);
}
- void twitterPost(final com.juick.Message jmsg) {
+ void twitterPost(final Message jmsg) {
crosspostService.getTwitterToken(jmsg.getUser().getUid()).ifPresent(t -> {
String status = MessageUtils.getMessageHashTags(jmsg) + StringUtils.defaultString(jmsg.getText());
if (status.length() > 253) {
@@ -110,7 +110,7 @@ public class TwitterManager implements NotificationListener {
}
- private void processTop(com.juick.Message message) {
+ private void processTop(Message message) {
Message jmsg = SerializationUtils.clone(message);
jmsg.setUser(serviceUser);
twitterPost(jmsg);
diff --git a/src/main/java/com/juick/server/XMPPManager.java b/src/main/java/com/juick/server/XMPPManager.java
index 94fe0d1e..5c58345a 100644
--- a/src/main/java/com/juick/server/XMPPManager.java
+++ b/src/main/java/com/juick/server/XMPPManager.java
@@ -17,7 +17,7 @@
package com.juick.server;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.formatters.PlainTextFormatter;
import com.juick.model.CommandResult;
import com.juick.server.api.SystemActivity;
@@ -126,7 +126,7 @@ public class XMPPManager implements NotificationListener {
public void init() {
logger.info("xmpp component start connecting to {}", componentPort);
XmppSessionConfiguration configuration = XmppSessionConfiguration.builder()
- .extensions(Extension.of(com.juick.Message.class), Extension.of(MessageQuery.class))
+ .extensions(Extension.of(com.juick.model.Message.class), Extension.of(MessageQuery.class))
.debugger(LogbackDebugger.class)
.defaultResponseTimeout(Duration.ofMillis(120000))
.build();
@@ -269,13 +269,13 @@ public class XMPPManager implements NotificationListener {
serviceUser = userService.getUserByName(serviceUsername);
}
- private void sendJuickMessage(com.juick.Message jmsg, List<User> users) {
+ private void sendJuickMessage(com.juick.model.Message jmsg, List<User> users) {
List<String> jids = new ArrayList<>();
for (User user : users) {
jids.addAll(userService.getJIDsbyUID(user.getUid()));
}
- com.juick.Message fullMsg = messagesService.getMessage(jmsg.getMid()).orElseThrow(IllegalStateException::new);
+ com.juick.model.Message fullMsg = messagesService.getMessage(jmsg.getMid()).orElseThrow(IllegalStateException::new);
String txt = "@" + jmsg.getUser().getName() + ":" + MessageUtils.getTagsString(fullMsg) + "\n";
String attachmentUrl = MessageUtils.attachmentUrl(fullMsg);
if (StringUtils.isNotEmpty(attachmentUrl)) {
@@ -307,14 +307,14 @@ public class XMPPManager implements NotificationListener {
}
}
- private void sendJuickComment(com.juick.Message jmsg, List<User> users) {
+ private void sendJuickComment(com.juick.model.Message jmsg, List<User> users) {
String replyQuote;
String replyTo;
- com.juick.Message replyMessage = jmsg.getReplyto() > 0 ? messagesService.getReply(jmsg.getMid(), jmsg.getReplyto())
+ com.juick.model.Message replyMessage = jmsg.getReplyto() > 0 ? messagesService.getReply(jmsg.getMid(), jmsg.getReplyto())
: messagesService.getMessage(jmsg.getMid()).orElseThrow(IllegalStateException::new);
replyTo = replyMessage.getUser().getName();
- com.juick.Message fullReply = messagesService.getReply(jmsg.getMid(), jmsg.getRid());
+ com.juick.model.Message fullReply = messagesService.getReply(jmsg.getMid(), jmsg.getRid());
replyQuote = StringUtils.defaultString(fullReply.getReplyQuote());
String txt = "Reply by @" + jmsg.getUser().getName() + ":\n" + replyQuote + "\n@" + replyTo + " ";
@@ -351,7 +351,7 @@ public class XMPPManager implements NotificationListener {
}
}
}
- private void processMessage(com.juick.Message msg, List<User> subscribers) {
+ private void processMessage(com.juick.model.Message msg, List<User> subscribers) {
if (msg.isService()) {
return;
}
@@ -388,7 +388,7 @@ public class XMPPManager implements NotificationListener {
return ClientMessage.from(reply);
}
- public void processLike(User liker, com.juick.Message jmsg, List<User> users) {
+ public void processLike(User liker, com.juick.model.Message jmsg, List<User> users) {
if (!userService.isInBLAny(jmsg.getUser().getUid(), liker.getUid())) {
userService.getJIDsbyUID(jmsg.getUser().getUid()).forEach(authorJid -> {
Message xmppMessage = new Message();
@@ -456,7 +456,7 @@ public class XMPPManager implements NotificationListener {
});
}
- public void processTop(com.juick.Message message) {
+ public void processTop(com.juick.model.Message message) {
try {
commandsManager.processCommand(serviceUser, String.format("! #%d", message.getMid()), URI.create(StringUtils.EMPTY));
} catch (Exception e) {
diff --git a/src/main/java/com/juick/server/api/ApiSocialLogin.java b/src/main/java/com/juick/server/api/ApiSocialLogin.java
index 6a6b4293..24010dd2 100644
--- a/src/main/java/com/juick/server/api/ApiSocialLogin.java
+++ b/src/main/java/com/juick/server/api/ApiSocialLogin.java
@@ -33,18 +33,17 @@ import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.juick.model.AuthResponse;
-import com.juick.model.facebook.User;
+import com.juick.model.ext.facebook.User;
import com.juick.server.util.HttpBadRequestException;
import com.juick.service.CrosspostService;
import com.juick.service.EmailService;
import com.juick.service.UserService;
-import com.juick.model.vk.UsersResponse;
+import com.juick.model.ext.vk.UsersResponse;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.proc.BadJOSEException;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
-import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -219,7 +218,7 @@ public class ApiSocialLogin {
vkAuthService.signRequest(token, meRequest);
String graph = vkAuthService.execute(meRequest).getBody();
- com.juick.model.vk.User jsonUser = jsonMapper.readValue(graph, UsersResponse.class).getUsers().get(0);
+ com.juick.model.ext.vk.User jsonUser = jsonMapper.readValue(graph, UsersResponse.class).getUsers().get(0);
String vkName = jsonUser.getFirstName() + " " + jsonUser.getLastName();
String vkLink = jsonUser.getScreenName();
@@ -253,7 +252,7 @@ public class ApiSocialLogin {
GoogleIdToken idToken = verifier.verify(idTokenString);
if (idToken != null) {
String email = idToken.getPayload().getEmail();
- com.juick.User visitor = userService.getUserByEmail(email);
+ com.juick.model.User visitor = userService.getUserByEmail(email);
if (visitor.isAnonymous()) {
String verificationCode = RandomStringUtils.randomAlphanumeric(8).toUpperCase();
emailService.addVerificationCode(null, email, verificationCode);
@@ -266,7 +265,7 @@ public class ApiSocialLogin {
}
@ResponseBody
@PostMapping("/api/signup")
- public ResponseEntity<com.juick.User> signupWithEmail(String username, String password, String verificationCode) {
+ public ResponseEntity<com.juick.model.User> signupWithEmail(String username, String password, String verificationCode) {
if (username.length() < 2 || username.length() > 16 || !username.matches("^[a-zA-Z0-9\\-]+$")
|| password.length() < 6 || password.length() > 32) {
throw new HttpBadRequestException();
@@ -274,7 +273,7 @@ public class ApiSocialLogin {
String verifiedEmail = emailService.getEmailByAuthCode(verificationCode);
if (StringUtils.isNotEmpty(verifiedEmail)) {
- com.juick.User newUser = userService.createUser(username, password).orElseThrow(HttpBadRequestException::new);
+ com.juick.model.User newUser = userService.createUser(username, password).orElseThrow(HttpBadRequestException::new);
emailService.addEmail(newUser.getUid(), verifiedEmail);
emailService.deleteAuthCode(verificationCode);
return ResponseEntity.ok(newUser);
@@ -301,7 +300,7 @@ public class ApiSocialLogin {
var email = api.validateToken(idToken);
if (email.isPresent()) {
- com.juick.User user = userService.getUserByEmail(email.get());
+ com.juick.model.User user = userService.getUserByEmail(email.get());
if (!user.isAnonymous()) {
String redirectUrl = crosspostService.verifyVKState(body.get("state"));
if (StringUtils.isBlank(redirectUrl)) {
diff --git a/src/main/java/com/juick/server/api/Messages.java b/src/main/java/com/juick/server/api/Messages.java
index 67e2ca3e..ffe55d3f 100644
--- a/src/main/java/com/juick/server/api/Messages.java
+++ b/src/main/java/com/juick/server/api/Messages.java
@@ -17,9 +17,9 @@
package com.juick.server.api;
-import com.juick.Message;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.server.Utils;
import com.juick.server.www.WebApp;
import com.juick.model.CommandResult;
@@ -52,11 +52,11 @@ import java.util.stream.Collectors;
@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public class Messages {
- private static final ResponseEntity<List<com.juick.Message>> NOT_FOUND = ResponseEntity
+ private static final ResponseEntity<List<Message>> NOT_FOUND = ResponseEntity
.status(HttpStatus.NOT_FOUND)
.body(Collections.emptyList());
- private static final ResponseEntity<List<com.juick.Message>> FORBIDDEN = ResponseEntity
+ private static final ResponseEntity<List<Message>> FORBIDDEN = ResponseEntity
.status(HttpStatus.FORBIDDEN)
.body(Collections.emptyList());
@@ -76,7 +76,7 @@ public class Messages {
// TODO: serialize image urls
@GetMapping("/api/home")
- public ResponseEntity<List<com.juick.Message>> getHome(
+ public ResponseEntity<List<Message>> getHome(
@Visitor User visitor,
@RequestParam(defaultValue = "0") int before_mid) {
if (!visitor.isAnonymous()) {
@@ -90,7 +90,7 @@ public class Messages {
}
@GetMapping("/api/messages")
- public ResponseEntity<List<com.juick.Message>> getMessages(
+ public ResponseEntity<List<Message>> getMessages(
@Visitor User visitor,
@RequestParam(required = false) String uname,
@RequestParam(name = "before_mid", defaultValue = "0") Integer before,
@@ -173,7 +173,7 @@ public class Messages {
return msgs;
}
@GetMapping("/api/thread")
- public ResponseEntity<List<com.juick.Message>> getThread(
+ public ResponseEntity<List<Message>> getThread(
@Visitor User visitor,
@RequestParam(defaultValue = "0") int mid) {
Optional<Message> message = messagesService.getMessage(mid);
@@ -187,7 +187,7 @@ public class Messages {
Collections.singletonList(msg.getMid()))
.stream().map(Pair::getRight).collect(Collectors.toList())));
msg.getRecommendations().forEach(r -> r.setAvatar(webApp.getAvatarUrl(r)));
- List<com.juick.Message> replies = messagesService.getReplies(visitor, mid);
+ List<Message> replies = messagesService.getReplies(visitor, mid);
replies.forEach(m -> m.getUser().setAvatar(webApp.getAvatarUrl(m.getUser())));
if (!visitor.isAnonymous()) {
userService.updateLastSeen(visitor);
diff --git a/src/main/java/com/juick/server/api/Notifications.java b/src/main/java/com/juick/server/api/Notifications.java
index e7eada2a..eb15917e 100644
--- a/src/main/java/com/juick/server/api/Notifications.java
+++ b/src/main/java/com/juick/server/api/Notifications.java
@@ -17,10 +17,10 @@
package com.juick.server.api;
-import com.juick.ExternalToken;
-import com.juick.Message;
-import com.juick.Status;
-import com.juick.User;
+import com.juick.model.ExternalToken;
+import com.juick.model.Message;
+import com.juick.model.Status;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.server.util.HttpBadRequestException;
import com.juick.service.MessagesService;
diff --git a/src/main/java/com/juick/server/api/PM.java b/src/main/java/com/juick/server/api/PM.java
index 8e4cb6c9..d5860057 100644
--- a/src/main/java/com/juick/server/api/PM.java
+++ b/src/main/java/com/juick/server/api/PM.java
@@ -17,9 +17,9 @@
package com.juick.server.api;
-import com.juick.Chat;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Chat;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.model.PrivateChats;
import com.juick.server.util.HttpBadRequestException;
@@ -56,7 +56,7 @@ public class PM {
private WebApp webApp;
@RequestMapping(value = "/api/pm", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public List<com.juick.Message> doGetPM(
+ public List<Message> doGetPM(
@Visitor User visitor,
@RequestParam(required = false) String uname) {
int uid = 0;
@@ -74,7 +74,7 @@ public class PM {
}
@RequestMapping(value = "/api/pm", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
- public com.juick.Message doPostPM(
+ public Message doPostPM(
@Visitor User visitor,
@RequestParam String uname,
@RequestParam String body) {
@@ -92,7 +92,7 @@ public class PM {
}
if (pmQueriesService.createPM(visitor.getUid(), userTo.getUid(), body)) {
- com.juick.Message jmsg = new com.juick.Message();
+ Message jmsg = new Message();
jmsg.setUser(visitor);
jmsg.setText(body);
jmsg.setTo(userTo);
diff --git a/src/main/java/com/juick/server/api/Post.java b/src/main/java/com/juick/server/api/Post.java
index 37b40b2d..bfc640e9 100644
--- a/src/main/java/com/juick/server/api/Post.java
+++ b/src/main/java/com/juick/server/api/Post.java
@@ -17,10 +17,10 @@
package com.juick.server.api;
-import com.juick.Message;
-import com.juick.Reaction;
-import com.juick.Status;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Reaction;
+import com.juick.model.Status;
+import com.juick.model.User;
import com.juick.model.CommandResult;
import com.juick.server.ActivityPubManager;
import com.juick.server.CommandsManager;
@@ -120,7 +120,7 @@ public class Post {
Message msg = message.get();
- com.juick.Message reply = null;
+ Message reply = null;
if (rid > 0) {
reply = messagesService.getReply(mid, rid);
if (reply == null) {
@@ -156,7 +156,7 @@ public class Post {
@PostMapping("/api/like")
@ResponseStatus(value = HttpStatus.OK)
public Status doPostRecomm(@Visitor User visitor, @RequestParam Integer mid) throws Exception {
- Optional<com.juick.Message> message = messagesService.getMessage(mid);
+ Optional<Message> message = messagesService.getMessage(mid);
if (message.isEmpty()) {
throw new HttpNotFoundException();
}
@@ -173,7 +173,7 @@ public class Post {
@ResponseStatus(value = HttpStatus.OK)
public Status doPostSubscribe(@Visitor User visitor,
@RequestParam Integer mid) throws Exception {
- Optional<com.juick.Message> message = messagesService.getMessage(mid);
+ Optional<Message> message = messagesService.getMessage(mid);
if (message.isEmpty()) {
throw new HttpNotFoundException();
}
@@ -200,7 +200,7 @@ public class Post {
@RequestParam(required = false, defaultValue = "1") int count) {
logger.info("got reaction with type: {}", reactionId);
- Optional<com.juick.Message> message = messagesService.getMessage(mid);
+ Optional<Message> message = messagesService.getMessage(mid);
if (message.isEmpty()) {
throw new HttpNotFoundException();
}
diff --git a/src/main/java/com/juick/server/api/Service.java b/src/main/java/com/juick/server/api/Service.java
index 46cccb6f..2763eab1 100644
--- a/src/main/java/com/juick/server/api/Service.java
+++ b/src/main/java/com/juick/server/api/Service.java
@@ -17,8 +17,8 @@
package com.juick.server.api;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.model.CommandResult;
import com.juick.server.CommandsManager;
import com.juick.server.EmailManager;
diff --git a/src/main/java/com/juick/server/api/SystemActivity.java b/src/main/java/com/juick/server/api/SystemActivity.java
index 4b07dccb..820f9307 100644
--- a/src/main/java/com/juick/server/api/SystemActivity.java
+++ b/src/main/java/com/juick/server/api/SystemActivity.java
@@ -17,8 +17,8 @@
package com.juick.server.api;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import java.util.Collections;
import java.util.List;
diff --git a/src/main/java/com/juick/server/api/Tags.java b/src/main/java/com/juick/server/api/Tags.java
index 53ed7766..6041adcf 100644
--- a/src/main/java/com/juick/server/api/Tags.java
+++ b/src/main/java/com/juick/server/api/Tags.java
@@ -17,7 +17,7 @@
package com.juick.server.api;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.model.TagStats;
import com.juick.service.TagService;
import com.juick.service.security.annotation.Visitor;
diff --git a/src/main/java/com/juick/server/api/Users.java b/src/main/java/com/juick/server/api/Users.java
index c909fb38..e53c5424 100644
--- a/src/main/java/com/juick/server/api/Users.java
+++ b/src/main/java/com/juick/server/api/Users.java
@@ -17,7 +17,7 @@
package com.juick.server.api;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.model.ApplicationStatus;
import com.juick.server.EmailManager;
@@ -79,7 +79,7 @@ public class Users {
public List<User> doGetUsers(
@Visitor User visitor,
@RequestParam(value = "uname", required = false) List<String> unames) {
- List<com.juick.User> users = new ArrayList<>();
+ List<User> users = new ArrayList<>();
if (unames != null) {
unames.removeIf(WebUtils::isNotUserName);
@@ -192,7 +192,7 @@ public class Users {
uid = visitor.getUid();
} else {
if (WebUtils.isUserName(uname)) {
- com.juick.User u = userService.getUserByName(uname);
+ User u = userService.getUserByName(uname);
if (!u.isAnonymous()) {
uid = u.getUid();
}
@@ -216,7 +216,7 @@ public class Users {
uid = visitor.getUid();
} else {
if (WebUtils.isUserName(uname)) {
- com.juick.User u = userService.getUserByName(uname);
+ User u = userService.getUserByName(uname);
if (!u.isAnonymous()) {
uid = u.getUid();
}
diff --git a/src/main/java/com/juick/server/api/activity/Profile.java b/src/main/java/com/juick/server/api/activity/Profile.java
index 9aa9dc37..f17b70c6 100644
--- a/src/main/java/com/juick/server/api/activity/Profile.java
+++ b/src/main/java/com/juick/server/api/activity/Profile.java
@@ -18,8 +18,8 @@
package com.juick.server.api.activity;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.formatters.PlainTextFormatter;
import com.juick.model.CommandResult;
import com.juick.server.ActivityPubManager;
diff --git a/src/main/java/com/juick/server/api/rss/Feeds.java b/src/main/java/com/juick/server/api/rss/Feeds.java
index dd225979..76c2b217 100644
--- a/src/main/java/com/juick/server/api/rss/Feeds.java
+++ b/src/main/java/com/juick/server/api/rss/Feeds.java
@@ -17,7 +17,7 @@
package com.juick.server.api.rss;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.server.util.HttpNotFoundException;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
diff --git a/src/main/java/com/juick/server/api/rss/MessagesView.java b/src/main/java/com/juick/server/api/rss/MessagesView.java
index 0e26419f..e7bc1bb3 100644
--- a/src/main/java/com/juick/server/api/rss/MessagesView.java
+++ b/src/main/java/com/juick/server/api/rss/MessagesView.java
@@ -17,8 +17,8 @@
package com.juick.server.api.rss;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.server.api.rss.extension.JuickModule;
import com.juick.server.api.rss.extension.JuickModuleImpl;
import com.juick.server.www.WebApp;
diff --git a/src/main/java/com/juick/server/api/webfinger/Resource.java b/src/main/java/com/juick/server/api/webfinger/Resource.java
index 25981cb0..8fb808b1 100644
--- a/src/main/java/com/juick/server/api/webfinger/Resource.java
+++ b/src/main/java/com/juick/server/api/webfinger/Resource.java
@@ -17,7 +17,7 @@
package com.juick.server.api.webfinger;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.server.api.webfinger.model.Account;
import com.juick.server.api.webfinger.model.Link;
import com.juick.server.util.HttpNotFoundException;
diff --git a/src/main/java/com/juick/server/util/ImageUtils.java b/src/main/java/com/juick/server/util/ImageUtils.java
index 60bce1a0..e06339ba 100644
--- a/src/main/java/com/juick/server/util/ImageUtils.java
+++ b/src/main/java/com/juick/server/util/ImageUtils.java
@@ -17,7 +17,7 @@
package com.juick.server.util;
-import com.juick.Attachment;
+import com.juick.model.Attachment;
import org.apache.commons.imaging.ImageReadException;
import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.common.ImageMetadata;
diff --git a/src/main/java/com/juick/server/util/TagUtils.java b/src/main/java/com/juick/server/util/TagUtils.java
index ab42ff6c..754d8020 100644
--- a/src/main/java/com/juick/server/util/TagUtils.java
+++ b/src/main/java/com/juick/server/util/TagUtils.java
@@ -17,7 +17,7 @@
package com.juick.server.util;
-import com.juick.Tag;
+import com.juick.model.Tag;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
diff --git a/src/main/java/com/juick/server/www/WebApp.java b/src/main/java/com/juick/server/www/WebApp.java
index 2bc2b596..8476224d 100644
--- a/src/main/java/com/juick/server/www/WebApp.java
+++ b/src/main/java/com/juick/server/www/WebApp.java
@@ -16,8 +16,8 @@
*/
package com.juick.server.www;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.service.TagService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
diff --git a/src/main/java/com/juick/server/www/controllers/Help.java b/src/main/java/com/juick/server/www/controllers/Help.java
index d37a87de..8bb9aecd 100644
--- a/src/main/java/com/juick/server/www/controllers/Help.java
+++ b/src/main/java/com/juick/server/www/controllers/Help.java
@@ -17,7 +17,7 @@
package com.juick.server.www.controllers;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.server.util.HttpNotFoundException;
import com.juick.server.www.HelpService;
import com.juick.server.www.WebApp;
diff --git a/src/main/java/com/juick/server/www/controllers/Login.java b/src/main/java/com/juick/server/www/controllers/Login.java
index 20ab45a4..e6d6904c 100644
--- a/src/main/java/com/juick/server/www/controllers/Login.java
+++ b/src/main/java/com/juick/server/www/controllers/Login.java
@@ -16,7 +16,7 @@
*/
package com.juick.server.www.controllers;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.service.UserService;
import com.juick.service.security.annotation.Visitor;
import org.springframework.stereotype.Controller;
diff --git a/src/main/java/com/juick/server/www/controllers/MessagesWWW.java b/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
index 946b13b3..a7e4c127 100644
--- a/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
+++ b/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
@@ -16,9 +16,9 @@
*/
package com.juick.server.www.controllers;
-import com.juick.Message;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.formatters.PlainTextFormatter;
import com.juick.server.Utils;
import com.juick.server.util.HttpForbiddenException;
@@ -73,7 +73,7 @@ public class MessagesWWW {
@Inject
private WebApp webApp;
- private void fillUserModel(ModelMap model, com.juick.User user, com.juick.User visitor) {
+ private void fillUserModel(ModelMap model, User user, User visitor) {
user.setAvatar(webApp.getAvatarWebPath(user));
model.addAttribute("user", user);
model.addAttribute("isSubscribed", userService.isSubscribed(visitor.getUid(), user.getUid()));
@@ -156,7 +156,7 @@ public class MessagesWWW {
model.addAttribute("headers", head);
model.addAttribute("visitor", visitor);
model.addAttribute("noindex", !(paramShow == null && paramBefore == 0));
- List<com.juick.Message> msgs = messagesService.getMessages(visitor, mids);
+ List<Message> msgs = messagesService.getMessages(visitor, mids);
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
if (!visitor.isAnonymous()) {
fillUserModel(model, visitor, visitor);
@@ -203,7 +203,7 @@ public class MessagesWWW {
@RequestParam(required = false, defaultValue = "0") Integer before,
@CookieValue(name = "sape_cookie", required = false, defaultValue = StringUtils.EMPTY) String sapeCookie,
ModelMap model) {
- com.juick.User user = userService.getUserByName(uname);
+ User user = userService.getUserByName(uname);
if (user.isBanned() || user.isAnonymous()) {
throw new HttpNotFoundException();
}
@@ -211,7 +211,7 @@ public class MessagesWWW {
List<Integer> mids;
- com.juick.Tag paramTag = null;
+ Tag paramTag = null;
if (paramTagStr != null) {
if (paramTagStr.length() < 64) {
paramTag = tagService.getTag(paramTagStr, false);
@@ -273,7 +273,7 @@ public class MessagesWWW {
model.addAttribute("noindex", paramShow == null && before == 0);
fillUserModel(model, user, visitor);
model.addAttribute("paramTag", paramTag);
- List<com.juick.Message> msgs = messagesService.getMessages(visitor, mids);
+ List<Message> msgs = messagesService.getMessages(visitor, mids);
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
if (!visitor.isAnonymous()) {
List<Integer> unread = messagesService.getUnread(visitor);
@@ -312,7 +312,7 @@ public class MessagesWWW {
protected String doGetTags(
@Visitor User visitor,
@PathVariable String uname, ModelMap model) {
- com.juick.User user = userService.getUserByName(uname);
+ User user = userService.getUserByName(uname);
if (visitor.isBanned()) {
throw new HttpNotFoundException();
}
@@ -332,7 +332,7 @@ public class MessagesWWW {
protected String doGetFriends(
@Visitor User visitor,
@PathVariable String uname, ModelMap model) {
- com.juick.User user = userService.getUserByName(uname);
+ User user = userService.getUserByName(uname);
if (visitor.isBanned()) {
throw new HttpNotFoundException();
}
@@ -350,7 +350,7 @@ public class MessagesWWW {
protected String doGetReaders(
@Visitor User visitor,
@PathVariable String uname, ModelMap model) {
- com.juick.User user = userService.getUserByName(uname);
+ User user = userService.getUserByName(uname);
visitor.setAvatar(webApp.getAvatarWebPath(visitor));
model.addAttribute("title", "Читатели " + user.getName());
model.addAttribute("headers", "<meta name=\"robots\" content=\"noindex\"/>");
@@ -365,7 +365,7 @@ public class MessagesWWW {
protected String doGetBL(
@Visitor User visitor,
@PathVariable String uname, ModelMap model) {
- com.juick.User user = userService.getUserByName(uname);
+ User user = userService.getUserByName(uname);
if (visitor.getUid() != user.getUid()) {
throw new HttpForbiddenException();
}
@@ -388,11 +388,11 @@ public class MessagesWWW {
ModelMap model) {
visitor.setAvatar(webApp.getAvatarWebPath(visitor));
String paramTagStr = StringEscapeUtils.unescapeHtml4(tagName);
- com.juick.Tag paramTag = tagService.getTag(paramTagStr, false);
+ Tag paramTag = tagService.getTag(paramTagStr, false);
if (paramTag == null) {
throw new HttpNotFoundException();
} else if (paramTag.SynonymID > 0 && paramTag.TID != paramTag.SynonymID) {
- com.juick.Tag synTag = tagService.getTag(paramTag.SynonymID);
+ Tag synTag = tagService.getTag(paramTag.SynonymID);
String url = "/tag/" + URLEncoder.encode(StringEscapeUtils.escapeHtml4(synTag.getName()), StandardCharsets.UTF_8);
if (request.getQueryString() != null) {
url += "?" + request.getQueryString();
@@ -409,7 +409,7 @@ public class MessagesWWW {
String title = "*" + StringEscapeUtils.escapeHtml4(paramTag.getName());
model.addAttribute("title", title);
List<Integer> mids = messagesService.getTag(paramTag.TID, visitor.getUid(), before, (visitor.isAnonymous()) ? 40 : 20);
- List<com.juick.Message> msgs = messagesService.getMessages(visitor, mids);
+ List<Message> msgs = messagesService.getMessages(visitor, mids);
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
if (!visitor.isAnonymous()) {
List<Integer> unread = messagesService.getUnread(visitor);
@@ -457,7 +457,7 @@ public class MessagesWWW {
}
visitor.setAvatar(webApp.getAvatarWebPath(visitor));
String title = "PM: Inbox";
- List<com.juick.Message> msgs = pmQueriesService.getLastPMInbox(visitor.getUid());
+ List<Message> msgs = pmQueriesService.getLastPMInbox(visitor.getUid());
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
fillUserModel(model, visitor, visitor);
model.addAttribute("title", title);
@@ -477,7 +477,7 @@ public class MessagesWWW {
}
visitor.setAvatar(webApp.getAvatarWebPath(visitor));
String title = "PM: Sent";
- List<com.juick.Message> msgs = pmQueriesService.getLastPMSent(visitor.getUid());
+ List<Message> msgs = pmQueriesService.getLastPMSent(visitor.getUid());
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
if (WebUtils.isNotUserName(uname)) {
uname = StringUtils.EMPTY;
@@ -501,7 +501,7 @@ public class MessagesWWW {
throw new HttpForbiddenException();
}
visitor.setAvatar(webApp.getAvatarWebPath(visitor));
- Optional<com.juick.Message> message = messagesService.getMessage(mid);
+ Optional<Message> message = messagesService.getMessage(mid);
if (message.isEmpty()) {
throw new HttpNotFoundException();
@@ -509,13 +509,13 @@ public class MessagesWWW {
Message msg = message.get();
- com.juick.User user = userService.getUserByName(uname);
+ User user = userService.getUserByName(uname);
if (user.isAnonymous() || !msg.getUser().equals(user)) {
return String.format("redirect:/%s/%d", msg.getUser().getName(), mid);
}
msg.VisitorCanComment = !visitor.isAnonymous();
msg.getUser().setAvatar(webApp.getAvatarWebPath(msg.getUser()));
- List<com.juick.Message> replies = messagesService.getReplies(visitor, msg.getMid());
+ List<Message> replies = messagesService.getReplies(visitor, msg.getMid());
// this should be after getReplies to mark thread as read
fillUserModel(model, user, visitor);
if (!visitor.isAnonymous()) {
diff --git a/src/main/java/com/juick/server/www/controllers/Settings.java b/src/main/java/com/juick/server/www/controllers/Settings.java
index 7e3e2514..e535eef0 100644
--- a/src/main/java/com/juick/server/www/controllers/Settings.java
+++ b/src/main/java/com/juick/server/www/controllers/Settings.java
@@ -16,7 +16,7 @@
*/
package com.juick.server.www.controllers;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.model.NotifyOpts;
import com.juick.server.util.HttpBadRequestException;
import com.juick.server.util.HttpUtils;
diff --git a/src/main/java/com/juick/server/www/controllers/SignUp.java b/src/main/java/com/juick/server/www/controllers/SignUp.java
index 7332dc2e..cc2101a3 100644
--- a/src/main/java/com/juick/server/www/controllers/SignUp.java
+++ b/src/main/java/com/juick/server/www/controllers/SignUp.java
@@ -16,7 +16,7 @@
*/
package com.juick.server.www.controllers;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.server.util.HttpBadRequestException;
import com.juick.server.util.HttpForbiddenException;
import com.juick.server.www.WebApp;
diff --git a/src/main/java/com/juick/server/www/controllers/SocialLogin.java b/src/main/java/com/juick/server/www/controllers/SocialLogin.java
index 710bae8e..e3b7a33b 100644
--- a/src/main/java/com/juick/server/www/controllers/SocialLogin.java
+++ b/src/main/java/com/juick/server/www/controllers/SocialLogin.java
@@ -22,8 +22,8 @@ import com.github.scribejava.core.builder.ServiceBuilder;
import com.github.scribejava.core.model.*;
import com.github.scribejava.core.oauth.OAuth10aService;
import com.github.scribejava.core.oauth.OAuth20Service;
-import com.juick.model.facebook.User;
-import com.juick.model.vk.UsersResponse;
+import com.juick.model.ext.facebook.User;
+import com.juick.model.ext.vk.UsersResponse;
import com.juick.server.Utils;
import com.juick.server.util.HttpBadRequestException;
import com.juick.service.CrosspostService;
@@ -193,7 +193,7 @@ public class SocialLogin {
}
@GetMapping("/_twitter")
protected void doTwitterLogin(
- @Visitor com.juick.User user,
+ @Visitor com.juick.model.User user,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ExecutionException, InterruptedException {
String hash = StringUtils.EMPTY, request_token = StringUtils.EMPTY, request_token_secret = StringUtils.EMPTY;
@@ -229,8 +229,8 @@ public class SocialLogin {
OAuth1AccessToken accessToken = oAuthService.getAccessToken(requestToken, verifier);
OAuthRequest oAuthRequest = new OAuthRequest(Verb.GET, TWITTER_VERIFY_URL);
oAuthService.signRequest(accessToken, oAuthRequest);
- com.juick.model.twitter.User twitterUser = jsonMapper.readValue(oAuthService.execute(oAuthRequest).getBody(),
- com.juick.model.twitter.User.class);
+ com.juick.model.ext.twitter.User twitterUser = jsonMapper.readValue(oAuthService.execute(oAuthRequest).getBody(),
+ com.juick.model.ext.twitter.User.class);
if (userService.linkTwitterAccount(user, accessToken.getToken(), accessToken.getTokenSecret(),
twitterUser.getScreenName())) {
response.setStatus(HttpServletResponse.SC_FOUND);
@@ -267,7 +267,7 @@ public class SocialLogin {
vkAuthService.signRequest(token, meRequest);
String graph = vkAuthService.execute(meRequest).getBody();
- com.juick.model.vk.User jsonUser = jsonMapper.readValue(graph, UsersResponse.class).getUsers().get(0);
+ com.juick.model.ext.vk.User jsonUser = jsonMapper.readValue(graph, UsersResponse.class).getUsers().get(0);
String vkName = jsonUser.getFirstName() + " " + jsonUser.getLastName();
String vkLink = jsonUser.getScreenName();
@@ -348,7 +348,7 @@ public class SocialLogin {
AppleSignInApi api = (AppleSignInApi) appleSignInService.getApi();
var email = api.validateToken(idToken);
if (email.isPresent()) {
- com.juick.User user = userService.getUserByEmail(email.get());
+ com.juick.model.User user = userService.getUserByEmail(email.get());
if (!user.isAnonymous()) {
Cookie c = new Cookie("hash", userService.getHashByUID(user.getUid()));
c.setMaxAge(50 * 24 * 60 * 60);
diff --git a/src/main/java/com/juick/server/www/filters/AnythingFilter.java b/src/main/java/com/juick/server/www/filters/AnythingFilter.java
index cf484357..9a012089 100644
--- a/src/main/java/com/juick/server/www/filters/AnythingFilter.java
+++ b/src/main/java/com/juick/server/www/filters/AnythingFilter.java
@@ -17,6 +17,7 @@
package com.juick.server.www.filters;
+import com.juick.model.User;
import com.juick.server.util.WebUtils;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
@@ -59,7 +60,7 @@ public class AnythingFilter extends OncePerRequestFilter {
if (isPostNumber && anything.equals(Integer.toString(messageId))) {
if (messageId > 0) {
- com.juick.User author = messagesService.getMessageAuthor(messageId);
+ User author = messagesService.getMessageAuthor(messageId);
if (author != null) {
servletResponse.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
@@ -68,14 +69,14 @@ public class AnythingFilter extends OncePerRequestFilter {
}
}
}
- com.juick.User user = userService.getUserByName(anything);
+ User user = userService.getUserByName(anything);
if (user.getUid() > 0) {
servletResponse.sendRedirect("/" + user.getName() + "/");
} else {
filterChain.doFilter(servletRequest, servletResponse);
}
} else {
- com.juick.User user = userService.getUserByName(anything);
+ User user = userService.getUserByName(anything);
if (!user.isAnonymous()) {
servletResponse.sendRedirect("/" + user.getName() + "/?before=" + before);
} else {