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?)
(clj->js (merge {:status (-> status-text (println signature)
(partial resolve-urls mastodon-config) (println visibility)
(partial perform-replacements mastodon-config) (-> (.post (mastodon-client mastodon-config) "statuses"
(partial set-signature mastodon-config))} (clj->js (merge {:status (-> status-text
(when media-ids {:media_ids media-ids}) (partial resolve-urls mastodon-config)
(when sensitive? {:sensitive sensitive?}) (partial perform-replacements mastodon-config)
(when visibility {:visibility visibility}))))))) (partial set-signature mastodon-config))}
(when media-ids {:media_ids media-ids})
(when sensitive? {:sensitive sensitive?})
(when visibility {:visibility visibility}))))
(.then #(-> % callback))))))
(defn-spec post-image any? (defn-spec post-image any?
[mastodon-config mastodon-config? [mastodon-config mastodon-config?