From b8b90d967ad4b796af94c214cb9c20b3d1edff80 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Wed, 22 Jan 2020 22:21:32 +0400 Subject: Update documentation --- docs/configuration/cheatsheet.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs/configuration') diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index cad3af68d..4711b7f54 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -489,6 +489,10 @@ Email notifications settings. - `:logo` - a path to a custom logo. Set it to `nil` to use the default Pleroma logo. - `:styling` - a map with color settings for email templates. +### Pleroma.Emails.NewUsersDigestEmail + +- `:enabled` - a boolean, enables new users admin digest email when `true`. Defaults to `false`. + ## Background jobs ### Oban -- cgit v1.2.3 From 815f659ed893d860c8ed1fbbd762e837147c214b Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Fri, 7 Feb 2020 22:17:08 +0400 Subject: Fix MRF documentation --- docs/configuration/mrf.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'docs/configuration') diff --git a/docs/configuration/mrf.md b/docs/configuration/mrf.md index 45be18fc5..9b2289e7c 100644 --- a/docs/configuration/mrf.md +++ b/docs/configuration/mrf.md @@ -1,4 +1,5 @@ # Message Rewrite Facility + The Message Rewrite Facility (MRF) is a subsystem that is implemented as a series of hooks that allows the administrator to rewrite or discard messages. Possible uses include: @@ -10,7 +11,8 @@ Possible uses include: * removing media from messages * sending only public messages to a specific instance -The MRF provides user-configurable policies. The default policy is `NoOpPolicy`, which disables the MRF functionality. Pleroma also includes an easy to use policy called `SimplePolicy` which maps messages matching certain pre-defined criterion to actions built into the policy module. +The MRF provides user-configurable policies. The default policy is `NoOpPolicy`, which disables the MRF functionality. Pleroma also includes an easy to use policy called `SimplePolicy` which maps messages matching certain pre-defined criterion to actions built into the policy module. + It is possible to use multiple, active MRF policies at the same time. ## Quarantine Instances @@ -18,7 +20,8 @@ It is possible to use multiple, active MRF policies at the same time. You have the ability to prevent from private / followers-only messages from federating with specific instances. Which means they will only get the public or unlisted messages from your instance. If, for example, you're using `MIX_ENV=prod` aka using production mode, you would open your configuration file located in `config/prod.secret.exs` and edit or add the option under your `:instance` config object. Then you would specify the instance within quotes. -``` + +```elixir config :pleroma, :instance, [...] quarantined_instances: ["instance.example", "other.example"] @@ -28,15 +31,15 @@ config :pleroma, :instance, `SimplePolicy` is capable of handling most common admin tasks. -To use `SimplePolicy`, you must enable it. Do so by adding the following to your `:instance` config object, so that it looks like this: +To use `SimplePolicy`, you must enable it. Do so by adding the following to your `:instance` config object, so that it looks like this: -``` +```elixir config :pleroma, :instance, [...] rewrite_policy: Pleroma.Web.ActivityPub.MRF.SimplePolicy ``` -Once `SimplePolicy` is enabled, you can configure various groups in the `:mrf_simple` config object. These groups are: +Once `SimplePolicy` is enabled, you can configure various groups in the `:mrf_simple` config object. These groups are: * `media_removal`: Servers in this group will have media stripped from incoming messages. * `media_nsfw`: Servers in this group will have the #nsfw tag and sensitive setting injected into incoming messages which contain media. @@ -50,7 +53,7 @@ Servers should be configured as lists. This example will enable `SimplePolicy`, block media from `illegalporn.biz`, mark media as NSFW from `porn.biz` and `porn.business`, reject messages from `spam.com`, remove messages from `spam.university` from the federated timeline and block reports (flags) from `whiny.whiner`: -``` +```elixir config :pleroma, :instance, rewrite_policy: [Pleroma.Web.ActivityPub.MRF.SimplePolicy] @@ -60,16 +63,15 @@ config :pleroma, :mrf_simple, reject: ["spam.com"], federated_timeline_removal: ["spam.university"], report_removal: ["whiny.whiner"] - ``` ### Use with Care -The effects of MRF policies can be very drastic. It is important to use this functionality carefully. Always try to talk to an admin before writing an MRF policy concerning their instance. +The effects of MRF policies can be very drastic. It is important to use this functionality carefully. Always try to talk to an admin before writing an MRF policy concerning their instance. ## Writing your own MRF Policy -As discussed above, the MRF system is a modular system that supports pluggable policies. This means that an admin may write a custom MRF policy in Elixir or any other language that runs on the Erlang VM, by specifying the module name in the `rewrite_policy` config setting. +As discussed above, the MRF system is a modular system that supports pluggable policies. This means that an admin may write a custom MRF policy in Elixir or any other language that runs on the Erlang VM, by specifying the module name in the `rewrite_policy` config setting. For example, here is a sample policy module which rewrites all messages to "new message content": @@ -83,7 +85,7 @@ defmodule Site.RewritePolicy do # Capture the object as `object`, the message content as `content` and the # message itself as `message`. @impl true - def filter(%{"type" => Create", "object" => {"type" => "Note", "content" => content} = object} = message) + def filter(%{"type" => "Create", "object" => {"type" => "Note", "content" => content} = object} = message) when is_binary(content) do # Subject / CW is stored as summary instead of `name` like other AS2 objects # because of Mastodon doing it that way. @@ -109,9 +111,9 @@ defmodule Site.RewritePolicy do end ``` -If you save this file as `lib/site/mrf/rewrite_policy.ex`, it will be included when you next rebuild Pleroma. You can enable it in the configuration like so: +If you save this file as `lib/site/mrf/rewrite_policy.ex`, it will be included when you next rebuild Pleroma. You can enable it in the configuration like so: -``` +```elixir config :pleroma, :instance, rewrite_policy: [ Pleroma.Web.ActivityPub.MRF.SimplePolicy, @@ -119,4 +121,4 @@ config :pleroma, :instance, ] ``` -Please note that the Pleroma developers consider custom MRF policy modules to fall under the purview of the AGPL. As such, you are obligated to release the sources to your custom MRF policy modules upon request. +Please note that the Pleroma developers consider custom MRF policy modules to fall under the purview of the AGPL. As such, you are obligated to release the sources to your custom MRF policy modules upon request. -- cgit v1.2.3 From 2c95b0fab9cfae48ac26f5522c6848199ac7d245 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 13 Feb 2020 15:19:01 -0600 Subject: Make the sample code actually compile --- docs/configuration/mrf.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'docs/configuration') diff --git a/docs/configuration/mrf.md b/docs/configuration/mrf.md index 45be18fc5..c7161ca4e 100644 --- a/docs/configuration/mrf.md +++ b/docs/configuration/mrf.md @@ -74,16 +74,18 @@ As discussed above, the MRF system is a modular system that supports pluggable p For example, here is a sample policy module which rewrites all messages to "new message content": ```elixir -# This is a sample MRF policy which rewrites all Notes to have "new message -# content." defmodule Site.RewritePolicy do - @behavior Pleroma.Web.ActivityPub.MRF + @moduledoc "MRF policy which rewrites all Notes to have 'new message content'." + @behaviour Pleroma.Web.ActivityPub.MRF # Catch messages which contain Note objects with actual data to filter. # Capture the object as `object`, the message content as `content` and the # message itself as `message`. @impl true - def filter(%{"type" => Create", "object" => {"type" => "Note", "content" => content} = object} = message) + def filter( + %{"type" => "Create", "object" => %{"type" => "Note", "content" => content} = object} = + message + ) when is_binary(content) do # Subject / CW is stored as summary instead of `name` like other AS2 objects # because of Mastodon doing it that way. @@ -106,6 +108,13 @@ defmodule Site.RewritePolicy do # Let all other messages through without modifying them. @impl true def filter(message), do: {:ok, message} + + @impl true + def describe do + mrf_sample = Pleroma.Config.get(:mrf_sample) + + {:ok, %{mrf_sample: mrf_sample}} + end end ``` -- cgit v1.2.3 From 88a76d0142075dbd71314b8e601a8d347d2f45e9 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 14 Feb 2020 10:55:18 -0600 Subject: Update suggested path for location of your custom MRF --- docs/configuration/mrf.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/configuration') diff --git a/docs/configuration/mrf.md b/docs/configuration/mrf.md index c7161ca4e..80cfaaa84 100644 --- a/docs/configuration/mrf.md +++ b/docs/configuration/mrf.md @@ -118,7 +118,7 @@ defmodule Site.RewritePolicy do end ``` -If you save this file as `lib/site/mrf/rewrite_policy.ex`, it will be included when you next rebuild Pleroma. You can enable it in the configuration like so: +If you save this file as `lib/pleroma/web/activity_pub/mrf/rewrite_policy.ex`, it will be included when you next rebuild Pleroma. You can enable it in the configuration like so: ``` config :pleroma, :instance, -- cgit v1.2.3 From 6caf6a86c50fe3cb078d89b0f8ebcd7fd707bb23 Mon Sep 17 00:00:00 2001 From: feld Date: Fri, 14 Feb 2020 16:55:52 +0000 Subject: Apply suggestion to docs/configuration/mrf.md --- docs/configuration/mrf.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'docs/configuration') diff --git a/docs/configuration/mrf.md b/docs/configuration/mrf.md index 80cfaaa84..fc13aafc8 100644 --- a/docs/configuration/mrf.md +++ b/docs/configuration/mrf.md @@ -111,9 +111,7 @@ defmodule Site.RewritePolicy do @impl true def describe do - mrf_sample = Pleroma.Config.get(:mrf_sample) - - {:ok, %{mrf_sample: mrf_sample}} + {:ok, %{mrf_sample: %{content: "new message content"}}}` end end ``` -- cgit v1.2.3 From 31749559e178729e9f4c4211294de8d1e3e16516 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 14 Feb 2020 11:04:27 -0600 Subject: Fix MRF docs further. I don't think anyone has actually tested with the old docs. --- docs/configuration/mrf.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/configuration') diff --git a/docs/configuration/mrf.md b/docs/configuration/mrf.md index 80cfaaa84..bc039689a 100644 --- a/docs/configuration/mrf.md +++ b/docs/configuration/mrf.md @@ -74,7 +74,7 @@ As discussed above, the MRF system is a modular system that supports pluggable p For example, here is a sample policy module which rewrites all messages to "new message content": ```elixir -defmodule Site.RewritePolicy do +defmodule Pleroma.Web.ActivityPub.MRF.RewritePolicy do @moduledoc "MRF policy which rewrites all Notes to have 'new message content'." @behaviour Pleroma.Web.ActivityPub.MRF @@ -124,7 +124,7 @@ If you save this file as `lib/pleroma/web/activity_pub/mrf/rewrite_policy.ex`, i config :pleroma, :instance, rewrite_policy: [ Pleroma.Web.ActivityPub.MRF.SimplePolicy, - Site.RewritePolicy + Pleroma.Web.ActivityPub.MRF.RewritePolicy ] ``` -- cgit v1.2.3