diff --git a/CHANGELOG.md b/CHANGELOG.md index 42ed630fb..7f6dd427e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased +## BREAKING +- The HTML content for new posts (both Client-to-Server as well as Server-to-Server communication) will now use a different formatting to represent MFM. See [FEP-c16b](https://codeberg.org/fediverse/fep/src/branch/main/fep/c16b/fep-c16b.md) for more details. + ## 2025.01.01 Hotfix: Federation could break if a null value found its way into `should_federate?\1` diff --git a/FEDERATION.md b/FEDERATION.md index 4524ec4e2..f72ee11d4 100644 --- a/FEDERATION.md +++ b/FEDERATION.md @@ -12,6 +12,7 @@ - [FEP-67ff: FEDERATION](https://codeberg.org/fediverse/fep/src/branch/main/fep/67ff/fep-67ff.md) - [FEP-f1d5: NodeInfo in Fediverse Software](https://codeberg.org/fediverse/fep/src/branch/main/fep/f1d5/fep-f1d5.md) - [FEP-fffd: Proxy Objects](https://codeberg.org/fediverse/fep/src/branch/main/fep/fffd/fep-fffd.md) +- [FEP-c16b: Formatting MFM functions](https://codeberg.org/fediverse/fep/src/branch/main/fep/c16b/fep-c16b.md) ## ActivityPub @@ -30,6 +31,10 @@ Akkoma does not perform JSON-LD processing. All AP S2S POST requests to Akkoma instances MUST be signed. Depending on instance configuration the same may be true for GET requests. +### FEP-c16b: Formatting MFM functions + +The optional extension term `htmlMfm` is currently not used. + ## Nodeinfo Akkoma provides many additional entries in its nodeinfo response, diff --git a/mix.exs b/mix.exs index e7eebb815..6484da485 100644 --- a/mix.exs +++ b/mix.exs @@ -195,8 +195,8 @@ defp deps do {:elasticsearch, git: "https://akkoma.dev/AkkomaGang/elasticsearch-elixir.git", ref: "main"}, {:mfm_parser, - git: "https://akkoma.dev/AkkomaGang/mfm-parser.git", - ref: "b21ab7754024af096f2d14247574f55f0063295b"}, + git: "https://codeberg.org/ilja/mfm_parser.git", + ref: "be09e20e7a2fad2e9964ec4c563201d3fd1c4391"}, ## dev & test {:ex_doc, "~> 0.30", only: :dev, runtime: false}, diff --git a/mix.lock b/mix.lock index 8c86567a6..d9ff0e8e0 100644 --- a/mix.lock +++ b/mix.lock @@ -73,7 +73,7 @@ "makeup_erlang": {:hex, :makeup_erlang, "1.0.1", "c7f58c120b2b5aa5fd80d540a89fdf866ed42f1f3994e4fe189abebeab610839", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "8a89a1eeccc2d798d6ea15496a6e4870b75e014d1af514b1b71fa33134f57814"}, "meck": {:hex, :meck, "0.9.2", "85ccbab053f1db86c7ca240e9fc718170ee5bda03810a6292b5306bf31bae5f5", [:rebar3], [], "hexpm", "81344f561357dc40a8344afa53767c32669153355b626ea9fcbc8da6b3045826"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, - "mfm_parser": {:git, "https://akkoma.dev/AkkomaGang/mfm-parser.git", "b21ab7754024af096f2d14247574f55f0063295b", [ref: "b21ab7754024af096f2d14247574f55f0063295b"]}, + "mfm_parser": {:git, "https://codeberg.org/ilja/mfm_parser.git", "be09e20e7a2fad2e9964ec4c563201d3fd1c4391", [ref: "be09e20e7a2fad2e9964ec4c563201d3fd1c4391"]}, "mime": {:hex, :mime, "2.0.6", "8f18486773d9b15f95f4f4f1e39b710045fa1de891fada4516559967276e4dc2", [:mix], [], "hexpm", "c9945363a6b26d747389aac3643f8e0e09d30499a138ad64fe8fd1d13d9b153e"}, "mimerl": {:hex, :mimerl, "1.3.0", "d0cd9fc04b9061f82490f6581e0128379830e78535e017f7780f37fea7545726", [:rebar3], [], "hexpm", "a1e15a50d1887217de95f0b9b0793e32853f7c258a5cd227650889b38839fe9d"}, "mint": {:hex, :mint, "1.5.2", "4805e059f96028948870d23d7783613b7e6b0e2fb4e98d720383852a760067fd", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "d77d9e9ce4eb35941907f1d3df38d8f750c357865353e21d335bdcdf6d892a02"}, diff --git a/priv/scrubbers/default.ex b/priv/scrubbers/default.ex index 96473203e..c1a9e502e 100644 --- a/priv/scrubbers/default.ex +++ b/priv/scrubbers/default.ex @@ -61,6 +61,34 @@ defmodule Pleroma.HTML.Scrubber.Default do Meta.allow_tag_with_this_attribute_values(:span, "class", [ "h-card", "quote-inline", + # "FEP-c16b: Formatting MFM functions" tags that Akkoma supports + # NOTE: Maybe it would be better to have something like "allow `mfm-*`, + # but at moment of writing this is not a thing in the HTML parser we use + # The following are the non-animated MFM + "mfm-center", + "mfm-flip", + "mfm-font", + "mfm-blur", + "mfm-rotate", + "mfm-x2", + "mfm-x3", + "mfm-x4", + "mfm-position", + "mfm-scale", + "mfm-fg", + "mfm-bg", + # The following are the animated MFM + "mfm-jelly", + "mfm-twitch", + "mfm-shake", + "mfm-spin", + "mfm-jump", + "mfm-bounce", + "mfm-rainbow", + "mfm-tada", + "mfm-sparkle", + # MFM legacy + # This is for backwards compatibility with posts formatted on Akkoma before support for FEP-c16b "mfm", "mfm _mfm_tada_", "mfm _mfm_jelly_", @@ -79,6 +107,26 @@ defmodule Pleroma.HTML.Scrubber.Default do ]) Meta.allow_tag_with_these_attributes(:span, [ + # "FEP-c16b: Formatting MFM functions" attributes that Akkoma supports + # NOTE: Maybe it would be better to have something like "allow `data-mfm-*`, + # but at moment of writing this is not a thing in the HTML parser we use + "data-mfm-h", + "data-mfm-v", + "data-mfm-x", + "data-mfm-y", + "data-mfm-alternate", + "data-mfm-speed", + "data-mfm-deg", + "data-mfm-left", + "data-mfm-serif", + "data-mfm-monospace", + "data-mfm-cursive", + "data-mfm-fantasy", + "data-mfm-emoji", + "data-mfm-math", + "data-mfm-color", + # MFM legacy + # This is for backwards compatibility with posts formatted on Akkoma before support for FEP-c16b "data-x", "data-y", "data-h", diff --git a/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs b/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs index 4e96f3200..64a322cd5 100644 --- a/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs @@ -157,7 +157,7 @@ test "a misskey MFM status with a content field should work and be linked", _ do assert content =~ "@oops_not_a_mention" assert content =~ - "mfm goes here

aaa" + "mfm goes here

aaa" assert content =~ "some text
newline" end