aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-http.el4
-rw-r--r--lisp/mastodon-search.el4
-rw-r--r--lisp/mastodon-tl.el15
3 files changed, 11 insertions, 12 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index 2635eef..1b624ee 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -57,10 +57,6 @@ Optionally specify VERSION in format vX."
"Return Mastodon API v2 URL for ENDPOINT."
(mastodon-http--api endpoint "v2"))
-(defun mastodon-http--api-search ()
- "Return Mastodon API url for the /search endpoint (v2)."
- (format "%s/api/v2/search" mastodon-instance-url))
-
(defun mastodon-http--response ()
"Capture response buffer content as string."
(with-current-buffer (current-buffer)
diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el
index 306e7c8..0c7f746 100644
--- a/lisp/mastodon-search.el
+++ b/lisp/mastodon-search.el
@@ -78,7 +78,7 @@ Returns a nested list containing user handle, display name, and URL."
(defun mastodon-search--search-tags-query (query)
"Return an alist containing tag strings plus their URLs.
QUERY is the string to search."
- (let* ((url (mastodon-http--api-search))
+ (let* ((url (mastodon-http--api-v2 "search"))
(params `(("q" . ,query) ("type" . "hashtags")))
(response (mastodon-http--get-json url params :silent))
(tags (alist-get 'hashtags response)))
@@ -153,7 +153,7 @@ OFFSET is a number as string, means to skip that many results. It
is used for pagination."
;; TODO: handle no results
(interactive "sSearch mastodon for: ")
- (let* ((url (mastodon-http--api-search))
+ (let* ((url (mastodon-http--api-v2 "search"))
(following (when (or following (equal current-prefix-arg '(4)))
"true"))
(type (or type
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 7a22c47..b83a20f 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -2687,9 +2687,11 @@ PARAMS is used to send any parameters needed to correctly update
the current view."
(let* ((args `(("max_id" . ,(mastodon-tl--as-string id))))
(args (if params (push (car args) params) args))
- (url (if (string-suffix-p "search" endpoint)
- (mastodon-http--api-search)
- (mastodon-http--api endpoint))))
+ (url
+ (mastodon-http--api
+ endpoint
+ (when (string-suffix-p "search" endpoint)
+ "v2"))))
(apply #'mastodon-http--get-json-async url args callback cbargs)))
(defun mastodon-tl--more-json-async-offset (endpoint &optional params
@@ -2710,9 +2712,10 @@ Then run CALLBACK with arguments CBARGS."
(+ limit ; limit + old offset = new offset
(string-to-number
(alist-get "offset" params nil nil #'equal)))))
- (url (if (string-suffix-p "search" endpoint)
- (mastodon-http--api-search)
- (mastodon-http--api endpoint))))
+ (url (mastodon-http--api
+ endpoint
+ (when (string-suffix-p "search" endpoint)
+ "v2"))))
;; increment:
(setf (alist-get "offset" params nil nil #'equal) offset)
(apply #'mastodon-http--get-json-async url params callback cbargs)))