Commit graph

279 commits

Author SHA1 Message Date
Haelwenn (lanodan) Monnier 7d624c4750
StealEmojiPolicy: Sanitize shortcodes
Closes: https://git.pleroma.social/pleroma/pleroma/-/issues/3245
2024-02-20 09:09:54 +01:00
Mark Felder 5b95abaeea Credo.Check.Readability.PredicateFunctionNames
This check was recently improved in Credo and it does make sense for readability.

The offending functions in Pleroma have been renamed and a couple missing the ? suffix have been fixed as well.
2024-01-26 16:59:58 -05:00
Mark Felder 115b2ad638 MRF.KeywordPolicy: fix dialyzer error
lib/pleroma/web/activity_pub/mrf/keyword_policy.ex:13:neg_guard_fail
Guard test:
not is_binary(_string :: binary())

can never succeed.
2024-01-22 18:37:29 -05:00
Mark Felder 0dd65246ea MRF.HashtagPolicy: fix dialyzer error
lib/pleroma/web/activity_pub/mrf/hashtag_policy.ex:87:exact_eq
The test <<_::32>> == <<_::48>> can never evaluate to 'true'.
2024-01-22 18:37:19 -05:00
Mark Felder 5f71928f6b MRF.InlineQuotePolicy: fix dialyzer error
lib/pleroma/web/activity_pub/mrf/inline_quote_policy.ex:60:callback_type_mismatch
Type mismatch for @callback config_description/0 in Pleroma.Web.ActivityPub.MRF.Policy behaviour.

Expected type:
%{
  :description => binary(),
  :key => atom(),
  :label => binary(),
  :related_policy => binary(),
  :children => [map()]
}

Actual type:
%{
  :children => [
    %{
      :description => <<_::808>>,
      :key => :template,
      :suggestions => [any(), ...],
      :type => :string
    },
    ...
  ],
  :description => <<_::336>>,
  :key => :mrf_inline_quote,
  :label => <<_::184>>,
  :related_policy => <<_::360>>,
  :type => :group
}
2024-01-22 18:37:13 -05:00
Mark Felder 7f649a7a19 Dialyzer: remove function that will never match 2024-01-20 17:50:21 -05:00
Mark Felder ec5ae83da6 Fix invalid types
lib/pleroma/web/activity_pub/mrf/policy.ex:6:unknown_type
Unknown type: Map.t/0.

lib/pleroma/web/activity_pub/mrf/policy.ex:7:unknown_type
Unknown type: Map.t/0.
2024-01-20 17:31:07 -05:00
Haelwenn (lanodan) Monnier 4ca65c6182 MRF.StealEmojiPolicy: Properly add fallback extension to filenames missing one 2024-01-07 19:37:35 +01:00
marcin mikołajczak 017e35fbf1 Fix some more typos
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-12-28 00:17:04 +01:00
Mark Felder 9896b64f54 Elixir 1.15: Chase the Logger.warn deprecation 2023-12-20 20:16:26 +00:00
tusooa 87353e5ad1
Fix config descriptions for mrf inline quote 2023-09-13 19:20:32 -04:00
tusooa 8b98a98dfb
Make InlineQuotePolicy history aware 2023-09-13 19:20:32 -04:00
tusooa e349e92a44
Add mrf to force link tag of quoting posts 2023-09-13 19:20:30 -04:00
tusooa 163e563733
Allow more flexibility in InlineQuotePolicy 2023-09-13 19:19:05 -04:00
Alex Gleason f9697e68c2
InlineQuotePolicy: skip objects which already have an .inline-quote span 2023-09-13 19:19:05 -04:00
Alex Gleason 4075eecca0
InlineQuotePolicy: improve the way Markdown quotes are displayed by other software 2023-09-13 19:19:05 -04:00
Alex Gleason bee7e41959
InlineQuotePolicy: don't add line breaks to markdown posts 2023-09-13 19:19:04 -04:00
Alex Gleason 57ef1d1211
Add InlineQuotePolicy to force quote URLs inline 2023-09-13 19:19:04 -04:00
tusooa 1459d64508
Make regex-to-string descriptor reusable 2023-07-07 07:09:35 -04:00
tusooa ba3aa4f86d
Fix edge cases 2023-07-07 06:58:32 -04:00
tusooa ef8a6c539a
Make EmojiPolicy aware of custom emoji reactions 2023-07-07 06:58:31 -04:00
tusooa 20d193c91d
Improve config examples for EmojiPolicy 2023-07-07 06:58:31 -04:00
tusooa f50422c380
Move emoji_policy.ex to the right place 2023-07-07 06:58:31 -04:00
Lain Soykaf 6611c6ce4e B ForceMentionsInContent: Fix test, refactor. 2023-06-11 16:45:31 +04:00
Zero 279fd47b48 ForceMentionsInContent: fix double mentions for Mastodon/Misskey posts
The code checked for duplicates using "ap_id", but in Mastodon and Misskey the look like that:
Mastodon: https://mastodon.example.com/users/roger
Misskey: https:///misskey.example.com/users/104ab42f11

The fix is to also check for "uri", which is what will be in the "explicitly_mentioned_uris" list:
Mastodon: https://mastodon.example.com/@roger
Misskey: https://misskey.example.com/@roger
2023-05-26 12:30:19 -04:00
lain e853cfe7c3 Revert "Merge branch 'copyright-bump' into 'develop'"
This reverts merge request !3825
2023-01-02 20:38:50 +00:00
marcin mikołajczak 10886eeaa2 Bump copyright year
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-01-01 12:13:06 +01:00
tusooa 2554028097
Make SimplePolicy Update-aware
This is inspired by d5828f1c5e
2022-12-15 11:57:45 -05:00
tusooa dc7efcd08b
Make TagPolicy Update-aware
This is inspired by d5828f1c5e
2022-12-15 11:08:24 -05:00
Haelwenn (lanodan) Monnier 648e012022 ObjectAgePolicy: Make strip_followers behavior for followers-only explicit 2022-11-07 14:58:47 +01:00
Tusooa Zhu 997f08b350
Make AntiLinkSpamPolicy history-aware 2022-07-24 00:18:09 -04:00
Tusooa Zhu d877d2a4e7
Make HashtagPolicy history-aware 2022-07-24 00:02:39 -04:00
Tusooa Zhu 82c8fc1ede
Make NoEmptyPolicy work with Update 2022-07-23 23:24:25 -04:00
Tusooa Zhu 46a5c06853
Make NormalizeMarkup history-aware 2022-07-23 22:50:38 -04:00
Tusooa Zhu fc7ce5f93c
Make NoPlaceholderTextPolicy history-aware 2022-07-23 22:41:04 -04:00
Tusooa Zhu dce7e42928
Make MediaProxyWarmingPolicy history-aware 2022-07-23 22:34:03 -04:00
Tusooa Zhu 0a337063e1
Make ForceMentionsInContent history-aware 2022-07-23 22:23:57 -04:00
Tusooa Zhu cd19537f39
Make EnsureRePrepended history-aware 2022-07-23 17:48:39 -04:00
Tusooa Zhu eba9b0760f
Make MRF Keyword history-aware 2022-07-23 15:56:36 -04:00
Hélène a74ce2d77a
StealEmojiPolicy: fix String rejected_shortcodes
* rejected_shortcodes is defined as a list of strings in the
  configuration description. As such, database-based configuration was
  led to handle those settings as strings, and not as the actually
  expected type, Regex.
* This caused each message passing through this MRF, if a rejected
  shortcode was set and the emoji did not exist already on the instance,
  to fail federating, as an exception was raised, swiftly caught and
  mostly silenced.
* This commit fixes the issue by introducing new behavior: strings are
  now handled as perfect matches for an emoji shortcode (meaning that if
  the emoji-to-be-pulled's shortcode is in the blacklist, it will be
  rejected), while still supporting Regex types as before.
2022-05-18 21:25:10 +02:00
Haelwenn 4605efe272 Merge branch 'improve_anti_followbot_policy' into 'develop'
Also use actor_type to determine if an account is a bot in antiFollowbotPolicy

Closes #2561

See merge request pleroma/pleroma!3498
2022-05-08 18:10:40 +00:00
Ilja a8093732bd Also use actor_type to determine if an account is a bot in antiFollowbotPolicy 2022-05-08 18:10:40 +00:00
Sean King 17aa3644be
Copyright bump for 2022 2022-02-25 23:11:42 -07:00
Alex Gleason 3bf257171f
ForceMentionsInContent: improve display of Markdown posts 2022-01-27 14:15:06 -06:00
Alex Gleason 27cb3d6273
ForceMentionsInContent: don't apply it to top-level posts 2022-01-26 21:24:26 -06:00
bot a4de79ced0 ForceBotUnlistedPolicy: fix to stop unlisting my posts >:( 2022-01-26 22:53:02 +00:00
Alex Gleason 0604b0dd09
ForceMentionsInContent: don't mention self 2022-01-25 12:33:47 -06:00
Alex Gleason 65b4d2ce84
ForceMentionsInContent: fix order of mentions 2022-01-25 10:42:34 -06:00
Alex Gleason 267184b70e
ForceMentionsInContentTest: return mentions in a not terrible format 2022-01-24 20:03:43 -06:00
Alex Gleason c5a20c80c4
ForceMentionsInContent: simplify finding users 2022-01-24 19:44:44 -06:00