From c7c2b377642a337edc303756836c9f0843cdc145 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 21 May 2018 15:50:36 +0300 Subject: juick.com/m/ links --- juick-server/src/main/java/com/juick/server/TelegramBotManager.java | 2 +- juick-server/src/main/java/com/juick/server/TopManager.java | 2 +- juick-server/src/main/java/com/juick/server/TwitterManager.java | 4 ++-- juick-server/src/main/java/com/juick/server/XMPPConnection.java | 6 +++--- .../src/main/java/com/juick/server/api/rss/RepliesView.java | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'juick-server/src/main/java') diff --git a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java index 6e6198a8..4cac0dff 100644 --- a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java +++ b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java @@ -184,7 +184,7 @@ public class TelegramBotManager implements NotificationListener { juickLink.get().url()).build(); String path = uriComponents.getPath(); if (StringUtils.isNotEmpty(path) && path.length() > 1) { - int mid = Integer.valueOf(path.substring(1)); + int mid = Integer.valueOf(path.substring(3)); String prefix = String.format("#%d ", mid); if (StringUtils.isNotEmpty(uriComponents.getFragment())) { int rid = Integer.valueOf(uriComponents.getFragment()); diff --git a/juick-server/src/main/java/com/juick/server/TopManager.java b/juick-server/src/main/java/com/juick/server/TopManager.java index 4d080f54..e6c22533 100644 --- a/juick-server/src/main/java/com/juick/server/TopManager.java +++ b/juick-server/src/main/java/com/juick/server/TopManager.java @@ -68,7 +68,7 @@ public class TopManager { List tags = jmsg.getTags().stream().map(Tag::getName).map(String::toLowerCase).collect(Collectors.toList()); if (!tags.contains("juick")) { String status = MessageUtils.getMessageHashTags(jmsg) + StringUtils.defaultString(jmsg.getText()); - String link = "https://juick.com/" + jmsg.getMid(); + String link = "https://juick.com/m/" + jmsg.getMid(); try { facebookPageManager.post(status, link); } catch (HttpClientErrorException ex) { diff --git a/juick-server/src/main/java/com/juick/server/TwitterManager.java b/juick-server/src/main/java/com/juick/server/TwitterManager.java index 411298bc..9b83b197 100644 --- a/juick-server/src/main/java/com/juick/server/TwitterManager.java +++ b/juick-server/src/main/java/com/juick/server/TwitterManager.java @@ -52,8 +52,8 @@ public class TwitterManager implements NotificationListener { void twitterPost(final com.juick.Message jmsg) { crosspostService.getTwitterToken(jmsg.getUser().getUid()).ifPresent(t -> { String status = MessageUtils.getMessageHashTags(jmsg) + StringUtils.defaultString(jmsg.getText()); - if (status.length() > 255) { - status = status.substring(0, 254) + "…"; + if (status.length() > 253) { + status = status.substring(0, 252) + "…"; } status += " http://juick.com/" + jmsg.getMid(); ConfigurationBuilder configurationBuilder = new ConfigurationBuilder() diff --git a/juick-server/src/main/java/com/juick/server/XMPPConnection.java b/juick-server/src/main/java/com/juick/server/XMPPConnection.java index d15db3f2..72208fa3 100644 --- a/juick-server/src/main/java/com/juick/server/XMPPConnection.java +++ b/juick-server/src/main/java/com/juick/server/XMPPConnection.java @@ -284,7 +284,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener { txt += attachmentUrl + "\n"; } txt += StringUtils.defaultString(jmsg.getText()) + "\n\n"; - txt += "#" + jmsg.getMid() + " http://juick.com/" + jmsg.getMid(); + txt += "#" + jmsg.getMid() + " http://juick.com/m/" + jmsg.getMid(); Nickname nick = new Nickname("@" + jmsg.getUser().getName()); @@ -324,7 +324,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener { if (StringUtils.isNotEmpty(attachmentUrl)) { txt += attachmentUrl + "\n"; } - txt += StringUtils.defaultString(jmsg.getText()) + "\n\n" + "#" + jmsg.getMid() + "/" + jmsg.getRid() + " http://juick.com/" + jmsg.getMid() + "#" + jmsg.getRid(); + txt += StringUtils.defaultString(jmsg.getText()) + "\n\n" + "#" + jmsg.getMid() + "/" + jmsg.getRid() + " http://juick.com/m/" + jmsg.getMid() + "#" + jmsg.getRid(); Message msg = new Message(); msg.setFrom(jid); @@ -405,7 +405,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener { txt += " (" + jmsg.getReplies() + " replies)"; } } - txt += " http://juick.com/" + jmsg.getMid(); + txt += " http://juick.com/m/" + jmsg.getMid(); Nickname nick = new Nickname("@" + jmsg.getUser().getName()); diff --git a/juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java b/juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java index b1e813c4..b67e8b44 100644 --- a/juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java +++ b/juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java @@ -76,7 +76,7 @@ public class RepliesView extends AbstractRssFeedView { private Item createRssItem(ResponseReply msg) { Item item = new Item(); - String messageUrl = String.format("http://juick.com/%d#%d", msg.getMid(), msg.getRid()); + String messageUrl = String.format("http://juick.com/m/%d#%d", msg.getMid(), msg.getRid()); String messageTitle = String.format("@%s:", msg.getUname()); String messageDescription = MessageUtils.formatMessage(msg.getDescription()); item.setLink(messageUrl); -- cgit v1.2.3