config: allow for accepted post formats to be configured
This commit is contained in:
parent
52b05137c5
commit
285ac80c36
|
@ -74,7 +74,12 @@
|
||||||
rewrite_policy: Pleroma.Web.ActivityPub.MRF.NoOpPolicy,
|
rewrite_policy: Pleroma.Web.ActivityPub.MRF.NoOpPolicy,
|
||||||
public: true,
|
public: true,
|
||||||
quarantined_instances: [],
|
quarantined_instances: [],
|
||||||
managed_config: true
|
managed_config: true,
|
||||||
|
allowed_post_formats: [
|
||||||
|
"text/plain",
|
||||||
|
"text/html",
|
||||||
|
"text/markdown"
|
||||||
|
]
|
||||||
|
|
||||||
config :pleroma, :markup,
|
config :pleroma, :markup,
|
||||||
# XXX - unfortunately, inline images must be enabled by default right now, because
|
# XXX - unfortunately, inline images must be enabled by default right now, because
|
||||||
|
|
|
@ -73,6 +73,11 @@ def get_visibility(%{"in_reply_to_status_id" => status_id}) when not is_nil(stat
|
||||||
def get_visibility(_), do: "public"
|
def get_visibility(_), do: "public"
|
||||||
|
|
||||||
@instance Application.get_env(:pleroma, :instance)
|
@instance Application.get_env(:pleroma, :instance)
|
||||||
|
@allowed_post_formats Keyword.get(@instance, :allowed_post_formats)
|
||||||
|
|
||||||
|
defp get_content_type(content_type) when content_type in @allowed_post_formats, do: content_type
|
||||||
|
defp get_content_type(_), do: "text/plain"
|
||||||
|
|
||||||
@limit Keyword.get(@instance, :limit)
|
@limit Keyword.get(@instance, :limit)
|
||||||
def post(user, %{"status" => status} = data) do
|
def post(user, %{"status" => status} = data) do
|
||||||
visibility = get_visibility(data)
|
visibility = get_visibility(data)
|
||||||
|
@ -90,7 +95,7 @@ def post(user, %{"status" => status} = data) do
|
||||||
mentions,
|
mentions,
|
||||||
attachments,
|
attachments,
|
||||||
tags,
|
tags,
|
||||||
data["content_type"] || "text/plain",
|
get_content_type(data["content_type"]),
|
||||||
data["no_attachment_links"]
|
data["no_attachment_links"]
|
||||||
),
|
),
|
||||||
context <- make_context(inReplyTo),
|
context <- make_context(inReplyTo),
|
||||||
|
|
Loading…
Reference in a new issue