aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/juick/API.java2
-rw-r--r--src/main/java/com/juick/ActivityPubManager.java (renamed from src/main/java/com/juick/server/ActivityPubManager.java)10
-rw-r--r--src/main/java/com/juick/CommandsManager.java (renamed from src/main/java/com/juick/server/CommandsManager.java)14
-rw-r--r--src/main/java/com/juick/EmailManager.java (renamed from src/main/java/com/juick/server/EmailManager.java)10
-rw-r--r--src/main/java/com/juick/KeystoreManager.java (renamed from src/main/java/com/juick/server/KeystoreManager.java)4
-rw-r--r--src/main/java/com/juick/ServerManager.java (renamed from src/main/java/com/juick/server/ServerManager.java)6
-rw-r--r--src/main/java/com/juick/SignatureManager.java (renamed from src/main/java/com/juick/server/SignatureManager.java)6
-rw-r--r--src/main/java/com/juick/TelegramBotManager.java (renamed from src/main/java/com/juick/server/TelegramBotManager.java)10
-rw-r--r--src/main/java/com/juick/TopManager.java (renamed from src/main/java/com/juick/server/TopManager.java)6
-rw-r--r--src/main/java/com/juick/TwitterManager.java (renamed from src/main/java/com/juick/server/TwitterManager.java)6
-rw-r--r--src/main/java/com/juick/XMPPManager.java (renamed from src/main/java/com/juick/server/XMPPManager.java)8
-rw-r--r--src/main/java/com/juick/config/ActivityPubClientErrorHandler.java (renamed from src/main/java/com/juick/server/configuration/ActivityPubClientErrorHandler.java)2
-rw-r--r--src/main/java/com/juick/config/ActivityPubConfig.java (renamed from src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java)13
-rw-r--r--src/main/java/com/juick/config/MailConfig.java (renamed from src/main/java/com/juick/server/configuration/MailConfiguration.java)6
-rw-r--r--src/main/java/com/juick/config/RssConfig.java (renamed from src/main/java/com/juick/server/configuration/ApiAppConfiguration.java)14
-rw-r--r--src/main/java/com/juick/config/SapeConfig.java (renamed from src/main/java/com/juick/server/configuration/SapeConfiguration.java)4
-rw-r--r--src/main/java/com/juick/config/SecurityConfig.java (renamed from src/main/java/com/juick/server/configuration/SecurityConfig.java)4
-rw-r--r--src/main/java/com/juick/config/SignInWithAppleConfig.java (renamed from src/main/java/com/juick/server/configuration/SignInWithAppleConfig.java)2
-rw-r--r--src/main/java/com/juick/config/StorageConfig.java (renamed from src/main/java/com/juick/server/configuration/StorageConfiguration.java)4
-rw-r--r--src/main/java/com/juick/config/TelegramConfig.java (renamed from src/main/java/com/juick/server/configuration/TelegramConfig.java)4
-rw-r--r--src/main/java/com/juick/config/TwitterConfig.java32
-rw-r--r--src/main/java/com/juick/config/WebConfig.java (renamed from src/main/java/com/juick/server/configuration/WwwAppConfiguration.java)52
-rw-r--r--src/main/java/com/juick/config/XMPPConfig.java (renamed from src/main/java/com/juick/server/configuration/XMPPConfig.java)7
-rw-r--r--src/main/java/com/juick/model/Message.java2
-rw-r--r--src/main/java/com/juick/server/Utils.java45
-rw-r--r--src/main/java/com/juick/server/configuration/BaseWebConfiguration.java56
-rw-r--r--src/main/java/com/juick/service/ImagesServiceImpl.java2
-rw-r--r--src/main/java/com/juick/service/UserService.java4
-rw-r--r--src/main/java/com/juick/service/UserServiceImpl.java26
-rw-r--r--src/main/java/com/juick/service/security/HTTPSignatureAuthenticationFilter.java2
-rw-r--r--src/main/java/com/juick/util/HeaderRequestInterceptor.java (renamed from src/main/java/com/juick/server/helpers/HeaderRequestInterceptor.java)4
-rw-r--r--src/main/java/com/juick/util/HttpBadRequestException.java (renamed from src/main/java/com/juick/server/util/HttpBadRequestException.java)4
-rw-r--r--src/main/java/com/juick/util/HttpForbiddenException.java (renamed from src/main/java/com/juick/server/util/HttpForbiddenException.java)4
-rw-r--r--src/main/java/com/juick/util/HttpNotFoundException.java (renamed from src/main/java/com/juick/server/util/HttpNotFoundException.java)4
-rw-r--r--src/main/java/com/juick/util/HttpUtils.java (renamed from src/main/java/com/juick/server/util/HttpUtils.java)4
-rw-r--r--src/main/java/com/juick/util/ImageUtils.java (renamed from src/main/java/com/juick/server/util/ImageUtils.java)4
-rw-r--r--src/main/java/com/juick/util/TagUtils.java (renamed from src/main/java/com/juick/server/util/TagUtils.java)4
-rw-r--r--src/main/java/com/juick/util/WebUtils.java (renamed from src/main/java/com/juick/server/util/WebUtils.java)23
-rw-r--r--src/main/java/com/juick/util/adapters/SimpleDateAdapter.java (renamed from src/main/java/com/juick/adapters/SimpleDateAdapter.java)2
-rw-r--r--src/main/java/com/juick/util/annotation/UserCommand.java (renamed from src/main/java/com/juick/server/helpers/annotation/UserCommand.java)2
-rw-r--r--src/main/java/com/juick/util/formatters/PlainTextFormatter.java (renamed from src/main/java/com/juick/formatters/PlainTextFormatter.java)2
-rw-r--r--src/main/java/com/juick/util/xmpp/JidConverter.java (renamed from src/main/java/com/juick/server/xmpp/JidConverter.java)2
-rw-r--r--src/main/java/com/juick/util/xmpp/iq/MessageQuery.java (renamed from src/main/java/com/juick/server/xmpp/iq/MessageQuery.java)2
-rw-r--r--src/main/java/com/juick/util/xmpp/iq/package-info.java (renamed from src/main/java/com/juick/server/xmpp/iq/package-info.java)2
-rw-r--r--src/main/java/com/juick/www/api/ApiSocialLogin.java2
-rw-r--r--src/main/java/com/juick/www/api/Messages.java8
-rw-r--r--src/main/java/com/juick/www/api/Notifications.java2
-rw-r--r--src/main/java/com/juick/www/api/PM.java6
-rw-r--r--src/main/java/com/juick/www/api/Post.java12
-rw-r--r--src/main/java/com/juick/www/api/Service.java10
-rw-r--r--src/main/java/com/juick/www/api/Users.java8
-rw-r--r--src/main/java/com/juick/www/api/activity/Profile.java12
-rw-r--r--src/main/java/com/juick/www/api/webfinger/Resource.java2
-rw-r--r--src/main/java/com/juick/www/api/webhooks/TelegramWebhook.java2
-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
-rw-r--r--src/main/java/com/juick/www/filters/AnythingFilter.java2
-rw-r--r--src/main/java/com/juick/www/rss/Feeds.java2
61 files changed, 234 insertions, 293 deletions
diff --git a/src/main/java/com/juick/API.java b/src/main/java/com/juick/API.java
index dbe00ad9..608bd78e 100644
--- a/src/main/java/com/juick/API.java
+++ b/src/main/java/com/juick/API.java
@@ -25,7 +25,7 @@ import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@EnableAutoConfiguration(exclude = { MailSenderAutoConfiguration.class })
-@ComponentScan(basePackages = {"com.juick.server", "com.juick.service", "com.juick.www"})
+@ComponentScan(basePackages = {"com.juick.config", "com.juick.service", "com.juick.www"})
public class API {
public static void main(String[] args) {
SpringApplication.run(API.class, args);
diff --git a/src/main/java/com/juick/server/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java
index 50af506b..e3b1ac8e 100644
--- a/src/main/java/com/juick/server/ActivityPubManager.java
+++ b/src/main/java/com/juick/ActivityPubManager.java
@@ -15,12 +15,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server;
+package com.juick;
import com.juick.model.Message;
import com.juick.model.Reaction;
import com.juick.model.User;
-import com.juick.formatters.PlainTextFormatter;
+import com.juick.util.formatters.PlainTextFormatter;
import com.juick.model.Tag;
import com.juick.www.api.SystemActivity.ActivityType;
import com.juick.www.api.activity.model.Context;
@@ -30,8 +30,8 @@ import com.juick.www.api.activity.model.objects.Image;
import com.juick.www.api.activity.model.objects.Mention;
import com.juick.www.api.activity.model.objects.Note;
import com.juick.www.api.activity.model.objects.Person;
-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.service.MessagesService;
import com.juick.service.SocialService;
import com.juick.service.UserService;
@@ -44,7 +44,6 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
@@ -65,7 +64,6 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
-@Component
public class ActivityPubManager implements ActivityListener, NotificationListener {
private static final Logger logger = LoggerFactory.getLogger("ActivityPub");
@Inject
diff --git a/src/main/java/com/juick/server/CommandsManager.java b/src/main/java/com/juick/CommandsManager.java
index bf907855..f7c37b8b 100644
--- a/src/main/java/com/juick/server/CommandsManager.java
+++ b/src/main/java/com/juick/CommandsManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,17 +15,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server;
+package com.juick;
import com.juick.model.Message;
import com.juick.model.Tag;
import com.juick.model.User;
-import com.juick.formatters.PlainTextFormatter;
+import com.juick.util.formatters.PlainTextFormatter;
import com.juick.model.CommandResult;
import com.juick.model.TagStats;
import com.juick.www.api.SystemActivity;
-import com.juick.server.helpers.annotation.UserCommand;
-import com.juick.server.util.HttpUtils;
+import com.juick.util.annotation.UserCommand;
+import com.juick.util.HttpUtils;
import com.juick.www.WebApp;
import com.juick.service.*;
import com.juick.service.activities.DeleteMessageEvent;
@@ -41,7 +41,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.stereotype.Component;
import javax.annotation.Nonnull;
import javax.inject.Inject;
@@ -57,7 +56,6 @@ import java.util.stream.Collectors;
*
* @author ugnich
*/
-@Component
public class CommandsManager {
private static final Logger logger = LoggerFactory.getLogger(CommandsManager.class);
@Inject
@@ -76,8 +74,6 @@ public class CommandsManager {
private SubscriptionService subscriptionService;
@Value("${upload_tmp_dir:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
private String tmpDir;
- @Value("${img_path:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
- private String imgDir;
@Inject
private ApplicationEventPublisher applicationEventPublisher;
@Inject
diff --git a/src/main/java/com/juick/server/EmailManager.java b/src/main/java/com/juick/EmailManager.java
index 522f1db6..e5b527f4 100644
--- a/src/main/java/com/juick/server/EmailManager.java
+++ b/src/main/java/com/juick/EmailManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,14 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server;
+package com.juick;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.juick.model.Message;
import com.juick.model.User;
import com.juick.www.api.SystemActivity;
-import com.juick.server.util.HttpBadRequestException;
+import com.juick.util.HttpBadRequestException;
import com.juick.www.WebApp;
import com.juick.service.EmailService;
import com.juick.service.MessagesService;
@@ -49,8 +49,8 @@ import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import java.util.*;
-import static com.juick.formatters.PlainTextFormatter.formatPost;
-import static com.juick.formatters.PlainTextFormatter.formatUrl;
+import static com.juick.util.formatters.PlainTextFormatter.formatPost;
+import static com.juick.util.formatters.PlainTextFormatter.formatUrl;
public class EmailManager implements NotificationListener {
diff --git a/src/main/java/com/juick/server/KeystoreManager.java b/src/main/java/com/juick/KeystoreManager.java
index 0a66c2c8..50576255 100644
--- a/src/main/java/com/juick/server/KeystoreManager.java
+++ b/src/main/java/com/juick/KeystoreManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server;
+package com.juick;
import com.juick.www.api.activity.model.objects.Person;
import org.slf4j.Logger;
diff --git a/src/main/java/com/juick/server/ServerManager.java b/src/main/java/com/juick/ServerManager.java
index 1f11a9fb..f8f8b8c6 100644
--- a/src/main/java/com/juick/server/ServerManager.java
+++ b/src/main/java/com/juick/ServerManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -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.server;
+package com.juick;
import com.juick.model.Message;
import com.juick.model.User;
@@ -30,7 +30,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import javax.annotation.Nonnull;
@@ -46,7 +45,6 @@ import java.util.stream.Collectors;
/**
* @author Ugnich Anton
*/
-@Component
public class ServerManager implements NotificationListener {
private static final Logger logger = LoggerFactory.getLogger("Session");
diff --git a/src/main/java/com/juick/server/SignatureManager.java b/src/main/java/com/juick/SignatureManager.java
index 602b4285..959242f5 100644
--- a/src/main/java/com/juick/server/SignatureManager.java
+++ b/src/main/java/com/juick/SignatureManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server;
+package com.juick;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.juick.model.User;
@@ -32,7 +32,6 @@ import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import org.tomitribe.auth.signatures.Signature;
@@ -53,7 +52,6 @@ import java.util.Optional;
import static com.juick.www.api.activity.model.Context.ACTIVITY_MEDIA_TYPE;
-@Component
public class SignatureManager {
private static final Logger logger = LoggerFactory.getLogger("ActivityPub");
@Inject
diff --git a/src/main/java/com/juick/server/TelegramBotManager.java b/src/main/java/com/juick/TelegramBotManager.java
index 3c38e5de..3538a27b 100644
--- a/src/main/java/com/juick/server/TelegramBotManager.java
+++ b/src/main/java/com/juick/TelegramBotManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,13 +15,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server;
+package com.juick;
import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.model.CommandResult;
import com.juick.www.api.SystemActivity;
-import com.juick.server.util.HttpUtils;
+import com.juick.util.HttpUtils;
import com.juick.service.MessagesService;
import com.juick.service.TelegramService;
import com.juick.service.UserService;
@@ -60,8 +60,8 @@ import java.net.URI;
import java.net.URL;
import java.util.*;
-import static com.juick.formatters.PlainTextFormatter.formatPost;
-import static com.juick.formatters.PlainTextFormatter.formatUrl;
+import static com.juick.util.formatters.PlainTextFormatter.formatPost;
+import static com.juick.util.formatters.PlainTextFormatter.formatUrl;
/**
* Created by vt on 12/05/16.
diff --git a/src/main/java/com/juick/server/TopManager.java b/src/main/java/com/juick/TopManager.java
index 15abb6cc..611585d3 100644
--- a/src/main/java/com/juick/server/TopManager.java
+++ b/src/main/java/com/juick/TopManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server;
+package com.juick;
import com.juick.model.Message;
import com.juick.model.Tag;
@@ -29,7 +29,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
@@ -37,7 +36,6 @@ import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
-@Component
public class TopManager {
private static Logger logger = LoggerFactory.getLogger(TopManager.class);
@Inject
diff --git a/src/main/java/com/juick/server/TwitterManager.java b/src/main/java/com/juick/TwitterManager.java
index e424784c..9fc2b5c7 100644
--- a/src/main/java/com/juick/server/TwitterManager.java
+++ b/src/main/java/com/juick/TwitterManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -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.server;
+package com.juick;
import com.juick.model.Message;
import com.juick.model.User;
@@ -28,7 +28,6 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
import twitter4j.TwitterFactory;
import twitter4j.conf.ConfigurationBuilder;
@@ -38,7 +37,6 @@ import javax.inject.Inject;
/**
* @author Ugnich Anton
*/
-@Component
public class TwitterManager implements NotificationListener {
private static Logger logger = LoggerFactory.getLogger(TwitterManager.class);
diff --git a/src/main/java/com/juick/server/XMPPManager.java b/src/main/java/com/juick/XMPPManager.java
index 32f1b94e..f2d568af 100644
--- a/src/main/java/com/juick/server/XMPPManager.java
+++ b/src/main/java/com/juick/XMPPManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,14 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server;
+package com.juick;
import com.juick.model.User;
-import com.juick.formatters.PlainTextFormatter;
+import com.juick.util.formatters.PlainTextFormatter;
import com.juick.model.CommandResult;
import com.juick.www.api.SystemActivity;
import com.juick.www.WebApp;
-import com.juick.server.xmpp.iq.MessageQuery;
+import com.juick.util.xmpp.iq.MessageQuery;
import com.juick.service.MessagesService;
import com.juick.service.PMQueriesService;
import com.juick.service.UserService;
diff --git a/src/main/java/com/juick/server/configuration/ActivityPubClientErrorHandler.java b/src/main/java/com/juick/config/ActivityPubClientErrorHandler.java
index edabadd7..cd67fb5e 100644
--- a/src/main/java/com/juick/server/configuration/ActivityPubClientErrorHandler.java
+++ b/src/main/java/com/juick/config/ActivityPubClientErrorHandler.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.configuration;
+package com.juick.config;
import com.juick.service.activities.DeleteUserEvent;
import org.apache.commons.io.IOUtils;
diff --git a/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java b/src/main/java/com/juick/config/ActivityPubConfig.java
index 56edffa7..0411d0c7 100644
--- a/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java
+++ b/src/main/java/com/juick/config/ActivityPubConfig.java
@@ -15,15 +15,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.configuration;
+package com.juick.config;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.juick.ActivityPubManager;
+import com.juick.SignatureManager;
import com.juick.www.api.activity.model.Activity;
-import com.juick.server.helpers.HeaderRequestInterceptor;
+import com.juick.util.HeaderRequestInterceptor;
import org.apache.http.client.config.CookieSpecs;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.protocol.HttpContext;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
@@ -36,7 +39,7 @@ import java.net.URI;
import java.util.Collections;
@Configuration
-public class ActivityPubClientConfig {
+public class ActivityPubConfig {
@Inject
ActivityPubClientErrorHandler activityPubClientErrorHandler;
@Inject
@@ -48,6 +51,10 @@ public class ActivityPubClientConfig {
return converter;
}
@Bean
+ public ActivityPubManager activityPubManager() {
+ return new ActivityPubManager();
+ }
+ @Bean
public RestTemplate apClient() {
RestTemplate restTemplate = new RestTemplate();
restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory() {
diff --git a/src/main/java/com/juick/server/configuration/MailConfiguration.java b/src/main/java/com/juick/config/MailConfig.java
index 31034339..209796be 100644
--- a/src/main/java/com/juick/server/configuration/MailConfiguration.java
+++ b/src/main/java/com/juick/config/MailConfig.java
@@ -15,16 +15,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.configuration;
+package com.juick.config;
-import com.juick.server.EmailManager;
+import com.juick.EmailManager;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConditionalOnProperty("service_email")
-public class MailConfiguration {
+public class MailConfig {
@Bean
public EmailManager emailManager() {
return new EmailManager();
diff --git a/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java b/src/main/java/com/juick/config/RssConfig.java
index 75d247bf..9619f2f7 100644
--- a/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java
+++ b/src/main/java/com/juick/config/RssConfig.java
@@ -15,29 +15,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.configuration;
+package com.juick.config;
import com.juick.www.rss.MessagesView;
import com.juick.www.rss.RepliesView;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableAsync;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-import org.springframework.web.servlet.view.BeanNameViewResolver;
import org.springframework.web.servlet.view.feed.AbstractRssFeedView;
/**
* Created by aalexeev on 11/12/16.
*/
@Configuration
-@EnableAsync(proxyTargetClass = true)
-@EnableScheduling
-public class ApiAppConfiguration implements WebMvcConfigurer {
- @Bean
- public BeanNameViewResolver beanNameViewResolver() {
- return new BeanNameViewResolver();
- }
+public class RssConfig {
@Bean
AbstractRssFeedView messagesView() {
return new MessagesView();
diff --git a/src/main/java/com/juick/server/configuration/SapeConfiguration.java b/src/main/java/com/juick/config/SapeConfig.java
index 8892115d..279cc88f 100644
--- a/src/main/java/com/juick/server/configuration/SapeConfiguration.java
+++ b/src/main/java/com/juick/config/SapeConfig.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.configuration;
+package com.juick.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -28,7 +28,7 @@ import ru.sape.Sape;
*/
@Configuration
@ConditionalOnProperty("sape_user")
-public class SapeConfiguration {
+public class SapeConfig {
@Value("${sape_user:}")
private String token;
diff --git a/src/main/java/com/juick/server/configuration/SecurityConfig.java b/src/main/java/com/juick/config/SecurityConfig.java
index 0fab087f..8f6325f6 100644
--- a/src/main/java/com/juick/server/configuration/SecurityConfig.java
+++ b/src/main/java/com/juick/config/SecurityConfig.java
@@ -15,9 +15,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.configuration;
+package com.juick.config;
-import com.juick.server.SignatureManager;
+import com.juick.SignatureManager;
import com.juick.service.UserService;
import com.juick.service.security.HTTPSignatureAuthenticationFilter;
import com.juick.service.security.HashParamAuthenticationFilter;
diff --git a/src/main/java/com/juick/server/configuration/SignInWithAppleConfig.java b/src/main/java/com/juick/config/SignInWithAppleConfig.java
index 310c5899..0b41cb7e 100644
--- a/src/main/java/com/juick/server/configuration/SignInWithAppleConfig.java
+++ b/src/main/java/com/juick/config/SignInWithAppleConfig.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.configuration;
+package com.juick.config;
import com.github.scribejava.apis.AppleClientSecretGenerator;
import org.springframework.beans.factory.annotation.Value;
diff --git a/src/main/java/com/juick/server/configuration/StorageConfiguration.java b/src/main/java/com/juick/config/StorageConfig.java
index f4a80ece..d46b0a4f 100644
--- a/src/main/java/com/juick/server/configuration/StorageConfiguration.java
+++ b/src/main/java/com/juick/config/StorageConfig.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.configuration;
+package com.juick.config;
import com.juick.service.ImagesService;
import com.juick.service.ImagesServiceImpl;
@@ -24,7 +24,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
-public class StorageConfiguration {
+public class StorageConfig {
@Value("${upload_tmp_dir:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
private String tmpDir;
diff --git a/src/main/java/com/juick/server/configuration/TelegramConfig.java b/src/main/java/com/juick/config/TelegramConfig.java
index c56d7d0e..fb0abd4f 100644
--- a/src/main/java/com/juick/server/configuration/TelegramConfig.java
+++ b/src/main/java/com/juick/config/TelegramConfig.java
@@ -15,9 +15,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.configuration;
+package com.juick.config;
-import com.juick.server.TelegramBotManager;
+import com.juick.TelegramBotManager;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
diff --git a/src/main/java/com/juick/config/TwitterConfig.java b/src/main/java/com/juick/config/TwitterConfig.java
new file mode 100644
index 00000000..22540dc5
--- /dev/null
+++ b/src/main/java/com/juick/config/TwitterConfig.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2008-2020, 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.config;
+
+import com.juick.TwitterManager;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ConditionalOnProperty("twitter_consumer_key")
+public class TwitterConfig {
+ @Bean
+ public TwitterManager twitterManager() {
+ return new TwitterManager();
+ }
+}
diff --git a/src/main/java/com/juick/server/configuration/WwwAppConfiguration.java b/src/main/java/com/juick/config/WebConfig.java
index 8e874e43..506c4dcf 100644
--- a/src/main/java/com/juick/server/configuration/WwwAppConfiguration.java
+++ b/src/main/java/com/juick/config/WebConfig.java
@@ -15,17 +15,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.configuration;
+package com.juick.config;
+import com.juick.*;
import com.juick.service.HelpService;
-import com.juick.service.TagService;
-import com.juick.service.UserService;
import com.mitchellbosecke.pebble.PebbleEngine;
import com.mitchellbosecke.pebble.extension.FormatterExtension;
import com.mitchellbosecke.pebble.loader.ClasspathLoader;
import com.mitchellbosecke.pebble.loader.Loader;
import com.mitchellbosecke.pebble.spring.extension.SpringExtension;
import com.mitchellbosecke.pebble.spring.servlet.PebbleViewResolver;
+import com.overzealous.remark.Options;
+import com.overzealous.remark.Remark;
import org.apache.commons.codec.CharEncoding;
import org.commonmark.ext.autolink.AutolinkExtension;
import org.commonmark.node.Link;
@@ -36,13 +37,16 @@ import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.Resource;
import org.springframework.http.CacheControl;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter;
import org.springframework.web.servlet.resource.VersionResourceResolver;
-import javax.inject.Inject;
import java.net.MalformedURLException;
import java.nio.file.Paths;
import java.util.Collections;
@@ -53,7 +57,9 @@ import java.util.concurrent.TimeUnit;
*/
@Configuration
@EnableCaching
-public class WwwAppConfiguration implements WebMvcConfigurer {
+@EnableAsync(proxyTargetClass = true)
+@EnableScheduling
+public class WebConfig implements WebMvcConfigurer {
@Value("${img_path:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
private String imgDir;
@Bean
@@ -114,6 +120,41 @@ public class WwwAppConfiguration implements WebMvcConfigurer {
.build();
}
+ @Value("${keystore:classpath:juick-test-key.p12}")
+ private Resource keystore;
+ @Value("${keystore_password:secret}")
+ private String keystorePassword;
+ @Bean
+ public ResourceUrlEncodingFilter resourceUrlEncodingFilter() {
+ return new ResourceUrlEncodingFilter();
+ }
+ @Bean
+ public KeystoreManager keystoreManager() {
+ return new KeystoreManager(keystore, keystorePassword);
+ }
+ @Bean
+ public Remark remarkConverter() {
+ Options options = new Options();
+ options.inlineLinks = true;
+ return new Remark(options);
+ }
+ @Bean
+ public CommandsManager commandsManager() {
+ return new CommandsManager();
+ }
+ @Bean
+ public ServerManager serverManager() {
+ return new ServerManager();
+ }
+ @Bean
+ public SignatureManager signatureManager() {
+ return new SignatureManager();
+ }
+ @Bean
+ public TopManager topManager() {
+ return new TopManager();
+ }
+
@Bean
public ViewResolver viewResolver() {
PebbleViewResolver viewResolver = new PebbleViewResolver();
@@ -136,4 +177,5 @@ public class WwwAppConfiguration implements WebMvcConfigurer {
e.printStackTrace();
}
}
+
}
diff --git a/src/main/java/com/juick/server/configuration/XMPPConfig.java b/src/main/java/com/juick/config/XMPPConfig.java
index 62e19c71..8a8fa4cc 100644
--- a/src/main/java/com/juick/server/configuration/XMPPConfig.java
+++ b/src/main/java/com/juick/config/XMPPConfig.java
@@ -15,11 +15,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.configuration;
+package com.juick.config;
-import com.juick.server.XMPPManager;
-import com.juick.server.xmpp.JidConverter;
-import org.springframework.beans.factory.annotation.Value;
+import com.juick.XMPPManager;
+import com.juick.util.xmpp.JidConverter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
diff --git a/src/main/java/com/juick/model/Message.java b/src/main/java/com/juick/model/Message.java
index b1460957..e53afbfe 100644
--- a/src/main/java/com/juick/model/Message.java
+++ b/src/main/java/com/juick/model/Message.java
@@ -19,7 +19,7 @@ package com.juick.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.juick.adapters.SimpleDateAdapter;
+import com.juick.util.adapters.SimpleDateAdapter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import javax.annotation.Nonnull;
diff --git a/src/main/java/com/juick/server/Utils.java b/src/main/java/com/juick/server/Utils.java
deleted file mode 100644
index 58662c71..00000000
--- a/src/main/java/com/juick/server/Utils.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2008-2019, 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.server;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Optional;
-
-/**
- *
- * @author Ugnich Anton
- */
-public class Utils {
-
-
- public static String encodeSphinx(String str) {
- return str.replaceAll("@", "\\\\@")
- .replaceAll("\\'", "\\\\'")
- .replaceAll("=", "\\\\\\\\=");
- }
- /**
- * Returns the viewName to return for coming back to the sender url
- *
- * @param request Instance of {@link HttpServletRequest} or use an injected instance
- * @return Optional with the view name. Recomended to use an alternativa url with
- * {@link Optional#orElse(java.lang.Object)}
- */
- public static Optional<String> getPreviousPageByRequest(HttpServletRequest request)
- {
- return Optional.ofNullable(request.getHeader("Referer"));
- }
-}
diff --git a/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java b/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java
deleted file mode 100644
index e84c0c40..00000000
--- a/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2008-2019, 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.server.configuration;
-
-import com.juick.server.KeystoreManager;
-import com.overzealous.remark.Options;
-import com.overzealous.remark.Remark;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.io.Resource;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter;
-
-/**
- * Created by vitalyster on 28.06.2016.
- */
-@Configuration
-public class BaseWebConfiguration implements WebMvcConfigurer {
-
- @Value("${keystore:classpath:juick-test-key.p12}")
- private Resource keystore;
- @Value("${keystore_password:secret}")
- private String keystorePassword;
-
- @Bean
- public ResourceUrlEncodingFilter resourceUrlEncodingFilter() {
- return new ResourceUrlEncodingFilter();
- }
-
- @Bean
- public KeystoreManager keystoreManager() {
- return new KeystoreManager(keystore, keystorePassword);
- }
- @Bean
- public Remark remarkConverter() {
- Options options = new Options();
- options.inlineLinks = true;
- return new Remark(options);
- }
-}
diff --git a/src/main/java/com/juick/service/ImagesServiceImpl.java b/src/main/java/com/juick/service/ImagesServiceImpl.java
index abaec940..5884b0d0 100644
--- a/src/main/java/com/juick/service/ImagesServiceImpl.java
+++ b/src/main/java/com/juick/service/ImagesServiceImpl.java
@@ -20,7 +20,7 @@ package com.juick.service;
import com.juick.model.Attachment;
import com.juick.model.Message;
import com.juick.model.Photo;
-import com.juick.server.util.ImageUtils;
+import com.juick.util.ImageUtils;
import org.springframework.util.StringUtils;
import java.io.File;
diff --git a/src/main/java/com/juick/service/UserService.java b/src/main/java/com/juick/service/UserService.java
index 4bd5486d..fbbab0ad 100644
--- a/src/main/java/com/juick/service/UserService.java
+++ b/src/main/java/com/juick/service/UserService.java
@@ -55,12 +55,8 @@ public interface UserService {
List<String> getJIDsbyUID(int uid);
- int getUIDbyJID(String jid);
-
int getUIDbyName(String uname);
- int getUIDbyHash(String hash);
-
@Nonnull
User getUserByHash(String hash);
diff --git a/src/main/java/com/juick/service/UserServiceImpl.java b/src/main/java/com/juick/service/UserServiceImpl.java
index 23c55bbe..84ff1ff5 100644
--- a/src/main/java/com/juick/service/UserServiceImpl.java
+++ b/src/main/java/com/juick/service/UserServiceImpl.java
@@ -250,19 +250,6 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
@Transactional(readOnly = true)
@Override
- public int getUIDbyJID(final String jid) {
- if (StringUtils.isNotBlank(jid)) {
- List<Integer> list = getJdbcTemplate().queryForList(
- "SELECT user_id FROM jids WHERE jid = ?", Integer.class, jid);
-
- if (!list.isEmpty())
- return list.get(0);
- }
- return 0;
- }
-
- @Transactional(readOnly = true)
- @Override
public int getUIDbyName(final String uname) {
if (StringUtils.isNotBlank(uname)) {
List<Integer> list = getJdbcTemplate().queryForList(
@@ -276,19 +263,6 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
@Transactional(readOnly = true)
@Override
- public int getUIDbyHash(final String hash) {
- if (StringUtils.isNotBlank(hash)) {
- List<Integer> list = getJdbcTemplate().queryForList(
- "SELECT user_id FROM logins WHERE hash = ?", Integer.class, hash);
-
- if (!list.isEmpty())
- return list.get(0);
- }
- return 0;
- }
-
- @Transactional(readOnly = true)
- @Override
public User getUserByHash(final String hash) {
if (StringUtils.isNotBlank(hash)) {
List<User> list = getJdbcTemplate().query(
diff --git a/src/main/java/com/juick/service/security/HTTPSignatureAuthenticationFilter.java b/src/main/java/com/juick/service/security/HTTPSignatureAuthenticationFilter.java
index 1b3cb936..9878df82 100644
--- a/src/main/java/com/juick/service/security/HTTPSignatureAuthenticationFilter.java
+++ b/src/main/java/com/juick/service/security/HTTPSignatureAuthenticationFilter.java
@@ -18,7 +18,7 @@
package com.juick.service.security;
import com.juick.model.User;
-import com.juick.server.SignatureManager;
+import com.juick.SignatureManager;
import com.juick.service.UserService;
import com.juick.service.security.entities.JuickUser;
import org.apache.commons.lang3.StringUtils;
diff --git a/src/main/java/com/juick/server/helpers/HeaderRequestInterceptor.java b/src/main/java/com/juick/util/HeaderRequestInterceptor.java
index 8fb21ac5..22a3de06 100644
--- a/src/main/java/com/juick/server/helpers/HeaderRequestInterceptor.java
+++ b/src/main/java/com/juick/util/HeaderRequestInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.helpers;
+package com.juick.util;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
diff --git a/src/main/java/com/juick/server/util/HttpBadRequestException.java b/src/main/java/com/juick/util/HttpBadRequestException.java
index 6dfc165e..386b52df 100644
--- a/src/main/java/com/juick/server/util/HttpBadRequestException.java
+++ b/src/main/java/com/juick/util/HttpBadRequestException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.util;
+package com.juick.util;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
diff --git a/src/main/java/com/juick/server/util/HttpForbiddenException.java b/src/main/java/com/juick/util/HttpForbiddenException.java
index 0247f531..e2211574 100644
--- a/src/main/java/com/juick/server/util/HttpForbiddenException.java
+++ b/src/main/java/com/juick/util/HttpForbiddenException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.util;
+package com.juick.util;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus;
diff --git a/src/main/java/com/juick/server/util/HttpNotFoundException.java b/src/main/java/com/juick/util/HttpNotFoundException.java
index dd5a2e1b..f9d1ffbe 100644
--- a/src/main/java/com/juick/server/util/HttpNotFoundException.java
+++ b/src/main/java/com/juick/util/HttpNotFoundException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.util;
+package com.juick.util;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus;
diff --git a/src/main/java/com/juick/server/util/HttpUtils.java b/src/main/java/com/juick/util/HttpUtils.java
index beef5d60..46bb3e2d 100644
--- a/src/main/java/com/juick/server/util/HttpUtils.java
+++ b/src/main/java/com/juick/util/HttpUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -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.server.util;
+package com.juick.util;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
diff --git a/src/main/java/com/juick/server/util/ImageUtils.java b/src/main/java/com/juick/util/ImageUtils.java
index e06339ba..38e1de08 100644
--- a/src/main/java/com/juick/server/util/ImageUtils.java
+++ b/src/main/java/com/juick/util/ImageUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.util;
+package com.juick.util;
import com.juick.model.Attachment;
import org.apache.commons.imaging.ImageReadException;
diff --git a/src/main/java/com/juick/server/util/TagUtils.java b/src/main/java/com/juick/util/TagUtils.java
index 754d8020..2ec03e48 100644
--- a/src/main/java/com/juick/server/util/TagUtils.java
+++ b/src/main/java/com/juick/util/TagUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.util;
+package com.juick.util;
import com.juick.model.Tag;
import org.apache.commons.collections4.CollectionUtils;
diff --git a/src/main/java/com/juick/server/util/WebUtils.java b/src/main/java/com/juick/util/WebUtils.java
index bc3ac63a..3a8c7620 100644
--- a/src/main/java/com/juick/server/util/WebUtils.java
+++ b/src/main/java/com/juick/util/WebUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,8 +15,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.util;
+package com.juick.util;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Optional;
import java.util.regex.Pattern;
/**
@@ -58,5 +60,20 @@ public class WebUtils {
return !isJid(aString);
}
-
+ public static String encodeSphinx(String str) {
+ return str.replaceAll("@", "\\\\@")
+ .replaceAll("\\'", "\\\\'")
+ .replaceAll("=", "\\\\\\\\=");
+ }
+ /**
+ * Returns the viewName to return for coming back to the sender url
+ *
+ * @param request Instance of {@link HttpServletRequest} or use an injected instance
+ * @return Optional with the view name. Recomended to use an alternativa url with
+ * {@link Optional#orElse(java.lang.Object)}
+ */
+ public static Optional<String> getPreviousPageByRequest(HttpServletRequest request)
+ {
+ return Optional.ofNullable(request.getHeader("Referer"));
+ }
}
diff --git a/src/main/java/com/juick/adapters/SimpleDateAdapter.java b/src/main/java/com/juick/util/adapters/SimpleDateAdapter.java
index 8f75fb7c..fd5f3b5a 100644
--- a/src/main/java/com/juick/adapters/SimpleDateAdapter.java
+++ b/src/main/java/com/juick/util/adapters/SimpleDateAdapter.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.adapters;
+package com.juick.util.adapters;
import com.juick.util.DateFormattersHolder;
diff --git a/src/main/java/com/juick/server/helpers/annotation/UserCommand.java b/src/main/java/com/juick/util/annotation/UserCommand.java
index d25810d2..29e40ca2 100644
--- a/src/main/java/com/juick/server/helpers/annotation/UserCommand.java
+++ b/src/main/java/com/juick/util/annotation/UserCommand.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.helpers.annotation;
+package com.juick.util.annotation;
import org.apache.commons.lang3.StringUtils;
diff --git a/src/main/java/com/juick/formatters/PlainTextFormatter.java b/src/main/java/com/juick/util/formatters/PlainTextFormatter.java
index 21cabac2..b5d67030 100644
--- a/src/main/java/com/juick/formatters/PlainTextFormatter.java
+++ b/src/main/java/com/juick/util/formatters/PlainTextFormatter.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.formatters;
+package com.juick.util.formatters;
import com.juick.model.Message;
import com.juick.util.MessageUtils;
diff --git a/src/main/java/com/juick/server/xmpp/JidConverter.java b/src/main/java/com/juick/util/xmpp/JidConverter.java
index fdf80108..118c6711 100644
--- a/src/main/java/com/juick/server/xmpp/JidConverter.java
+++ b/src/main/java/com/juick/util/xmpp/JidConverter.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.xmpp;
+package com.juick.util.xmpp;
import org.springframework.core.convert.converter.Converter;
import org.springframework.lang.Nullable;
diff --git a/src/main/java/com/juick/server/xmpp/iq/MessageQuery.java b/src/main/java/com/juick/util/xmpp/iq/MessageQuery.java
index c973b624..c1096e8e 100644
--- a/src/main/java/com/juick/server/xmpp/iq/MessageQuery.java
+++ b/src/main/java/com/juick/util/xmpp/iq/MessageQuery.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.server.xmpp.iq;
+package com.juick.util.xmpp.iq;
import javax.xml.bind.annotation.XmlRootElement;
diff --git a/src/main/java/com/juick/server/xmpp/iq/package-info.java b/src/main/java/com/juick/util/xmpp/iq/package-info.java
index 822fb8c4..7a1694a5 100644
--- a/src/main/java/com/juick/server/xmpp/iq/package-info.java
+++ b/src/main/java/com/juick/util/xmpp/iq/package-info.java
@@ -17,7 +17,7 @@
@XmlAccessorType(XmlAccessType.FIELD)
@XmlSchema(namespace = "http://juick.com/query#messages", elementFormDefault = XmlNsForm.QUALIFIED)
-package com.juick.server.xmpp.iq;
+package com.juick.util.xmpp.iq;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
diff --git a/src/main/java/com/juick/www/api/ApiSocialLogin.java b/src/main/java/com/juick/www/api/ApiSocialLogin.java
index 6499b507..101f6b1f 100644
--- a/src/main/java/com/juick/www/api/ApiSocialLogin.java
+++ b/src/main/java/com/juick/www/api/ApiSocialLogin.java
@@ -34,7 +34,7 @@ import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.juick.model.AuthResponse;
import com.juick.model.ext.facebook.User;
-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.UserService;
diff --git a/src/main/java/com/juick/www/api/Messages.java b/src/main/java/com/juick/www/api/Messages.java
index 59ed7c8f..de29c78c 100644
--- a/src/main/java/com/juick/www/api/Messages.java
+++ b/src/main/java/com/juick/www/api/Messages.java
@@ -20,10 +20,10 @@ package com.juick.www.api;
import com.juick.model.Message;
import com.juick.model.Tag;
import com.juick.model.User;
-import com.juick.server.Utils;
+import com.juick.util.WebUtils;
import com.juick.www.WebApp;
import com.juick.model.CommandResult;
-import com.juick.server.util.HttpBadRequestException;
+import com.juick.util.HttpBadRequestException;
import com.juick.service.MessagesService;
import com.juick.service.TagService;
import com.juick.service.UserService;
@@ -119,7 +119,7 @@ public class Messages {
} else if (daysback > 0) {
mids = messagesService.getUserBlogAtDay(user.getUid(), 0, daysback);
} else if (!StringUtils.isEmpty(search)) {
- mids = messagesService.getUserSearch(visitor, user.getUid(), Utils.encodeSphinx(search), 0, page);
+ mids = messagesService.getUserSearch(visitor, user.getUid(), WebUtils.encodeSphinx(search), 0, page);
} else {
mids = messagesService.getUserBlog(user.getUid(), 0, before);
}
@@ -139,7 +139,7 @@ public class Messages {
return NOT_FOUND;
}
} else if (!StringUtils.isEmpty(search)) {
- mids = messagesService.getSearch(visitor, Utils.encodeSphinx(search), page);
+ mids = messagesService.getSearch(visitor, WebUtils.encodeSphinx(search), page);
} else {
mids = messagesService.getAll(visitor.getUid(), before);
}
diff --git a/src/main/java/com/juick/www/api/Notifications.java b/src/main/java/com/juick/www/api/Notifications.java
index ca382246..4f6096ce 100644
--- a/src/main/java/com/juick/www/api/Notifications.java
+++ b/src/main/java/com/juick/www/api/Notifications.java
@@ -22,7 +22,7 @@ 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.util.HttpBadRequestException;
import com.juick.service.MessagesService;
import com.juick.service.PushQueriesService;
import com.juick.service.SubscriptionService;
diff --git a/src/main/java/com/juick/www/api/PM.java b/src/main/java/com/juick/www/api/PM.java
index b81dcc78..863a1055 100644
--- a/src/main/java/com/juick/www/api/PM.java
+++ b/src/main/java/com/juick/www/api/PM.java
@@ -22,9 +22,9 @@ 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;
-import com.juick.server.util.HttpForbiddenException;
-import com.juick.server.util.WebUtils;
+import com.juick.util.HttpBadRequestException;
+import com.juick.util.HttpForbiddenException;
+import com.juick.util.WebUtils;
import com.juick.www.WebApp;
import com.juick.service.PMQueriesService;
import com.juick.service.UserService;
diff --git a/src/main/java/com/juick/www/api/Post.java b/src/main/java/com/juick/www/api/Post.java
index 3c1fbf6b..205c8c90 100644
--- a/src/main/java/com/juick/www/api/Post.java
+++ b/src/main/java/com/juick/www/api/Post.java
@@ -22,12 +22,12 @@ 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;
-import com.juick.server.util.HttpBadRequestException;
-import com.juick.server.util.HttpForbiddenException;
-import com.juick.server.util.HttpNotFoundException;
-import com.juick.server.util.HttpUtils;
+import com.juick.ActivityPubManager;
+import com.juick.CommandsManager;
+import com.juick.util.HttpBadRequestException;
+import com.juick.util.HttpForbiddenException;
+import com.juick.util.HttpNotFoundException;
+import com.juick.util.HttpUtils;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
import com.juick.service.activities.UpdateEvent;
diff --git a/src/main/java/com/juick/www/api/Service.java b/src/main/java/com/juick/www/api/Service.java
index cb918682..850acb9d 100644
--- a/src/main/java/com/juick/www/api/Service.java
+++ b/src/main/java/com/juick/www/api/Service.java
@@ -20,11 +20,11 @@ package com.juick.www.api;
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;
-import com.juick.server.ServerManager;
-import com.juick.server.util.HttpBadRequestException;
-import com.juick.server.util.HttpForbiddenException;
+import com.juick.CommandsManager;
+import com.juick.EmailManager;
+import com.juick.ServerManager;
+import com.juick.util.HttpBadRequestException;
+import com.juick.util.HttpForbiddenException;
import com.juick.service.EmailService;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
diff --git a/src/main/java/com/juick/www/api/Users.java b/src/main/java/com/juick/www/api/Users.java
index 06467b7d..f4c3a4c1 100644
--- a/src/main/java/com/juick/www/api/Users.java
+++ b/src/main/java/com/juick/www/api/Users.java
@@ -20,10 +20,10 @@ package com.juick.www.api;
import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.model.ApplicationStatus;
-import com.juick.server.util.HttpBadRequestException;
-import com.juick.server.util.HttpNotFoundException;
-import com.juick.server.util.HttpUtils;
-import com.juick.server.util.WebUtils;
+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.component.MailVerificationEvent;
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 bdd7cab2..ef9b342f 100644
--- a/src/main/java/com/juick/www/api/activity/Profile.java
+++ b/src/main/java/com/juick/www/api/activity/Profile.java
@@ -20,12 +20,12 @@ package com.juick.www.api.activity;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.juick.model.Message;
import com.juick.model.User;
-import com.juick.formatters.PlainTextFormatter;
+import com.juick.util.formatters.PlainTextFormatter;
import com.juick.model.CommandResult;
-import com.juick.server.ActivityPubManager;
-import com.juick.server.CommandsManager;
-import com.juick.server.KeystoreManager;
-import com.juick.server.SignatureManager;
+import com.juick.ActivityPubManager;
+import com.juick.CommandsManager;
+import com.juick.KeystoreManager;
+import com.juick.SignatureManager;
import com.juick.www.api.activity.model.Activity;
import com.juick.www.api.activity.model.Context;
import com.juick.www.api.activity.model.activities.Announce;
@@ -40,7 +40,7 @@ import com.juick.www.api.activity.model.objects.Note;
import com.juick.www.api.activity.model.objects.OrderedCollection;
import com.juick.www.api.activity.model.objects.OrderedCollectionPage;
import com.juick.www.api.activity.model.objects.Person;
-import com.juick.server.util.HttpNotFoundException;
+import com.juick.util.HttpNotFoundException;
import com.juick.www.WebApp;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
diff --git a/src/main/java/com/juick/www/api/webfinger/Resource.java b/src/main/java/com/juick/www/api/webfinger/Resource.java
index 1529ea09..1e8b45e5 100644
--- a/src/main/java/com/juick/www/api/webfinger/Resource.java
+++ b/src/main/java/com/juick/www/api/webfinger/Resource.java
@@ -20,7 +20,7 @@ package com.juick.www.api.webfinger;
import com.juick.model.User;
import com.juick.www.api.webfinger.model.Account;
import com.juick.www.api.webfinger.model.Link;
-import com.juick.server.util.HttpNotFoundException;
+import com.juick.util.HttpNotFoundException;
import com.juick.service.UserService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
diff --git a/src/main/java/com/juick/www/api/webhooks/TelegramWebhook.java b/src/main/java/com/juick/www/api/webhooks/TelegramWebhook.java
index 32218b3a..8090f388 100644
--- a/src/main/java/com/juick/www/api/webhooks/TelegramWebhook.java
+++ b/src/main/java/com/juick/www/api/webhooks/TelegramWebhook.java
@@ -17,7 +17,7 @@
package com.juick.www.api.webhooks;
-import com.juick.server.TelegramBotManager;
+import com.juick.TelegramBotManager;
import com.pengrad.telegrambot.BotUtils;
import com.pengrad.telegrambot.model.Update;
import org.apache.commons.io.IOUtils;
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();
diff --git a/src/main/java/com/juick/www/filters/AnythingFilter.java b/src/main/java/com/juick/www/filters/AnythingFilter.java
index 8f9af7f6..461a2888 100644
--- a/src/main/java/com/juick/www/filters/AnythingFilter.java
+++ b/src/main/java/com/juick/www/filters/AnythingFilter.java
@@ -18,7 +18,7 @@
package com.juick.www.filters;
import com.juick.model.User;
-import com.juick.server.util.WebUtils;
+import com.juick.util.WebUtils;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
import org.apache.commons.lang3.math.NumberUtils;
diff --git a/src/main/java/com/juick/www/rss/Feeds.java b/src/main/java/com/juick/www/rss/Feeds.java
index 42cadc5d..1817301e 100644
--- a/src/main/java/com/juick/www/rss/Feeds.java
+++ b/src/main/java/com/juick/www/rss/Feeds.java
@@ -18,7 +18,7 @@
package com.juick.www.rss;
import com.juick.model.User;
-import com.juick.server.util.HttpNotFoundException;
+import com.juick.util.HttpNotFoundException;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
import com.juick.service.security.annotation.Visitor;