[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/mastodon e0b2f1a5eb 18/47: mastodon-http--api-search fun (
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/mastodon e0b2f1a5eb 18/47: mastodon-http--api-search fun (search uses api v2) |
Date: |
Fri, 13 Oct 2023 19:00:56 -0400 (EDT) |
branch: elpa/mastodon
commit e0b2f1a5eb1dab3b99f974b030bdbb866bd48dae
Author: marty hiatt <martianhiatus [a t] riseup [d o t] net>
Commit: marty hiatt <martianhiatus [a t] riseup [d o t] net>
mastodon-http--api-search fun (search uses api v2)
---
lisp/mastodon-http.el | 4 ++++
lisp/mastodon-search.el | 9 +++------
lisp/mastodon-tl.el | 4 +++-
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index 8741972519..33f6012119 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -53,6 +53,10 @@
(concat mastodon-instance-url "/api/"
mastodon-http--api-version "/" endpoint))
+(defun mastodon-http--api-search ()
+ "Return Mastodon API url for the /search endpoind (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 436041defb..602df8d43b 100644
--- a/lisp/mastodon-search.el
+++ b/lisp/mastodon-search.el
@@ -76,7 +76,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 (format "%s/api/v2/search" mastodon-instance-url))
+ (let* ((url (mastodon-http--api-search))
(params `(("q" . ,query) ("type" . "hashtags")))
(response (mastodon-http--get-json url params :silent))
(tags (alist-get 'hashtags response)))
@@ -152,10 +152,9 @@ TYPE is a member of `mastodon-search-types'.
FOLLOWING means limit to accounts followed, for \"accounts\" type only.
A single prefix arg also sets FOLLOWING to true.
ACCOUNT-ID means limit search to that account, for \"statuses\" type only."
- ;; TODO: handle account search, buffer name etc.
;; TODO: handle no results
(interactive "sSearch mastodon for: ")
- (let* ((url (format "%s/api/v2/search" mastodon-instance-url))
+ (let* ((url (mastodon-http--api-search))
(following (when (or following
(equal current-prefix-arg '(4)))
"true"))
@@ -180,8 +179,6 @@ ACCOUNT-ID means limit search to that account, for
\"statuses\" type only."
(alist-get 'statuses response)))
(tags-list (when tags
(mapcar #'mastodon-search--get-hashtag-info tags))))
- ;; (toots-list-json (when statuses ; v slow, but do we have a choice?
- ;; (mastodon-search--get-full-statuses-data statuses))))
(with-mastodon-buffer buffer #'mastodon-mode nil
(mastodon-search-mode)
(mastodon-tl--set-buffer-spec buffer "api/v2/search" nil
@@ -197,7 +194,7 @@ ACCOUNT-ID means limit search to that account, for
\"statuses\" type only."
;; status results:
(when statuses
(mastodon-search--format-heading "STATUSES")
- (mapc #'mastodon-tl--toot statuses)) ;toots-list-json))
+ (mapc #'mastodon-tl--toot statuses))
(goto-char (point-min))
(message
(substitute-command-keys
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 25ffcd70c5..d32b80680d 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -2249,7 +2249,9 @@ 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 (mastodon-http--api endpoint)))
+ (url (if (string-suffix-p "search" endpoint)
+ (mastodon-http--api-search)
+ (mastodon-http--api endpoint))))
(apply #'mastodon-http--get-json-async url args callback cbargs)))
(defun mastodon-tl--updated-json (endpoint id &optional params)
- [nongnu] elpa/mastodon d0d4188bf9 20/47: add update function to search buf spec: --timeline, (continued)
- [nongnu] elpa/mastodon d0d4188bf9 20/47: add update function to search buf spec: --timeline, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon 4b8ed3bf04 28/47: update profile note: subst cmd keys, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon 57aec26ea8 33/47: remove "api/v1/" from trends endpoint in buffer spec and buffer checks, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon 6a5ef4d3c4 25/47: fix more: search-buffer-p check before seach buf cond, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon 5875220d7a 30/47: subst cmd keys for toot compose buffer, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon d7ef5b9512 35/47: FIX #494. mastodon-tl--more-json-async-offset for pagination., ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon 4d40968c30 42/47: index, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon 9d2a85b36d 10/47: flychecks, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon 1e3e37d346 26/47: docstring, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon 9aa6a50e09 12/47: view instance: if rendering error, display raw json, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon e0b2f1a5eb 18/47: mastodon-http--api-search fun (search uses api v2),
ELPA Syncer <=
- [nongnu] elpa/mastodon beb877d523 19/47: add basic limit/offset search params, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon c67d1f80f6 24/47: unfuck non-search pagination fucked by search pagination, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon b75760867b 32/47: docstrings autoloads, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon 51352ce53d 27/47: set buffer spec explicitly for acct search, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon ff05cd29dd 29/47: header-line-format no comment face, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon 2cb0a5012a 47/47: bump, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon fedba9ed92 38/47: autoload, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon a623a6dc66 36/47: fix reporting rules tests, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon 90bcebbd17 40/47: tl autoload for search pagination, ELPA Syncer, 2023/10/13
- [nongnu] elpa/mastodon b01797b702 37/47: work on tl--more*: msg if no more results, or if load full thread, ELPA Syncer, 2023/10/13