From 66d8df43bc83649458d0f77c92ccfd65d5716313 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 7 Feb 2016 21:13:57 +0300 Subject: fix rythm initializaiotn --- src/main/java/com/juick/JuickApplication.java | 6 ++---- src/main/java/com/juick/http/www/Main.java | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/juick/JuickApplication.java b/src/main/java/com/juick/JuickApplication.java index e546f5a8..2696ba39 100644 --- a/src/main/java/com/juick/JuickApplication.java +++ b/src/main/java/com/juick/JuickApplication.java @@ -31,10 +31,8 @@ public class JuickApplication { private JdbcTemplate sql; private JdbcTemplate sqlSearch; private List components = new ArrayList<>(); - private String applicationPath; - public JuickApplication(Properties conf, String applicationPath) throws IOException { - this.applicationPath = applicationPath; + public JuickApplication(Properties conf) throws IOException { executorService = Executors.newWorkStealingPool(); initDataSources(conf); initSockets(conf); @@ -45,7 +43,7 @@ public class JuickApplication { private void initRythm(Properties conf) { String rythmMode = conf.getProperty("rythm_mode", "prod"); Map map = new HashMap<>(); - map.put("home.template", applicationPath+"/WEB-INF/classes/templates"); + map.put("home.template", "templates"); map.put("rythm.engine.mode", rythmMode); Rythm.init(map); } diff --git a/src/main/java/com/juick/http/www/Main.java b/src/main/java/com/juick/http/www/Main.java index babeee1f..acc6e713 100644 --- a/src/main/java/com/juick/http/www/Main.java +++ b/src/main/java/com/juick/http/www/Main.java @@ -77,7 +77,7 @@ public class Main extends HttpServlet implements Stream.StreamListener { conf.getProperty("twitter_consumer_secret")); PageTemplates.sape = new Sape(conf.getProperty("sape_user"), "juick.com", 2000, 3600); Endpoints.wwwJuickCom = conf.getProperty("www_juick_com", "juick.com"); - app = new JuickApplication(conf, getServletContext().getRealPath("/")); + app = new JuickApplication(conf); sql = app.getSql(); sqlSearch = app.getSqlSearch(); pagesNewMessage = new NewMessage(app); -- cgit v1.2.3 From efcc9d5763fd5a67967ea38b9a5780d3986182dd Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 7 Feb 2016 21:27:48 +0300 Subject: update deps --- deps/com.juick.server | 2 +- src/main/java/com/juick/http/www/NewMessage.java | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/deps/com.juick.server b/deps/com.juick.server index 164b17fa..322b18df 160000 --- a/deps/com.juick.server +++ b/deps/com.juick.server @@ -1 +1 @@ -Subproject commit 164b17fa61f049ea1ffab155f3dffd0c7ba9f033 +Subproject commit 322b18df46eb596ac8db8dc6fd6c544ddf69f8f6 diff --git a/src/main/java/com/juick/http/www/NewMessage.java b/src/main/java/com/juick/http/www/NewMessage.java index c8eb6ede..a130c190 100644 --- a/src/main/java/com/juick/http/www/NewMessage.java +++ b/src/main/java/com/juick/http/www/NewMessage.java @@ -29,20 +29,18 @@ import com.juick.xmpp.extensions.JuickUser; import com.juick.xmpp.extensions.Nickname; import com.juick.xmpp.extensions.XOOB; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLEncoder; -import java.sql.Connection; import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; /** * -- cgit v1.2.3 From 816eb865424cd51eeff73968f062e434a8d171d1 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 7 Feb 2016 21:43:02 +0300 Subject: fix push queries and jabber serialization --- src/main/java/com/juick/PushComponent.java | 27 ++++++++++++---------- .../com/juick/xmpp/extensions/JuickMessage.java | 2 ++ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/juick/PushComponent.java b/src/main/java/com/juick/PushComponent.java index 3a96ff16..b77d2937 100644 --- a/src/main/java/com/juick/PushComponent.java +++ b/src/main/java/com/juick/PushComponent.java @@ -78,7 +78,7 @@ public class PushComponent implements JuickComponent { if (jmsg == null) { return; } - logger.info("Message to push: " + msg.toString()); + logger.info("Message to push: " + jmsg); List subscribedUsers = new ArrayList<>(); boolean isPM = jmsg.getMID() == 0; boolean isReply = jmsg.getRID() > 0; @@ -101,16 +101,17 @@ public class PushComponent implements JuickComponent { } /*** ANDROID ***/ - List regids; + List regids = new ArrayList<>(); if (isPM) { - regids = new ArrayList<>(); String targetId = PushQueries.getAndroidRegID(sql, pmTo); if (targetId != null && !targetId.isEmpty()) { regids.add(targetId); } } else { List uids = subscribedUsers.stream().map(User::getUID).collect(Collectors.toList()); - regids = PushQueries.getAndroidTokens(sql, uids); + if (uids.size() > 0) { + regids = PushQueries.getAndroidTokens(sql, uids); + } } if (!regids.isEmpty()) { @@ -134,16 +135,17 @@ public class PushComponent implements JuickComponent { } /*** WinPhone ***/ - List urls; + List urls = new ArrayList<>(); if (isPM) { - urls = new ArrayList<>(); String targetURL = PushQueries.getWinPhoneURL(sql, pmTo); if (!TextUtils.isEmpty(targetURL)) { urls.add(targetURL); } } else { - urls = PushQueries.getWindowsTokens(sql, - subscribedUsers.stream().map(User::getUID).collect(Collectors.toList())); + List uids = subscribedUsers.stream().map(User::getUID).collect(Collectors.toList()); + if (uids.size() > 0) { + urls = PushQueries.getWindowsTokens(sql, uids); + } } @@ -181,16 +183,17 @@ public class PushComponent implements JuickComponent { } /*** iOS ***/ - List tokens; + List tokens = new ArrayList<>(); if (isPM) { - tokens = new ArrayList<>(); String targetToken = PushQueries.getAPNSToken(sql, pmTo); if (targetToken != null && !targetToken.isEmpty()) { tokens.add(targetToken); } } else { - tokens = PushQueries.getAPNSTokens(sql, - subscribedUsers.stream().map(User::getUID).collect(Collectors.toList())); + List uids = subscribedUsers.stream().map(User::getUID).collect(Collectors.toList()); + if (uids.size() > 0) { + tokens = PushQueries.getAPNSTokens(sql, uids); + } } if (!tokens.isEmpty()) { ApnsService service = APNS.newService().withCert("/etc/juick/ios.p12", "juick") diff --git a/src/main/java/com/juick/xmpp/extensions/JuickMessage.java b/src/main/java/com/juick/xmpp/extensions/JuickMessage.java index bbc1568e..a7fd1e35 100644 --- a/src/main/java/com/juick/xmpp/extensions/JuickMessage.java +++ b/src/main/java/com/juick/xmpp/extensions/JuickMessage.java @@ -45,6 +45,8 @@ public class JuickMessage extends com.juick.Message implements StanzaChild { public JuickMessage(com.juick.Message msg) { super(msg); + df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + df.setTimeZone(TimeZone.getTimeZone("UTC")); } @Override -- cgit v1.2.3 From 35ae74603abe9569554f31d426b54bfc8c680d42 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 7 Feb 2016 22:19:45 +0300 Subject: drop tag border --- src/main/resources/templates/parts/post_form.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/parts/post_form.html b/src/main/resources/templates/parts/post_form.html index 56184f55..a5b9f032 100644 --- a/src/main/resources/templates/parts/post_form.html +++ b/src/main/resources/templates/parts/post_form.html @@ -12,7 +12,7 @@
- + sample
-- cgit v1.2.3 From ec0e62c6ce7233aaa7b77d619637a501ea11a2b1 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 7 Feb 2016 22:55:25 +0300 Subject: hotfixes --- deps/com.juick.server | 2 +- src/main/java/com/juick/http/www/Main.java | 3 ++- src/main/java/com/juick/xmpp/s2s/S2SComponent.java | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/deps/com.juick.server b/deps/com.juick.server index 164b17fa..8ff7d1d0 160000 --- a/deps/com.juick.server +++ b/deps/com.juick.server @@ -1 +1 @@ -Subproject commit 164b17fa61f049ea1ffab155f3dffd0c7ba9f033 +Subproject commit 8ff7d1d028769e85c39885c954ee8774d0082719 diff --git a/src/main/java/com/juick/http/www/Main.java b/src/main/java/com/juick/http/www/Main.java index babeee1f..a21b4e5c 100644 --- a/src/main/java/com/juick/http/www/Main.java +++ b/src/main/java/com/juick/http/www/Main.java @@ -38,6 +38,7 @@ import java.sql.SQLException; import java.util.Enumeration; import java.util.Properties; import java.util.concurrent.ExecutorService; +import java.util.logging.LogManager; /** * @@ -68,9 +69,9 @@ public class Main extends HttpServlet implements Stream.StreamListener { @Override public void init() throws ServletException { - super.init(); try { + LogManager.getLogManager().readConfiguration(getServletContext().getResourceAsStream("WEB-INF/logging.properties")); Properties conf = new Properties(); conf.load(getServletContext().getResourceAsStream("WEB-INF/juick.conf")); twitterAuth = new TwitterAuth(conf.getProperty("twitter_consumer_key"), diff --git a/src/main/java/com/juick/xmpp/s2s/S2SComponent.java b/src/main/java/com/juick/xmpp/s2s/S2SComponent.java index b7155643..4a4d3413 100644 --- a/src/main/java/com/juick/xmpp/s2s/S2SComponent.java +++ b/src/main/java/com/juick/xmpp/s2s/S2SComponent.java @@ -151,8 +151,8 @@ public class S2SComponent implements JuickComponent { public S2SComponent(JuickApplication application, Properties conf) { LOGGER.info("component initialized"); - HOSTNAME = conf.getProperty("hostname"); - componentName = conf.getProperty("componentname"); + HOSTNAME = conf.getProperty("hostname", "juick.com"); + componentName = conf.getProperty("componentname", "s2s"); STATSFILE = conf.getProperty("statsfile"); this.sql = application.getSql(); this.executorService = application.getExecutorService(); -- cgit v1.2.3 From 7619efb1a3f7148c9642a11cf181923415da63a4 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 7 Feb 2016 23:03:43 +0300 Subject: update deps --- deps/com.juick.server | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/com.juick.server b/deps/com.juick.server index 8ff7d1d0..0527dc97 160000 --- a/deps/com.juick.server +++ b/deps/com.juick.server @@ -1 +1 @@ -Subproject commit 8ff7d1d028769e85c39885c954ee8774d0082719 +Subproject commit 0527dc97b439f320f7bebec003b1d6080cfed1ff -- cgit v1.2.3 From 8012bef3931221133d656c22399c4c8ec582e52e Mon Sep 17 00:00:00 2001 From: Alex Bitney Date: Sun, 7 Feb 2016 21:54:55 +0200 Subject: fixed tags display --- src/main/resources/templates/parts/post_form.html | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/resources/templates/parts/post_form.html b/src/main/resources/templates/parts/post_form.html index a5b9f032..c81152c7 100644 --- a/src/main/resources/templates/parts/post_form.html +++ b/src/main/resources/templates/parts/post_form.html @@ -11,8 +11,8 @@
-
- +
+ sample
@@ -45,16 +45,17 @@ }, 50) }; item.onmouseover = function() { - item.style.fontStyle = "bold"; - item.style.backgroundColor = "#2ba4e3"; + item.style.textDecoration = "underline"; + //item.style.backgroundColor = "#2ba4e3"; }; item.onmouseout = function() { - item.style.fontStyle = ""; - item.style.backgroundColor = template.style.backgroundColor; + item.style.textDecoration = ""; + //item.style.backgroundColor = template.style.backgroundColor; }; }; q(nextItem); mtags.appendChild(nextItem); + mtags.appendChild(document.createTextNode(" ")); } }); newmessage_toggleOpen = function() {} -- cgit v1.2.3