aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/util
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-12-22 05:43:40 +0300
committerGravatar Vitaly Takmazov2022-12-22 05:43:40 +0300
commitf8406131fdbe835c52fd46ad68ddc7b0df54cffe (patch)
tree9ded6a40956ce2f45705c1975b9109aa1fa63159 /src/main/java/com/juick/util
parentd4df81c28908c593c2b59f2596e4e380492b32d0 (diff)
`@username@example.com` urls are now redirects to ActivityPub profile
Diffstat (limited to 'src/main/java/com/juick/util')
-rw-r--r--src/main/java/com/juick/util/ActivityPubRequestInterceptor.java7
-rw-r--r--src/main/java/com/juick/util/MessageUtils.java6
2 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/com/juick/util/ActivityPubRequestInterceptor.java b/src/main/java/com/juick/util/ActivityPubRequestInterceptor.java
index 8b578aa0..79beaa09 100644
--- a/src/main/java/com/juick/util/ActivityPubRequestInterceptor.java
+++ b/src/main/java/com/juick/util/ActivityPubRequestInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2021, Juick
+ * Copyright (C) 2008-2022, 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
@@ -17,6 +17,7 @@
package com.juick.util;
+import org.jetbrains.annotations.NotNull;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
@@ -30,8 +31,8 @@ import com.juick.www.api.activity.model.Activity;
public class ActivityPubRequestInterceptor implements ClientHttpRequestInterceptor {
@Override
- public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
- request.getHeaders().set(HttpHeaders.ACCEPT, Activity.ACTIVITY_MEDIA_TYPE);
+ public @NotNull ClientHttpResponse intercept(HttpRequest request, byte @NotNull [] body,
+ ClientHttpRequestExecution execution) throws IOException {
request.getHeaders().set(HttpHeaders.USER_AGENT, "Juick/2.x");
return execution.execute(request, body);
}
diff --git a/src/main/java/com/juick/util/MessageUtils.java b/src/main/java/com/juick/util/MessageUtils.java
index 7a95acb5..0ece7249 100644
--- a/src/main/java/com/juick/util/MessageUtils.java
+++ b/src/main/java/com/juick/util/MessageUtils.java
@@ -192,9 +192,9 @@ public class MessageUtils {
// <a href="#12">/12</a>
msg = msg.replaceAll(replyNumberRegex, "$1<a href=\"#$2\">/$2</a>$3");
- // @username@jabber.org
- // <a href="http://juick.com/username@jabber.org/">@username@jabber.org</a>
- msg = msg.replaceAll(jidRegex, "$1<span class=\"h-card\"><a class=\"u-url\" href=\"https://juick.com/$2/\">@$2</a></span>$3");
+ // @username@mastodon.social
+ // <a href="http://juick.com/mention?username=username@mastodon.social/">@username@mastodon.social</a>
+ msg = msg.replaceAll(jidRegex, "$1<span class=\"h-card\"><a class=\"u-url\" href=\"http://juick.com/mention?username=$2\">@$2</a></span>$3");
// @username
// <a href="http://juick.com/username/">@username</a>