From 3cad57bf48180ee5f308ad491c21bcf231a7ba69 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 7 May 2024 17:23:41 -0400 Subject: [PATCH] Add configuration[statuses][characters_reserved_per_url] to /api/v2/instance Fixes #3250 --- changelog.d/characters_reserved_per_url.add | 1 + lib/pleroma/web/api_spec/operations/instance_operation.ex | 5 +++++ lib/pleroma/web/mastodon_api/views/instance_view.ex | 1 + 3 files changed, 7 insertions(+) create mode 100644 changelog.d/characters_reserved_per_url.add diff --git a/changelog.d/characters_reserved_per_url.add b/changelog.d/characters_reserved_per_url.add new file mode 100644 index 000000000..0ca1a2801 --- /dev/null +++ b/changelog.d/characters_reserved_per_url.add @@ -0,0 +1 @@ +Add configuration[statuses][characters_reserved_per_url] to /api/v2/instance (https://docs.joinmastodon.org/entities/Instance/#characters_reserved_per_url) diff --git a/lib/pleroma/web/api_spec/operations/instance_operation.ex b/lib/pleroma/web/api_spec/operations/instance_operation.ex index 708b74b12..57aec83a2 100644 --- a/lib/pleroma/web/api_spec/operations/instance_operation.ex +++ b/lib/pleroma/web/api_spec/operations/instance_operation.ex @@ -285,6 +285,11 @@ defp instance2 do type: :object, description: "A map with poll limits for local statuses", properties: %{ + characters_reserved_per_url: %Schema{ + type: :integer, + description: + "Each URL in a status will be assumed to be exactly this many characters." + }, max_characters: %Schema{ type: :integer, description: "Posts character limit (CW/Subject included in the counter)" diff --git a/lib/pleroma/web/mastodon_api/views/instance_view.ex b/lib/pleroma/web/mastodon_api/views/instance_view.ex index 210b46d2c..337b2cc83 100644 --- a/lib/pleroma/web/mastodon_api/views/instance_view.ex +++ b/lib/pleroma/web/mastodon_api/views/instance_view.ex @@ -213,6 +213,7 @@ defp configuration do defp configuration2 do configuration() + |> put_in([:statuses, :characters_reserved_per_url], 0) |> Map.merge(%{ urls: %{ streaming: Pleroma.Web.Endpoint.websocket_url(),