From 63814ce94f6d3f2fe3ace8aaf34b1a21a2183e99 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 24 Mar 2023 11:06:11 +0100 Subject: instance-desc: friendica compatibility --- lisp/mastodon-views.el | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'lisp/mastodon-views.el') diff --git a/lisp/mastodon-views.el b/lisp/mastodon-views.el index 9c016c3..affd899 100644 --- a/lisp/mastodon-views.el +++ b/lisp/mastodon-views.el @@ -754,15 +754,20 @@ INSTANCE is an instance domain name." (username (if (mastodon-tl--property 'profile-json) (alist-get 'username toot) ;; profile (alist-get 'username account))) - (instance (if instance - (concat "https://" instance) - ;; pleroma URL is https://instance.com/users/username - (if (string-suffix-p "users/" (url-basepath url)) - (string-remove-suffix "/users/" - (url-basepath url)) - ;; mastodon: - (string-remove-suffix (concat "/@" username) - url)))) + (instance (cond (instance + (concat "https://" instance)) + ;; pleroma URL is https://instance.com/users/username + ((string-suffix-p "users/" (url-basepath url)) + (string-remove-suffix "/users/" + (url-basepath url))) + ;; friendica is https://instance.com/profile/user + ((string-suffix-p "profile/" (url-basepath url)) + (string-remove-suffix "/profile/" + (url-basepath url))) + ;; mastodon: + (t + (string-remove-suffix (concat "/@" username) + url)))) (response (mastodon-http--get-json (if user (mastodon-http--api "instance") -- cgit v1.2.3