From ef0db16833485400704c1b65d5a4e464256a94b7 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 22 Aug 2023 18:20:30 +0200 Subject: new fun: mastodon-return-credential-account, var: mastodon-profile-credential-account FIX #480. --- lisp/mastodon.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lisp/mastodon.el') diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 84d3d1d..a3b372d 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -281,6 +281,7 @@ See `mastodon-toot-display-orig-in-reply-buffer'.") (string-prefix-p "*mastodon-" (buffer-name x)) (get-buffer x))) (buffer-list))))) ; catch any other masto buffer + (mastodon-return-credential-account) (if buffer (switch-to-buffer buffer) (mastodon-tl--get-home-timeline) @@ -288,6 +289,17 @@ See `mastodon-toot-display-orig-in-reply-buffer'.") (mastodon-auth--user-acct) mastodon-instance-url)))) +(defvar mastodon-profile-credential-account nil) + +(defun mastodon-return-credential-account () + "Return the CredentialAccount entity. +Either from `mastodon-profile-credential-account' or from the server." + (or mastodon-profile-credential-account + (setq mastodon-profile-credential-account + (mastodon-http--get-json + (mastodon-http--api "accounts/verify_credentials") + nil :silent)))) + ;;;###autoload (defun mastodon-toot (&optional user reply-to-id reply-json) "Update instance with new toot. Content is captured in a new buffer. -- cgit v1.2.3