From f8406131fdbe835c52fd46ad68ddc7b0df54cffe Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 22 Dec 2022 05:43:40 +0300 Subject: `@username@example.com` urls are now redirects to ActivityPub profile --- src/main/java/com/juick/util/ActivityPubRequestInterceptor.java | 7 ++++--- src/main/java/com/juick/util/MessageUtils.java | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/main/java/com/juick/util') 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 { // /12 msg = msg.replaceAll(replyNumberRegex, "$1/$2$3"); - // @username@jabber.org - // @username@jabber.org - msg = msg.replaceAll(jidRegex, "$1@$2$3"); + // @username@mastodon.social + // @username@mastodon.social + msg = msg.replaceAll(jidRegex, "$1@$2$3"); // @username // @username -- cgit v1.2.3