mastodon limits posts to 500

This commit is contained in:
jem 2020-05-13 19:29:33 +02:00
parent 8f79814b38
commit f2a6f15c42

View file

@ -24,7 +24,7 @@
(s/def ::replacements string?) (s/def ::replacements string?)
(s/def ::max-post-length (fn [n] (and (s/def ::max-post-length (fn [n] (and
(int? n) (int? n)
(<= n 600) (<= n 500)
(> n 0)))) (> n 0))))
(s/def ::content-filters (s/* ::content-filter)) (s/def ::content-filters (s/* ::content-filter))
@ -108,17 +108,23 @@
(defn post-status (defn post-status
([mastodon-config status-text] ([mastodon-config status-text]
(post-status mastodon-config status-text nil)) (post-status mastodon-config status-text nil print))
([mastodon-config status-text media-ids] ([mastodon-config status-text media-ids]
(post-status mastodon-config status-text media-ids print))
([mastodon-config status-text media-ids callback]
(let [{:keys [sensitive? signature visibility]} mastodon-config] (let [{:keys [sensitive? signature visibility]} mastodon-config]
(.post (mastodon-client mastodon-config) "statuses" (println sensitive?)
(println signature)
(println visibility)
(-> (.post (mastodon-client mastodon-config) "statuses"
(clj->js (merge {:status (-> status-text (clj->js (merge {:status (-> status-text
(partial resolve-urls mastodon-config) (partial resolve-urls mastodon-config)
(partial perform-replacements mastodon-config) (partial perform-replacements mastodon-config)
(partial set-signature mastodon-config))} (partial set-signature mastodon-config))}
(when media-ids {:media_ids media-ids}) (when media-ids {:media_ids media-ids})
(when sensitive? {:sensitive sensitive?}) (when sensitive? {:sensitive sensitive?})
(when visibility {:visibility visibility}))))))) (when visibility {:visibility visibility}))))
(.then #(-> % callback))))))
(defn-spec post-image any? (defn-spec post-image any?
[mastodon-config mastodon-config? [mastodon-config mastodon-config?