projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3f06ccc
)
Allow authoring MFM
author
FloatingGhost
<hannah@coffee-and-dreams.uk>
Tue, 14 Jun 2022 14:56:12 +0000
(15:56 +0100)
committer
FloatingGhost
<hannah@coffee-and-dreams.uk>
Tue, 14 Jun 2022 14:56:12 +0000
(15:56 +0100)
config/config.exs
patch
|
blob
|
history
lib/pleroma/emoji.ex
patch
|
blob
|
history
lib/pleroma/web/common_api/activity_draft.ex
patch
|
blob
|
history
lib/pleroma/web/common_api/utils.ex
patch
|
blob
|
history
diff --git
a/config/config.exs
b/config/config.exs
index 417f298d702836cb959bb0af84c408feb7b482f5..ad70966692b8d861e9a8b007178b908a2a808bf8 100644
(file)
--- a/
config/config.exs
+++ b/
config/config.exs
@@
-222,7
+222,8
@@
config :pleroma, :instance,
"text/plain",
"text/html",
"text/markdown",
"text/plain",
"text/html",
"text/markdown",
- "text/bbcode"
+ "text/bbcode",
+ "text/x.misskeymarkdown"
],
staff_transparency: [],
autofollowed_nicknames: [],
],
staff_transparency: [],
autofollowed_nicknames: [],
diff --git
a/lib/pleroma/emoji.ex
b/lib/pleroma/emoji.ex
index f4043ac80b9d317ab6c39369b5d7cc69cd74ecdf..9e1858ae73308ae333b293af7a999e07a8ceaaa2 100644
(file)
--- a/
lib/pleroma/emoji.ex
+++ b/
lib/pleroma/emoji.ex
@@
-165,7
+165,7
@@
defmodule Pleroma.Emoji do
def maybe_quote(name), do: name
def maybe_quote(name), do: name
- def emoji_url(%{"type" => "EmojiReact", "content" =>
emoji
, "tag" => []}), do: nil
+ def emoji_url(%{"type" => "EmojiReact", "content" =>
_
, "tag" => []}), do: nil
def emoji_url(%{"type" => "EmojiReact", "content" => emoji, "tag" => tags}) do
tag =
def emoji_url(%{"type" => "EmojiReact", "content" => emoji, "tag" => tags}) do
tag =
diff --git
a/lib/pleroma/web/common_api/activity_draft.ex
b/lib/pleroma/web/common_api/activity_draft.ex
index b4e3e37aec3bff82db68577af9a768a690dad18d..08e704ed4b9b844ee61a27c5e03fd388967e778f 100644
(file)
--- a/
lib/pleroma/web/common_api/activity_draft.ex
+++ b/
lib/pleroma/web/common_api/activity_draft.ex
@@
-213,13
+213,14
@@
defmodule Pleroma.Web.CommonAPI.ActivityDraft do
end
emoji = Map.merge(emoji, summary_emoji)
end
emoji = Map.merge(emoji, summary_emoji)
-
{:ok, note_data, _meta} = Builder.note(draft)
{:ok, note_data, _meta} = Builder.note(draft)
-
object =
note_data
|> Map.put("emoji", emoji)
object =
note_data
|> Map.put("emoji", emoji)
- |> Map.put("source", draft.status)
+ |> Map.put("source", %{
+ "content" => draft.status,
+ "mediaType" => draft.params[:content_type]
+ })
|> Map.put("generator", draft.params[:generator])
%__MODULE__{draft | object: object}
|> Map.put("generator", draft.params[:generator])
%__MODULE__{draft | object: object}
diff --git
a/lib/pleroma/web/common_api/utils.ex
b/lib/pleroma/web/common_api/utils.ex
index b6feaf32a6304ac66a37690838cbeb531a27e85a..8fde9ae156efb615addc05c51e2bbb10718382a6 100644
(file)
--- a/
lib/pleroma/web/common_api/utils.ex
+++ b/
lib/pleroma/web/common_api/utils.ex
@@
-291,6
+291,15
@@
defmodule Pleroma.Web.CommonAPI.Utils do
|> Formatter.html_escape("text/html")
end
|> Formatter.html_escape("text/html")
end
+ def format_input(text, "text/x.misskeymarkdown", options) do
+ text
+ |> Formatter.html_escape("text/plain")
+ |> Formatter.linkify(options)
+ |> (fn {text, mentions, tags} ->
+ {String.replace(text, ~r/\r?\n/, "<br>"), mentions, tags}
+ end).()
+ end
+
def format_naive_asctime(date) do
date |> DateTime.from_naive!("Etc/UTC") |> format_asctime
end
def format_naive_asctime(date) do
date |> DateTime.from_naive!("Etc/UTC") |> format_asctime
end