aboutsummaryrefslogtreecommitdiff
path: root/juick-server
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server')
-rw-r--r--juick-server/src/main/java/com/juick/server/TelegramBotManager.java2
-rw-r--r--juick-server/src/main/java/com/juick/server/TopManager.java2
-rw-r--r--juick-server/src/main/java/com/juick/server/TwitterManager.java4
-rw-r--r--juick-server/src/main/java/com/juick/server/XMPPConnection.java6
-rw-r--r--juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java2
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java8
6 files changed, 12 insertions, 12 deletions
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<String> 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);
diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
index 9a78b0a2..41f2b68c 100644
--- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
@@ -545,8 +545,8 @@ public class ServerTests {
}
@Test
public void tg2juickLinks() {
- UriComponents uriComponents = UriComponentsBuilder.fromUriString("http://juick.com/123456#23").build();
- assertThat(uriComponents.getPath().substring(1), is("123456"));
+ UriComponents uriComponents = UriComponentsBuilder.fromUriString("http://juick.com/m/123456#23").build();
+ assertThat(uriComponents.getPath().substring(3), is("123456"));
assertThat(uriComponents.getFragment(), is("23"));
}
@Test
@@ -713,9 +713,9 @@ public class ServerTests {
assertEquals("number of reader users should match", 1,
userService.getUserReaders(uid).size());
String expectedSecondReply = "Reply posted.\n#" + mid + "/2 "
- + "https://juick.com/" + mid + "#2";
+ + "https://juick.com/m/" + mid + "#2";
String expectedThirdReply = "Reply posted.\n#" + mid + "/3 "
- + "https://juick.com/" + mid + "#3";
+ + "https://juick.com/m/" + mid + "#3";
assertEquals("should be second reply", expectedSecondReply,
commandsManager.processCommand(user, "#" + mid + " yoyo", URI.create("http://static.juick.com/settings/facebook.png")).getText());
assertEquals("should be third reply", expectedThirdReply,