diff options
author | marty hiatt <martianhiatus@riseup.net> | 2024-03-27 14:53:04 +0100 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2024-03-27 14:53:04 +0100 |
commit | d54aa9aa3e4276b9519ff9123e9dc0c123d9dd3b (patch) | |
tree | 6c1e17c1483d41e555160c4acb8505ec7b5d4ecb /lisp/mastodon-http.el | |
parent | 90aeac60805ed49da29781b979b6ab3edab671aa (diff) | |
parent | 1454c2253d507adf9be1d413172e0b11b853c661 (diff) |
Merge branch 'develop'
Diffstat (limited to 'lisp/mastodon-http.el')
-rw-r--r-- | lisp/mastodon-http.el | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index aef8975..49c94a4 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -338,18 +338,27 @@ The upload is asynchronous. On succeeding, item uploaded, and `mastodon-toot--update-status-fields' is run." (let* ((file (file-name-nondirectory filename)) (request-backend 'curl) + (desc `(("description" . ,caption))) (cb (cl-function (lambda (&key data &allow-other-keys) (when data - (push (alist-get 'id data) - mastodon-toot--media-attachment-ids) ; add ID to list - (message (alist-get 'id data)) - (message "Uploading %s... (done)" file) - (mastodon-toot--update-status-fields)))))) + (let* ((id (alist-get 'id data))) + ;; update ids: + (push id mastodon-toot--media-attachment-ids) + ;; pleroma, PUT the description: + ;; this is how the mangane akkoma web client does it + ;; and it seems easier than the other options! + (when (and caption + (not (equal caption (alist-get 'description data)))) + (let ((url (mastodon-http--api (format "media/%s" id)))) + ;; (message "PUTting image description") + (mastodon-http--put url desc))) + (message "Uploading %s... (done)" file) + (mastodon-toot--update-status-fields))))))) (request url :type "POST" - :params `(("description" . ,caption)) + :params desc :files `(("file" . (,file :file ,filename :mime-type "multipart/form-data"))) :parser 'json-read |