aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/controllers
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-04-04 01:15:01 +0300
committerGravatar Vitaly Takmazov2020-04-04 01:15:01 +0300
commita608baeed738894433aacfa041e2617f60ce959f (patch)
tree1e0de7056417ff0833ae3d4600de9fec6eb81631 /src/main/java/com/juick/www/controllers
parent7a2f89266c8f6337e4e81a2fd8488e0f80f4f9bd (diff)
Initialize all components from configuration
Diffstat (limited to 'src/main/java/com/juick/www/controllers')
-rw-r--r--src/main/java/com/juick/www/controllers/Help.java2
-rw-r--r--src/main/java/com/juick/www/controllers/Settings.java4
-rw-r--r--src/main/java/com/juick/www/controllers/SignUp.java4
-rw-r--r--src/main/java/com/juick/www/controllers/Site.java13
-rw-r--r--src/main/java/com/juick/www/controllers/SocialLogin.java10
5 files changed, 16 insertions, 17 deletions
diff --git a/src/main/java/com/juick/www/controllers/Help.java b/src/main/java/com/juick/www/controllers/Help.java
index 7fc84060..f65e254a 100644
--- a/src/main/java/com/juick/www/controllers/Help.java
+++ b/src/main/java/com/juick/www/controllers/Help.java
@@ -18,7 +18,7 @@
package com.juick.www.controllers;
import com.juick.model.User;
-import com.juick.server.util.HttpNotFoundException;
+import com.juick.util.HttpNotFoundException;
import com.juick.service.HelpService;
import com.juick.service.security.annotation.Visitor;
import com.juick.www.WebApp;
diff --git a/src/main/java/com/juick/www/controllers/Settings.java b/src/main/java/com/juick/www/controllers/Settings.java
index 851e576b..69ddcd2f 100644
--- a/src/main/java/com/juick/www/controllers/Settings.java
+++ b/src/main/java/com/juick/www/controllers/Settings.java
@@ -18,8 +18,8 @@ package com.juick.www.controllers;
import com.juick.model.User;
import com.juick.model.NotifyOpts;
-import com.juick.server.util.HttpBadRequestException;
-import com.juick.server.util.HttpUtils;
+import com.juick.util.HttpBadRequestException;
+import com.juick.util.HttpUtils;
import com.juick.www.WebApp;
import com.juick.service.*;
import com.juick.service.security.annotation.Visitor;
diff --git a/src/main/java/com/juick/www/controllers/SignUp.java b/src/main/java/com/juick/www/controllers/SignUp.java
index 4e74d4c4..3b052e18 100644
--- a/src/main/java/com/juick/www/controllers/SignUp.java
+++ b/src/main/java/com/juick/www/controllers/SignUp.java
@@ -17,8 +17,8 @@
package com.juick.www.controllers;
import com.juick.model.User;
-import com.juick.server.util.HttpBadRequestException;
-import com.juick.server.util.HttpForbiddenException;
+import com.juick.util.HttpBadRequestException;
+import com.juick.util.HttpForbiddenException;
import com.juick.www.WebApp;
import com.juick.service.CrosspostService;
import com.juick.service.EmailService;
diff --git a/src/main/java/com/juick/www/controllers/Site.java b/src/main/java/com/juick/www/controllers/Site.java
index 61b84f71..a8cbc9bd 100644
--- a/src/main/java/com/juick/www/controllers/Site.java
+++ b/src/main/java/com/juick/www/controllers/Site.java
@@ -19,11 +19,10 @@ package com.juick.www.controllers;
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;
-import com.juick.server.util.HttpNotFoundException;
-import com.juick.server.util.WebUtils;
+import com.juick.util.formatters.PlainTextFormatter;
+import com.juick.util.HttpForbiddenException;
+import com.juick.util.HttpNotFoundException;
+import com.juick.util.WebUtils;
import com.juick.www.WebApp;
import com.juick.service.*;
import com.juick.service.security.annotation.Visitor;
@@ -109,7 +108,7 @@ public class Site {
if (paramSearch != null) {
title = "Поиск: " + StringEscapeUtils.escapeHtml4(paramSearch);
- mids = messagesService.getSearch(visitor, Utils.encodeSphinx(paramSearch), page);
+ mids = messagesService.getSearch(visitor, WebUtils.encodeSphinx(paramSearch), page);
} else if (paramShow == null) {
title = "Обсуждения";
mids = messagesService.getDiscussions(visitor.getUid(), paramTo);
@@ -228,7 +227,7 @@ public class Site {
mids = messagesService.getUserTag(user.getUid(), paramTag.TID, privacy, before);
} else if (paramSearch != null) {
title = "Блог " + user.getName() + ": " + StringEscapeUtils.escapeHtml4(paramSearch);
- mids = messagesService.getUserSearch(visitor, user.getUid(), Utils.encodeSphinx(paramSearch), privacy, page);
+ mids = messagesService.getUserSearch(visitor, user.getUid(), WebUtils.encodeSphinx(paramSearch), privacy, page);
} else {
title = "Блог " + user.getName();
mids = messagesService.getUserBlog(user.getUid(), privacy, before);
diff --git a/src/main/java/com/juick/www/controllers/SocialLogin.java b/src/main/java/com/juick/www/controllers/SocialLogin.java
index 2bd89587..ffd785b7 100644
--- a/src/main/java/com/juick/www/controllers/SocialLogin.java
+++ b/src/main/java/com/juick/www/controllers/SocialLogin.java
@@ -24,13 +24,13 @@ import com.github.scribejava.core.oauth.OAuth10aService;
import com.github.scribejava.core.oauth.OAuth20Service;
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.util.HttpBadRequestException;
import com.juick.service.CrosspostService;
import com.juick.service.EmailService;
import com.juick.service.TelegramService;
import com.juick.service.UserService;
import com.juick.service.security.annotation.Visitor;
+import com.juick.util.WebUtils;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.proc.BadJOSEException;
import org.apache.commons.codec.digest.DigestUtils;
@@ -140,7 +140,7 @@ public class SocialLogin {
if (StringUtils.isBlank(code)) {
String fbstate = UUID.randomUUID().toString();
if (StringUtils.isBlank(state)) {
- state = Utils.getPreviousPageByRequest(request).orElse("https://juick.com/");
+ state = WebUtils.getPreviousPageByRequest(request).orElse("https://juick.com/");
}
crosspostService.addFacebookState(fbstate, state);
return "redirect:" + facebookAuthService.getAuthorizationUrl(fbstate);
@@ -282,7 +282,7 @@ public class SocialLogin {
Cookie c = new Cookie("hash", userService.getHashByUID(uid));
c.setMaxAge(50 * 24 * 60 * 60);
response.addCookie(c);
- return "redirect:/" + Utils.getPreviousPageByRequest(request).orElse(StringUtils.EMPTY);
+ return "redirect:/" + WebUtils.getPreviousPageByRequest(request).orElse(StringUtils.EMPTY);
} else {
String loginhash = UUID.randomUUID().toString();
if (!crosspostService.createVKUser(vkID, loginhash, token.getAccessToken(), vkName, vkLink)) {
@@ -312,7 +312,7 @@ public class SocialLogin {
Cookie c = new Cookie("hash", userService.getHashByUID(uid));
c.setMaxAge(50 * 24 * 60 * 60);
response.addCookie(c);
- return "redirect:/" + Utils.getPreviousPageByRequest(request).orElse(StringUtils.EMPTY);
+ return "redirect:/" + WebUtils.getPreviousPageByRequest(request).orElse(StringUtils.EMPTY);
} else {
String username = StringUtils.defaultString(params.get("username"), params.get("first_name"));
List<Long> chats = telegramService.getAnonymous();