From d17e5714c9b421fce507d310fd913ce3160a1764 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 22 Jan 2023 00:52:14 +0300 Subject: Update links to external users with web urls instead of json-ld uris --- src/main/assets/scripts.js | 3 ++- src/main/java/com/juick/ActivityPubManager.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/assets/scripts.js b/src/main/assets/scripts.js index 27e2d59c..eecb3372 100644 --- a/src/main/assets/scripts.js +++ b/src/main/assets/scripts.js @@ -742,7 +742,7 @@ ready(() => { setTimeout(() => fetchUserUri(dataUri, user => { let header = el.closest('.msg-header'); Array.from(header.querySelectorAll('.a-username')).forEach(a => { - a.setAttribute('href', user.uri); + a.setAttribute('href', user.url || user.uri); let img = a.querySelector('img'); if (img && user.avatar) { img.setAttribute('src', user.avatar); @@ -765,6 +765,7 @@ ready(() => { if (textNode.nodeType === Node.TEXT_NODE && textNode.nodeValue.trim().length > 0) { let uname = document.createTextNode(`@${user.uname}`); el.replaceChild(uname, el.firstChild); + el.setAttribute('href', user.url || user.uri); } }), 100); } diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java index 5f42028f..90616338 100644 --- a/src/main/java/com/juick/ActivityPubManager.java +++ b/src/main/java/com/juick/ActivityPubManager.java @@ -386,6 +386,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene if (context.isPresent() && context.get() instanceof Actor actor) { User user = new User(); user.setUri(URI.create(actor.getId())); + user.setUrl(actor.getUrl()); user.setName(actor.getPreferredUsername()); if (actor.getIcon() != null) { user.setAvatar(actor.getIcon().getUrl()); -- cgit v1.2.3