aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-api/build.gradle7
-rw-r--r--juick-server-jdbc/build.gradle6
-rw-r--r--juick-server-jdbc/src/main/java/com/juick/configuration/UpdaterConfiguration.java47
-rw-r--r--juick-server-jdbc/src/main/java/com/juick/database/MySqlUpdater.java153
-rw-r--r--juick-server/build.gradle7
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Post.java (renamed from juick-api/src/main/java/com/juick/server/api/Post.java)0
-rw-r--r--juick-server/src/main/java/com/juick/server/configuration/ApiSecurityConfig.java (renamed from juick-api/src/main/java/com/juick/server/configuration/ApiSecurityConfig.java)0
-rw-r--r--juick-server/src/main/java/com/juick/server/configuration/PostConfig.java (renamed from juick-api/src/main/java/com/juick/server/configuration/PostConfig.java)0
-rw-r--r--juick-server/src/main/java/com/juick/service/BaseJdbcService.java (renamed from juick-server-jdbc/src/main/java/com/juick/service/BaseJdbcService.java)0
-rw-r--r--juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java (renamed from juick-server-jdbc/src/main/java/com/juick/service/CrosspostServiceImpl.java)0
-rw-r--r--juick-server/src/main/java/com/juick/service/EmailServiceImpl.java (renamed from juick-server-jdbc/src/main/java/com/juick/service/EmailServiceImpl.java)0
-rw-r--r--juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java (renamed from juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java)0
-rw-r--r--juick-server/src/main/java/com/juick/service/MessengerServiceImpl.java (renamed from juick-server-jdbc/src/main/java/com/juick/service/MessengerServiceImpl.java)0
-rw-r--r--juick-server/src/main/java/com/juick/service/PMQueriesServiceImpl.java (renamed from juick-server-jdbc/src/main/java/com/juick/service/PMQueriesServiceImpl.java)0
-rw-r--r--juick-server/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java (renamed from juick-server-jdbc/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java)0
-rw-r--r--juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java (renamed from juick-server-jdbc/src/main/java/com/juick/service/PushQueriesServiceImpl.java)0
-rw-r--r--juick-server/src/main/java/com/juick/service/ShowQueriesServiceImpl.java (renamed from juick-server-jdbc/src/main/java/com/juick/service/ShowQueriesServiceImpl.java)0
-rw-r--r--juick-server/src/main/java/com/juick/service/SphinxSearchService.java (renamed from juick-server-jdbc/src/main/java/com/juick/service/SphinxSearchService.java)0
-rw-r--r--juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java (renamed from juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java)0
-rw-r--r--juick-server/src/main/java/com/juick/service/TagServiceImpl.java (renamed from juick-server-jdbc/src/main/java/com/juick/service/TagServiceImpl.java)0
-rw-r--r--juick-server/src/main/java/com/juick/service/TelegramServiceImpl.java (renamed from juick-server-jdbc/src/main/java/com/juick/service/TelegramServiceImpl.java)0
-rw-r--r--juick-server/src/main/java/com/juick/service/UserServiceImpl.java (renamed from juick-server-jdbc/src/main/java/com/juick/service/UserServiceImpl.java)0
-rw-r--r--juick-server/src/main/java/ru/sape/Sape.java (renamed from juick-www/src/main/java/ru/sape/Sape.java)0
-rw-r--r--juick-server/src/main/java/ru/sape/SapeConnection.java (renamed from juick-www/src/main/java/ru/sape/SapeConnection.java)0
-rw-r--r--juick-server/src/main/java/ru/sape/SapePageLinks.java (renamed from juick-www/src/main/java/ru/sape/SapePageLinks.java)0
-rw-r--r--juick-server/src/main/resources/juick.sql (renamed from juick-server-jdbc/src/main/resources/juick.sql)0
-rw-r--r--juick-server/src/main/resources/pg_schema_wip (renamed from juick-server-jdbc/src/main/resources/pg_schema_wip)0
-rw-r--r--juick-server/src/main/resources/schema.sql (renamed from juick-server-jdbc/src/main/resources/schema.sql)0
-rw-r--r--juick-server/src/main/resources/update.sql (renamed from juick-server-jdbc/src/main/resources/update.sql)0
-rw-r--r--juick-www/src/main/java/com/mitchellbosecke/pebble/extension/FormatterExtension.java38
-rw-r--r--juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java52
-rw-r--r--juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/PrettyTimeFilter.java51
-rw-r--r--juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java41
-rw-r--r--juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TimestampFilter.java23
-rw-r--r--settings.gradle2
35 files changed, 6 insertions, 421 deletions
diff --git a/juick-api/build.gradle b/juick-api/build.gradle
deleted file mode 100644
index 2899529a..00000000
--- a/juick-api/build.gradle
+++ /dev/null
@@ -1,7 +0,0 @@
-apply plugin: 'java'
-
-dependencies {
- compile project(':juick-common')
- compile project(':juick-server-jdbc')
- compile 'org.apache.commons:commons-email:1.5'
-} \ No newline at end of file
diff --git a/juick-server-jdbc/build.gradle b/juick-server-jdbc/build.gradle
deleted file mode 100644
index 7052b04d..00000000
--- a/juick-server-jdbc/build.gradle
+++ /dev/null
@@ -1,6 +0,0 @@
-apply plugin: 'java'
-
-dependencies {
- compile("org.springframework.boot:spring-boot-starter-jdbc")
- compile project(':juick-common')
-}
diff --git a/juick-server-jdbc/src/main/java/com/juick/configuration/UpdaterConfiguration.java b/juick-server-jdbc/src/main/java/com/juick/configuration/UpdaterConfiguration.java
deleted file mode 100644
index 979b38f9..00000000
--- a/juick-server-jdbc/src/main/java/com/juick/configuration/UpdaterConfiguration.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2008-2017, 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.configuration;
-
-import com.juick.database.MySqlUpdater;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.DependsOn;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.transaction.PlatformTransactionManager;
-
-import javax.inject.Inject;
-
-/**
- * Created by aalexeev on 12/13/16.
- */
-@Configuration
-public class UpdaterConfiguration {
- @Inject
- JdbcTemplate jdbcTemplate;
- @Inject
- PlatformTransactionManager transactionManager;
-
- @Bean
- @DependsOn({"jdbcTemplate", "transactionManager"})
- public MySqlUpdater updater() {
- return new MySqlUpdater(
- jdbcTemplate,
- transactionManager,
- "update.sql");
- }
-}
diff --git a/juick-server-jdbc/src/main/java/com/juick/database/MySqlUpdater.java b/juick-server-jdbc/src/main/java/com/juick/database/MySqlUpdater.java
deleted file mode 100644
index 69cde40b..00000000
--- a/juick-server-jdbc/src/main/java/com/juick/database/MySqlUpdater.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2008-2017, 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.database;
-
-import org.apache.commons.codec.CharEncoding;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.transaction.PlatformTransactionManager;
-import org.springframework.transaction.support.TransactionTemplate;
-import org.springframework.util.Assert;
-
-import javax.annotation.PostConstruct;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.function.Supplier;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import static org.springframework.transaction.TransactionDefinition.PROPAGATION_REQUIRED;
-
-/**
- * Created by aalexeev on 12/13/16.
- */
-public class MySqlUpdater {
- private static final Pattern UPDATE_PATTERN = Pattern.compile(
- "update\\s+(version|`version`)\\s+set\\s+(version|`version`)\\s+=\\s*(\\d+)",
- Pattern.CASE_INSENSITIVE);
-
- private final Logger logger = LoggerFactory.getLogger(getClass());
-
- private final JdbcTemplate jdbcTemplate;
- private final TransactionTemplate transactionTemplate;
- private final String updateSqlResource;
-
-
- public MySqlUpdater(JdbcTemplate jdbcTemplate, PlatformTransactionManager transactionManager, String updateSqlResource) {
- Assert.notNull(jdbcTemplate, "JdbcTemplate must be initialized");
- Assert.notNull(transactionManager, "PlatformTransactionManager must be initialized");
- Assert.notNull(updateSqlResource, "sqlResource must be initialized");
-
- this.jdbcTemplate = jdbcTemplate;
- this.transactionTemplate = new TransactionTemplate(transactionManager);
- this.updateSqlResource = updateSqlResource;
- }
-
- @PostConstruct
- public void init() {
- try (
- InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(updateSqlResource);
- ) {
- if (is != null) {
- String content = IOUtils.toString(is, CharEncoding.UTF_8);
- if (StringUtils.isNotEmpty(content)) {
- String[] sqlArray = content.split(";");
- if (sqlArray.length > 0) {
- List<String> sqlList = new ArrayList<>(sqlArray.length);
- for (String sql : sqlArray)
- if (!sql.isEmpty()) {
- String sqlTrimmed = sql.trim();
- if (!sqlTrimmed.isEmpty())
- sqlList.add(sqlTrimmed);
- }
- if (!sqlList.isEmpty())
- processingSql(sqlList);
- }
- }
- }
- } catch (Exception e) {
- logger.error("MySqlUpdater initialization exception", e);
- }
- }
-
- private void processingSql(final List<String> sqls) {
- long currentDbVersion = getSingleResult(this::getVersionRaw);
- long actualVersion;
-
- List<String> changesSql = new ArrayList<>();
-
- for (String sql : sqls) {
- changesSql.add(sql);
-
- Matcher m = UPDATE_PATTERN.matcher(sql);
- if (m.matches()) {
- actualVersion = Long.valueOf(m.group(3));
-
- if (actualVersion > currentDbVersion) {
- updateInTransaction(changesSql);
- currentDbVersion = actualVersion;
- }
- changesSql.clear();
- }
- }
- }
-
- private void updateInTransaction(final List<String> sqls) {
- transactionTemplate.setReadOnly(false);
- transactionTemplate.setPropagationBehavior(PROPAGATION_REQUIRED);
- transactionTemplate.execute(status -> {
- for (String sql : sqls)
- jdbcTemplate.execute(sql);
- return 0;
- });
- }
-
- private <T> T getSingleResult(Supplier<T> supplier) {
- transactionTemplate.setReadOnly(true);
- transactionTemplate.setPropagationBehavior(PROPAGATION_REQUIRED);
-
- return transactionTemplate.execute(status -> supplier.get());
- }
-
- private long getVersionRaw() {
- int cnt = jdbcTemplate.query(
- "SELECT count(*) FROM information_schema.tables WHERE table_schema = ? AND table_name = ?",
- rs -> {
- int result = 0;
- if (rs.next())
- result = rs.getInt(1);
- return result;
- },
- "juick", "version");
-
- long version = 0l;
-
- if (cnt == 1) {
- List<Long> list = jdbcTemplate.queryForList("select version from version", Long.class);
- if (!list.isEmpty())
- version = list.get(0);
- }
-
- return version;
- }
-}
diff --git a/juick-server/build.gradle b/juick-server/build.gradle
index d75a9bff..a4b8b940 100644
--- a/juick-server/build.gradle
+++ b/juick-server/build.gradle
@@ -2,15 +2,18 @@ apply plugin: 'war'
apply plugin: 'org.springframework.boot'
dependencies {
- compile project(':juick-server-jdbc')
- compile project(':juick-api')
+ compile project(':juick-common')
compile ('org.springframework.boot:spring-boot-starter-security')
+ compile ('org.springframework.boot:spring-boot-starter-jdbc')
+
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
providedRuntime 'com.h2database:h2:1.4.196'
compile 'io.springfox:springfox-swagger2:2.9.0'
compile 'io.springfox:springfox-swagger-ui:2.9.0'
+ compile 'org.apache.commons:commons-email:1.5'
+ compile 'com.github.ooxi:serialized-php-parser:0.5.0'
compile 'com.github.pengrad:java-telegram-bot-api:3.6.0'
compile 'com.github.messenger4j:messenger4j:1.0.0'
compile 'org.springframework.social:spring-social-twitter:1.1.2.RELEASE'
diff --git a/juick-api/src/main/java/com/juick/server/api/Post.java b/juick-server/src/main/java/com/juick/server/api/Post.java
index afe9d2d5..afe9d2d5 100644
--- a/juick-api/src/main/java/com/juick/server/api/Post.java
+++ b/juick-server/src/main/java/com/juick/server/api/Post.java
diff --git a/juick-api/src/main/java/com/juick/server/configuration/ApiSecurityConfig.java b/juick-server/src/main/java/com/juick/server/configuration/ApiSecurityConfig.java
index 94c1f1a8..94c1f1a8 100644
--- a/juick-api/src/main/java/com/juick/server/configuration/ApiSecurityConfig.java
+++ b/juick-server/src/main/java/com/juick/server/configuration/ApiSecurityConfig.java
diff --git a/juick-api/src/main/java/com/juick/server/configuration/PostConfig.java b/juick-server/src/main/java/com/juick/server/configuration/PostConfig.java
index 598a7435..598a7435 100644
--- a/juick-api/src/main/java/com/juick/server/configuration/PostConfig.java
+++ b/juick-server/src/main/java/com/juick/server/configuration/PostConfig.java
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/BaseJdbcService.java b/juick-server/src/main/java/com/juick/service/BaseJdbcService.java
index 496a04ba..496a04ba 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/BaseJdbcService.java
+++ b/juick-server/src/main/java/com/juick/service/BaseJdbcService.java
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/CrosspostServiceImpl.java b/juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java
index 0bd5fe66..0bd5fe66 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/CrosspostServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/EmailServiceImpl.java b/juick-server/src/main/java/com/juick/service/EmailServiceImpl.java
index 0cccc915..0cccc915 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/EmailServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/EmailServiceImpl.java
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
index 35e48383..35e48383 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/MessengerServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessengerServiceImpl.java
index 57101ffe..57101ffe 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/MessengerServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/MessengerServiceImpl.java
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/PMQueriesServiceImpl.java b/juick-server/src/main/java/com/juick/service/PMQueriesServiceImpl.java
index b68e0236..b68e0236 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/PMQueriesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/PMQueriesServiceImpl.java
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java b/juick-server/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java
index 9f9cda1d..9f9cda1d 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/PushQueriesServiceImpl.java b/juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java
index 7f97956c..7f97956c 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/PushQueriesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/ShowQueriesServiceImpl.java b/juick-server/src/main/java/com/juick/service/ShowQueriesServiceImpl.java
index 0fba35f1..0fba35f1 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/ShowQueriesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/ShowQueriesServiceImpl.java
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/SphinxSearchService.java b/juick-server/src/main/java/com/juick/service/SphinxSearchService.java
index f102ab47..f102ab47 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/SphinxSearchService.java
+++ b/juick-server/src/main/java/com/juick/service/SphinxSearchService.java
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java
index b97fc0a4..b97fc0a4 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/TagServiceImpl.java b/juick-server/src/main/java/com/juick/service/TagServiceImpl.java
index 524ad32d..524ad32d 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/TagServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/TagServiceImpl.java
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/TelegramServiceImpl.java b/juick-server/src/main/java/com/juick/service/TelegramServiceImpl.java
index 4e37bfac..4e37bfac 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/TelegramServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/TelegramServiceImpl.java
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/UserServiceImpl.java b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
index a0a07fb3..a0a07fb3 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/UserServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
diff --git a/juick-www/src/main/java/ru/sape/Sape.java b/juick-server/src/main/java/ru/sape/Sape.java
index 38577c45..38577c45 100644
--- a/juick-www/src/main/java/ru/sape/Sape.java
+++ b/juick-server/src/main/java/ru/sape/Sape.java
diff --git a/juick-www/src/main/java/ru/sape/SapeConnection.java b/juick-server/src/main/java/ru/sape/SapeConnection.java
index a15658fa..a15658fa 100644
--- a/juick-www/src/main/java/ru/sape/SapeConnection.java
+++ b/juick-server/src/main/java/ru/sape/SapeConnection.java
diff --git a/juick-www/src/main/java/ru/sape/SapePageLinks.java b/juick-server/src/main/java/ru/sape/SapePageLinks.java
index e89b4e71..e89b4e71 100644
--- a/juick-www/src/main/java/ru/sape/SapePageLinks.java
+++ b/juick-server/src/main/java/ru/sape/SapePageLinks.java
diff --git a/juick-server-jdbc/src/main/resources/juick.sql b/juick-server/src/main/resources/juick.sql
index ce34385f..ce34385f 100644
--- a/juick-server-jdbc/src/main/resources/juick.sql
+++ b/juick-server/src/main/resources/juick.sql
diff --git a/juick-server-jdbc/src/main/resources/pg_schema_wip b/juick-server/src/main/resources/pg_schema_wip
index 61178495..61178495 100644
--- a/juick-server-jdbc/src/main/resources/pg_schema_wip
+++ b/juick-server/src/main/resources/pg_schema_wip
diff --git a/juick-server-jdbc/src/main/resources/schema.sql b/juick-server/src/main/resources/schema.sql
index 296fd486..296fd486 100644
--- a/juick-server-jdbc/src/main/resources/schema.sql
+++ b/juick-server/src/main/resources/schema.sql
diff --git a/juick-server-jdbc/src/main/resources/update.sql b/juick-server/src/main/resources/update.sql
index 13a62c3d..13a62c3d 100644
--- a/juick-server-jdbc/src/main/resources/update.sql
+++ b/juick-server/src/main/resources/update.sql
diff --git a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/FormatterExtension.java b/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/FormatterExtension.java
deleted file mode 100644
index 9189c2be..00000000
--- a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/FormatterExtension.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2008-2017, 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.mitchellbosecke.pebble.extension;
-
-import com.mitchellbosecke.pebble.extension.filters.*;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Created by vitalyster on 04.05.2017.
- */
-public class FormatterExtension extends AbstractExtension {
- @Override
- public Map<String, Filter> getFilters() {
- Map<String, Filter> filters = new HashMap<>();
- filters.put("formatMessage", new FormatMessageFilter());
- filters.put("prettyTime", new PrettyTimeFilter());
- filters.put("timestamp", new TimestampFilter());
- filters.put("tagsList", new TagsListFilter());
- return filters;
- }
-}
diff --git a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java b/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java
deleted file mode 100644
index edb6c827..00000000
--- a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2008-2017, 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.mitchellbosecke.pebble.extension.filters;
-
-import com.juick.Message;
-import com.juick.util.MessageUtils;
-import com.mitchellbosecke.pebble.extension.Filter;
-import com.mitchellbosecke.pebble.extension.escaper.SafeString;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created by vitalyster on 04.05.2017.
- */
-public class FormatMessageFilter implements Filter {
- @Override
- public Object apply(Object input, Map<String, Object> args) {
- if (input instanceof Message) {
- Message msg = (Message) input;
- boolean isCode = msg.getTags().stream().anyMatch(t -> t.getName().equals("code"));
- String formatString = MessageUtils.replyStartsWithQuote(msg) ? "@%s,\n%s" : "@%s, %s";
- String msgTxt = msg.getRid() > 0 ? String.format(formatString, msg.getTo().getName(), StringUtils.defaultString(msg.getText()))
- : StringUtils.defaultString(msg.getText());
- String formattedMessage = isCode ? MessageUtils.formatMessageCode(msgTxt)
- : MessageUtils.formatMessage(msgTxt);
- return new SafeString(formattedMessage);
- }
- throw new IllegalArgumentException("invalid input");
- }
-
- @Override
- public List<String> getArgumentNames() {
- return null;
- }
-}
diff --git a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/PrettyTimeFilter.java b/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/PrettyTimeFilter.java
deleted file mode 100644
index 1d58ce79..00000000
--- a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/PrettyTimeFilter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2008-2017, 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.mitchellbosecke.pebble.extension.filters;
-
-import com.juick.util.PrettyTimeFormatter;
-import com.mitchellbosecke.pebble.extension.Filter;
-import com.mitchellbosecke.pebble.template.EvaluationContext;
-
-import java.time.Instant;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * Created by vitalyster on 04.05.2017.
- */
-public class PrettyTimeFilter implements Filter {
-
- PrettyTimeFormatter formatter = new PrettyTimeFormatter();
-
- @Override
- public Object apply(Object input, Map<String, Object> args) {
- if (input instanceof Instant) {
- EvaluationContext context = (EvaluationContext) args.get("_context");
- Locale locale = context.getLocale();
- return formatter.format(locale, Date.from((Instant)input));
- }
- throw new IllegalArgumentException("invalid input");
- }
-
- @Override
- public List<String> getArgumentNames() {
- return null;
- }
-}
diff --git a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java b/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java
deleted file mode 100644
index bfbf18fb..00000000
--- a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2008-2017, 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.mitchellbosecke.pebble.extension.filters;
-
-import com.juick.Tag;
-import com.mitchellbosecke.pebble.extension.Filter;
-
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * Created by vitalyster on 23.05.2017.
- */
-public class TagsListFilter implements Filter {
- @SuppressWarnings("unchecked")
- @Override
- public Object apply(Object input, Map<String, Object> args) {
- return ((List<Tag>) input).stream().map(Tag::getName).collect(Collectors.toList());
- }
-
- @Override
- public List<String> getArgumentNames() {
- return null;
- }
-}
diff --git a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TimestampFilter.java b/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TimestampFilter.java
deleted file mode 100644
index 35efb314..00000000
--- a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TimestampFilter.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.mitchellbosecke.pebble.extension.filters;
-
-import com.mitchellbosecke.pebble.extension.Filter;
-
-import java.time.Instant;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-public class TimestampFilter implements Filter {
- @Override
- public Object apply(Object input, Map<String, Object> args) {
- if (input instanceof Instant) {
- return Date.from((Instant)input);
- }
- throw new IllegalArgumentException("invalid input");
- }
-
- @Override
- public List<String> getArgumentNames() {
- return null;
- }
-}
diff --git a/settings.gradle b/settings.gradle
index dc9123cf..86d92c90 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,4 +1,4 @@
rootProject.name = "Juick"
-include ':juick-common', ':juick-server-jdbc', ':juick-api', ':juick-server', ':juick-www', ':juick-notifications'
+include ':juick-common', ':juick-server', ':juick-notifications'