Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ivan Tashkinov
pleroma
Commits
342ed844
Commit
342ed844
authored
6 years ago
by
kaniini
Browse files
Options
Downloads
Patches
Plain Diff
MRF: add policy for normalizing HTML markup (local and remote) to a specific policy
parent
95376ac1
Branches
feature/staff-discovery-api
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/config.exs
+2
-0
2 additions, 0 deletions
config/config.exs
lib/pleroma/web/activity_pub/mrf/normalize_markup.ex
+25
-0
25 additions, 0 deletions
lib/pleroma/web/activity_pub/mrf/normalize_markup.ex
with
27 additions
and
0 deletions
config/config.exs
+
2
−
0
View file @
342ed844
...
...
@@ -104,6 +104,8 @@ config :pleroma, :activitypub,
config
:pleroma
,
:user
,
deny_follow_blocked:
true
config
:pleroma
,
:mrf_normalize_markup
,
scrub_policy:
Pleroma
.
HTML
.
Scrubber
.
Default
config
:pleroma
,
:mrf_rejectnonpublic
,
allow_followersonly:
false
,
allow_direct:
false
...
...
This diff is collapsed.
Click to expand it.
lib/pleroma/web/activity_pub/mrf/normalize_markup.ex
0 → 100644
+
25
−
0
View file @
342ed844
defmodule
Pleroma
.
Web
.
ActivityPub
.
MRF
.
NormalizeMarkup
do
alias
Pleroma
.
HTML
@behaviour
Pleroma
.
Web
.
ActivityPub
.
MRF
@mrf_normalize_markup
Application
.
get_env
(
:pleroma
,
:mrf_normalize_markup
)
def
filter
(%{
"type"
=>
activity_type
}
=
object
)
when
activity_type
==
"Create"
do
scrub_policy
=
Keyword
.
get
(
@mrf_normalize_markup
,
:scrub_policy
)
child
=
object
[
"object"
]
content
=
child
[
"content"
]
|>
HTML
.
filter_tags
(
scrub_policy
)
child
=
Map
.
put
(
child
,
"content"
,
content
)
object
=
Map
.
put
(
object
,
"object"
,
child
)
{
:ok
,
object
}
end
def
filter
(
object
),
do
:
{
:ok
,
object
}
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment