aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/server/api')
-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
13 files changed, 49 insertions, 50 deletions
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;