aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/.dir-locals.el5
-rw-r--r--lisp/mastodon-views.el23
2 files changed, 19 insertions, 9 deletions
diff --git a/lisp/.dir-locals.el b/lisp/.dir-locals.el
new file mode 100644
index 0000000..44e84e5
--- /dev/null
+++ b/lisp/.dir-locals.el
@@ -0,0 +1,5 @@
+;;; Directory Local Variables
+;;; For more information see (info "(emacs) Directory Variables")
+
+;; setting this makes package-lint look in the main file for deps:
+((emacs-lisp-mode . ((package-lint-main-file . "mastodon.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")