From 188b32145e0a97411878a11bd4f8ad8bc9cc1d9a Mon Sep 17 00:00:00 2001 From: lain Date: Mon, 18 May 2020 13:28:50 +0200 Subject: [PATCH 1/4] InstanceView: Expose background image link. This will make it easier for more clients to support this feature. --- config/config.exs | 1 + lib/pleroma/web/mastodon_api/views/instance_view.ex | 1 + test/web/mastodon_api/controllers/instance_controller_test.exs | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/config.exs b/config/config.exs index c51884f3a..6b4f3b38a 100644 --- a/config/config.exs +++ b/config/config.exs @@ -183,6 +183,7 @@ email: "example@example.com", notify_email: "noreply@example.com", description: "A Pleroma instance, an alternative fediverse server", + background_image: "/images/city.jpg", limit: 5_000, chat_limit: 5_000, remote_limit: 100_000, diff --git a/lib/pleroma/web/mastodon_api/views/instance_view.ex b/lib/pleroma/web/mastodon_api/views/instance_view.ex index a329ffc28..8088306c3 100644 --- a/lib/pleroma/web/mastodon_api/views/instance_view.ex +++ b/lib/pleroma/web/mastodon_api/views/instance_view.ex @@ -33,6 +33,7 @@ def render("show.json", _) do avatar_upload_limit: Keyword.get(instance, :avatar_upload_limit), background_upload_limit: Keyword.get(instance, :background_upload_limit), banner_upload_limit: Keyword.get(instance, :banner_upload_limit), + background_image: Keyword.get(instance, :background_image), pleroma: %{ metadata: %{ features: features(), diff --git a/test/web/mastodon_api/controllers/instance_controller_test.exs b/test/web/mastodon_api/controllers/instance_controller_test.exs index 2c61dc5ba..8bdfdddd1 100644 --- a/test/web/mastodon_api/controllers/instance_controller_test.exs +++ b/test/web/mastodon_api/controllers/instance_controller_test.exs @@ -31,7 +31,8 @@ test "get instance information", %{conn: conn} do "upload_limit" => _, "avatar_upload_limit" => _, "background_upload_limit" => _, - "banner_upload_limit" => _ + "banner_upload_limit" => _, + "background_image" => _ } = result assert result["pleroma"]["metadata"]["features"] From 8a6ddf26ac63f63f68ad065392dc7f8fde2215d4 Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 20 May 2020 12:12:07 +0200 Subject: [PATCH 2/4] InstanceOperation: Add background image to example --- lib/pleroma/web/api_spec/operations/instance_operation.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pleroma/web/api_spec/operations/instance_operation.ex b/lib/pleroma/web/api_spec/operations/instance_operation.ex index 880bd3f1b..9d189d029 100644 --- a/lib/pleroma/web/api_spec/operations/instance_operation.ex +++ b/lib/pleroma/web/api_spec/operations/instance_operation.ex @@ -130,6 +130,7 @@ defp instance do example: %{ "avatar_upload_limit" => 2_000_000, "background_upload_limit" => 4_000_000, + "background_image" => "/static/image.png", "banner_upload_limit" => 4_000_000, "description" => "A Pleroma instance, an alternative fediverse server", "email" => "lain@lain.com", From 5b8105928b1b4c7e0846d6bf52df2dedad426106 Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 20 May 2020 12:13:57 +0200 Subject: [PATCH 3/4] Docs: Add background_image in instance --- docs/API/differences_in_mastoapi_responses.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/API/differences_in_mastoapi_responses.md b/docs/API/differences_in_mastoapi_responses.md index 6d37d9008..e65fd5da4 100644 --- a/docs/API/differences_in_mastoapi_responses.md +++ b/docs/API/differences_in_mastoapi_responses.md @@ -216,6 +216,7 @@ Has theses additional parameters (which are the same as in Pleroma-API): - `avatar_upload_limit`: The same for avatars - `background_upload_limit`: The same for backgrounds - `banner_upload_limit`: The same for banners +- `background_image`: A background image that frontends can use - `pleroma.metadata.features`: A list of supported features - `pleroma.metadata.federation`: The federation restrictions of this instance - `vapid_public_key`: The public key needed for push messages From 2a74565090ebd7107e1419b4a56f6c6aa4a06ea1 Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 20 May 2020 12:14:17 +0200 Subject: [PATCH 4/4] Changelog: Add background to instance --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index feda41320..66b160a94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **Breaking:** removed `with_move` parameter from notifications timeline. ### Added +- Instance: Add `background_image` to configuration and `/api/v1/instance` - Instance: Extend `/api/v1/instance` with Pleroma-specific information. - NodeInfo: `pleroma:api/v1/notifications:include_types_filter` to the `features` list. - NodeInfo: `pleroma_emoji_reactions` to the `features` list.