diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-09-03 13:23:51 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-09-03 13:23:51 +0200 |
commit | c35e0a33be088bdb27031855886e5dd9cbed4f32 (patch) | |
tree | 14ace3049c15dced5f57dda0e976465c620448af /lisp/mastodon.el | |
parent | 4d431d69db1690df906f1bffeb4d518c38bdddae (diff) |
work on url-lookup
Diffstat (limited to 'lisp/mastodon.el')
-rw-r--r-- | lisp/mastodon.el | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 3162e91..8f49538 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -274,15 +274,15 @@ URL can be arg QUERY-URL, or URL at point, or provided by the user. If a status or account is found, load it in `mastodon.el', if not, just browse the URL in the normal fashion." (interactive) - (message "Performing lookup...") (let* ((query (or query-url (url-get-url-at-point) - (read-string "Lookup URL: "))) - (url (format "%s/api/v2/search" mastodon-instance-url)) - (param (concat "resolve=t")) ; webfinger - (response (mastodon-http--get-search-json url query param :silent))) - (if (equal response '((accounts . #1=[]) (statuses . #1#) (hashtags . #1#))) - (shr-browse-url query-url) + (mastodon-tl--property 'shr-url) + (read-string "Lookup URL: ")))) + ;; TODO: test for a likely masto link and just browse-url if not + (message "Performing lookup...") + (let* ((url (format "%s/api/v2/search" mastodon-instance-url)) + (param (concat "resolve=t")) ; webfinger + (response (mastodon-http--get-search-json url query param :silent))) (cond ((not (seq-empty-p (alist-get 'statuses response))) (let* ((statuses (assoc 'statuses response)) @@ -293,8 +293,10 @@ not, just browse the URL in the normal fashion." (alist-get 'accounts response))) (let* ((accounts (assoc 'accounts response)) (account (seq-first (cdr accounts))) - (account-id (alist-get 'id account))) - (mastodon-profile--account-from-id account-id))))))) + (account-acct (alist-get 'acct account))) + (mastodon-profile--show-user account-acct))) + (t + (browse-url query)))))) ;;;###autoload (add-hook 'mastodon-mode-hook (lambda () |