diff options
| author | lain <lain@soykaf.club> | 2023-11-12 13:29:27 +0000 |
|---|---|---|
| committer | lain <lain@soykaf.club> | 2023-11-12 13:29:27 +0000 |
| commit | e902c7168d40e10821e8060542f14168f78805a2 (patch) | |
| tree | 758df48ca20f9edf5b4c8fe4881e82b02d5a49f5 /priv | |
| parent | a51f3937eef0c6add91234863d5f936c59830d88 (diff) | |
| parent | 3d62c71edf8782c5ceae5a0ea3ba5ec08dc5b948 (diff) | |
| download | pleroma-e902c7168d40e10821e8060542f14168f78805a2.tar.gz pleroma-e902c7168d40e10821e8060542f14168f78805a2.zip | |
Merge branch 'meilisearch' into 'develop'
Different search backends, in particular meilisearch as an additional one
See merge request pleroma/pleroma!3529
Diffstat (limited to 'priv')
| -rw-r--r-- | priv/scrubbers/search_indexing.ex | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/priv/scrubbers/search_indexing.ex b/priv/scrubbers/search_indexing.ex new file mode 100644 index 000000000..02756ab79 --- /dev/null +++ b/priv/scrubbers/search_indexing.ex @@ -0,0 +1,24 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.HTML.Scrubber.SearchIndexing do + @moduledoc """ + An HTML scrubbing policy that scrubs things for searching. + """ + + require FastSanitize.Sanitizer.Meta + alias FastSanitize.Sanitizer.Meta + + # Explicitly remove mentions + def scrub({:a, attrs, children}) do + if(Enum.any?(attrs, fn {att, val} -> att == "class" and String.contains?(val, "mention") end), + do: nil, + # Strip the tag itself, leave only children (text, presumably) + else: children + ) + end + + Meta.strip_comments() + Meta.strip_everything_not_covered() +end |
