aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/www')
-rw-r--r--src/main/java/com/juick/www/WebApp.java2
-rw-r--r--src/main/java/com/juick/www/api/Notifications.java20
-rw-r--r--src/main/java/com/juick/www/api/SystemActivity.java18
-rw-r--r--src/main/java/com/juick/www/api/Users.java40
-rw-r--r--src/main/java/com/juick/www/api/activity/Profile.java2
-rw-r--r--src/main/java/com/juick/www/controllers/Settings.java52
6 files changed, 74 insertions, 60 deletions
diff --git a/src/main/java/com/juick/www/WebApp.java b/src/main/java/com/juick/www/WebApp.java
index 85e21b1a..69de1507 100644
--- a/src/main/java/com/juick/www/WebApp.java
+++ b/src/main/java/com/juick/www/WebApp.java
@@ -19,7 +19,6 @@ package com.juick.www;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
-import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -31,7 +30,6 @@ import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
-import com.juick.model.Attachment;
import com.juick.model.Message;
import com.juick.model.Tag;
import com.juick.model.User;
diff --git a/src/main/java/com/juick/www/api/Notifications.java b/src/main/java/com/juick/www/api/Notifications.java
index 613e6cfc..43465c1a 100644
--- a/src/main/java/com/juick/www/api/Notifications.java
+++ b/src/main/java/com/juick/www/api/Notifications.java
@@ -17,23 +17,28 @@
package com.juick.www.api;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.inject.Inject;
+
+import com.juick.model.AnonymousUser;
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.util.HttpBadRequestException;
-import com.juick.util.HttpForbiddenException;
import com.juick.service.MessagesService;
import com.juick.service.PushQueriesService;
import com.juick.service.SubscriptionService;
import com.juick.service.TelegramService;
import com.juick.service.UserService;
import com.juick.service.security.annotation.Visitor;
-import io.swagger.v3.oas.annotations.Hidden;
+import com.juick.util.HttpBadRequestException;
+import com.juick.util.HttpForbiddenException;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -41,10 +46,7 @@ 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.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
+import io.swagger.v3.oas.annotations.Hidden;
/**
* Created by vitalyster on 24.10.2016.
diff --git a/src/main/java/com/juick/www/api/SystemActivity.java b/src/main/java/com/juick/www/api/SystemActivity.java
index 5a7c810f..36bc3ad4 100644
--- a/src/main/java/com/juick/www/api/SystemActivity.java
+++ b/src/main/java/com/juick/www/api/SystemActivity.java
@@ -24,9 +24,11 @@ import java.util.Collections;
import java.util.List;
public class SystemActivity {
+ private SystemActivity(ActivityType type) {
+ this.type = type;
+ }
public static SystemActivity like(User from, Message message, List<User> subscribers) {
- var like = new SystemActivity();
- like.setType(ActivityType.like);
+ var like = new SystemActivity(ActivityType.like);
like.setFrom(from);
like.setMessage(message);
like.setTo(subscribers);
@@ -34,8 +36,7 @@ public class SystemActivity {
}
public static SystemActivity message(User from, Message message, List<User> subscribers) {
- var msg = new SystemActivity();
- msg.setType(ActivityType.message);
+ var msg = new SystemActivity(ActivityType.message);
msg.setFrom(from);
msg.setMessage(message);
msg.setTo(subscribers);
@@ -43,8 +44,7 @@ public class SystemActivity {
}
public static SystemActivity read(User from, Message message) {
- var read = new SystemActivity();
- read.setType(ActivityType.message);
+ var read = new SystemActivity(ActivityType.message);
read.setFrom(from);
read.setTo(Collections.emptyList());
var msg = new Message();
@@ -57,7 +57,7 @@ public class SystemActivity {
}
public static SystemActivity follow(User from, List<User> to) {
- var follow = new SystemActivity();
+ var follow = new SystemActivity(ActivityType.follow);
follow.setFrom(from);
follow.setTo(to);
return follow;
@@ -78,10 +78,6 @@ public class SystemActivity {
return type;
}
- public void setType(ActivityType type) {
- this.type = type;
- }
-
public User getFrom() {
return from;
}
diff --git a/src/main/java/com/juick/www/api/Users.java b/src/main/java/com/juick/www/api/Users.java
index 49a4494f..dd620380 100644
--- a/src/main/java/com/juick/www/api/Users.java
+++ b/src/main/java/com/juick/www/api/Users.java
@@ -17,34 +17,46 @@
package com.juick.www.api;
-import com.juick.model.User;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.inject.Inject;
+
import com.juick.model.AnonymousUser;
import com.juick.model.ApplicationStatus;
+import com.juick.model.User;
+import com.juick.service.EmailService;
+import com.juick.service.MessagesService;
+import com.juick.service.StorageService;
+import com.juick.service.TagService;
+import com.juick.service.TelegramService;
+import com.juick.service.UserService;
+import com.juick.service.activities.UpdateUserEvent;
+import com.juick.service.component.MailVerificationEvent;
+import com.juick.service.security.annotation.Visitor;
import com.juick.util.HttpBadRequestException;
import com.juick.util.HttpNotFoundException;
import com.juick.util.HttpUtils;
import com.juick.util.WebUtils;
import com.juick.www.WebApp;
-import com.juick.service.*;
-import com.juick.service.activities.UpdateUserEvent;
-import com.juick.service.component.MailVerificationEvent;
-import com.juick.service.security.annotation.Visitor;
+
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+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 org.springframework.web.multipart.MultipartFile;
-import javax.inject.Inject;
-import java.io.IOException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
/**
* @author ugnich
*/
diff --git a/src/main/java/com/juick/www/api/activity/Profile.java b/src/main/java/com/juick/www/api/activity/Profile.java
index 045e919d..26e2717c 100644
--- a/src/main/java/com/juick/www/api/activity/Profile.java
+++ b/src/main/java/com/juick/www/api/activity/Profile.java
@@ -422,6 +422,6 @@ public class Profile {
@PostMapping(value = { "/u/", "/api/u/" }, produces = MediaType.APPLICATION_JSON_VALUE)
public User fetchUser(@RequestParam URI uri) {
- return activityPubManager.personToUser(uri);
+ return activityPubManager.actorToUser(uri);
}
}
diff --git a/src/main/java/com/juick/www/controllers/Settings.java b/src/main/java/com/juick/www/controllers/Settings.java
index a5597735..8fefadc2 100644
--- a/src/main/java/com/juick/www/controllers/Settings.java
+++ b/src/main/java/com/juick/www/controllers/Settings.java
@@ -16,19 +16,43 @@
*/
package com.juick.www.controllers;
-import com.juick.model.User;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import javax.inject.Inject;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import com.juick.model.NotifyOpts;
+import com.juick.model.User;
+import com.juick.service.EmailService;
+import com.juick.service.StorageService;
+import com.juick.service.SubscriptionService;
+import com.juick.service.TagService;
+import com.juick.service.TelegramService;
+import com.juick.service.UserService;
+import com.juick.service.activities.UpdateUserEvent;
+import com.juick.service.security.annotation.Visitor;
import com.juick.util.HttpBadRequestException;
import com.juick.util.HttpUtils;
import com.juick.www.WebApp;
-import com.juick.service.*;
-import com.juick.service.activities.UpdateUserEvent;
-import com.juick.service.security.annotation.Visitor;
+
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
@@ -37,24 +61,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
-import javax.inject.Inject;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-
/**
*
* @author Ugnich Anton