From 6f9dafd094aa74264059084ae6d6c8b94da1d82d Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 26 May 2024 16:10:44 +0200 Subject: remote local: check domain against known instances. --- lisp/mastodon-tl.el | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 0e5e261..b6166b1 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -469,10 +469,20 @@ With a single prefix ARG, hide replies." (let* ((domain (read-string "Domain for remote local tl: ")) (params `(("limit" . ,mastodon-tl--timeline-posts-count) ("local" . "true"))) - (buf (concat "remote-local-" domain))) - (mastodon-tl--init buf - "timelines/public" 'mastodon-tl--timeline nil - params nil domain))) + (buf (concat "remote-local-" domain)) + (known (member domain + (mastodon-http--get-json + (mastodon-http--api "instance/peers"))))) + ;; TODO: refactor this: + (if (not known) + (when (y-or-n-p + "Domain appears unknown to your instance. Proceed?") + (mastodon-tl--init buf + "timelines/public" 'mastodon-tl--timeline nil + params nil domain)) + (mastodon-tl--init buf + "timelines/public" 'mastodon-tl--timeline nil + params nil domain)))) (defun mastodon-tl--get-local-timeline (&optional prefix) "Open local timeline. -- cgit v1.2.3