Merge branch 'activation-meta' into 'develop'
Add more FE-required fields to /api/v1/instance See merge request pleroma/pleroma!2613
This commit is contained in:
commit
4f8e0170e9
|
@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
- **Breaking:** Emoji API: changed methods and renamed routes.
|
- **Breaking:** Emoji API: changed methods and renamed routes.
|
||||||
- Streaming: Repeats of a user's posts will no longer be pushed to the user's stream.
|
- Streaming: Repeats of a user's posts will no longer be pushed to the user's stream.
|
||||||
|
- Mastodon API: Added `pleroma.metadata.fields_limits` to /api/v1/instance
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
|
@ -228,6 +228,7 @@ Has theses additional parameters (which are the same as in Pleroma-API):
|
||||||
- `background_image`: A background image that frontends can use
|
- `background_image`: A background image that frontends can use
|
||||||
- `pleroma.metadata.features`: A list of supported features
|
- `pleroma.metadata.features`: A list of supported features
|
||||||
- `pleroma.metadata.federation`: The federation restrictions of this instance
|
- `pleroma.metadata.federation`: The federation restrictions of this instance
|
||||||
|
- `pleroma.metadata.fields_limits`: A list of values detailing the length and count limitation for various instance-configurable fields.
|
||||||
- `vapid_public_key`: The public key needed for push messages
|
- `vapid_public_key`: The public key needed for push messages
|
||||||
|
|
||||||
## Markers
|
## Markers
|
||||||
|
|
|
@ -36,8 +36,10 @@ def render("show.json", _) do
|
||||||
background_image: Keyword.get(instance, :background_image),
|
background_image: Keyword.get(instance, :background_image),
|
||||||
pleroma: %{
|
pleroma: %{
|
||||||
metadata: %{
|
metadata: %{
|
||||||
|
account_activation_required: Keyword.get(instance, :account_activation_required),
|
||||||
features: features(),
|
features: features(),
|
||||||
federation: federation()
|
federation: federation(),
|
||||||
|
fields_limits: fields_limits()
|
||||||
},
|
},
|
||||||
vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key)
|
vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key)
|
||||||
}
|
}
|
||||||
|
@ -88,4 +90,13 @@ def federation do
|
||||||
end
|
end
|
||||||
|> Map.put(:enabled, Config.get([:instance, :federating]))
|
|> Map.put(:enabled, Config.get([:instance, :federating]))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def fields_limits do
|
||||||
|
%{
|
||||||
|
max_fields: Config.get([:instance, :max_account_fields]),
|
||||||
|
max_remote_fields: Config.get([:instance, :max_remote_account_fields]),
|
||||||
|
name_length: Config.get([:instance, :account_field_name_length]),
|
||||||
|
value_length: Config.get([:instance, :account_field_value_length])
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -35,8 +35,10 @@ test "get instance information", %{conn: conn} do
|
||||||
"background_image" => _
|
"background_image" => _
|
||||||
} = result
|
} = result
|
||||||
|
|
||||||
|
assert result["pleroma"]["metadata"]["account_activation_required"] != nil
|
||||||
assert result["pleroma"]["metadata"]["features"]
|
assert result["pleroma"]["metadata"]["features"]
|
||||||
assert result["pleroma"]["metadata"]["federation"]
|
assert result["pleroma"]["metadata"]["federation"]
|
||||||
|
assert result["pleroma"]["metadata"]["fields_limits"]
|
||||||
assert result["pleroma"]["vapid_public_key"]
|
assert result["pleroma"]["vapid_public_key"]
|
||||||
|
|
||||||
assert email == from_config_email
|
assert email == from_config_email
|
||||||
|
|
Loading…
Reference in New Issue