federails-moderation 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c01ff065ee20d0c97dd18a1385cee59dd07550fa284e6faa8a56f02c4693baf5
4
- data.tar.gz: 2d9e9502fdf3bb8e754d5302016433fc76918975fc3bf789eb9e2615cb9a3f25
3
+ metadata.gz: d5f8d2dd501b4ff7234867deb2ffdbf31d1d2ff24016272bea8f3e6f00f37f63
4
+ data.tar.gz: 565e41dbf4057c53ece759dc9f2bab3742dc24a66557556ec6eb40abfed6d4fb
5
5
  SHA512:
6
- metadata.gz: a5d38544c27a78b2d08c112235b7fa093c5d7d8939b79e46f222ba997ebef5610abf5bab007a07e3c6e1a9c66047f964e0921ae5c16fdca00c0d6d88e95b13fa
7
- data.tar.gz: 9ee81f14a7b28248766512c122488eede878701f7869abcb2c287c5ac7c2d26e12e04a231d5439dc8f5c372e6088fd4ddb03ba2ed3bc4952afd6c2e6536ce0a3
6
+ metadata.gz: 58de3d5a03f5283979650fd23c529243d69c0d928665e6821099b8132c44a8e31247fbc30806abaaf3851e9014a5dacd01bc901063c9ed3756699bd28306af68
7
+ data.tar.gz: 784a81b4107278ec491aa59adb2b2d8fa61944c64bfe45f4e7f8342d780cdf03efa01b5f0493441a2014eccd2d6a7b55fbac4c7e4c0a8f79cc6ae57aaf23048c
data/README.md CHANGED
@@ -1,98 +1,3 @@
1
1
  # Federails::Moderation
2
2
 
3
-
4
- ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/manyfold3d/federails-moderation/ci.yml)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/19eb4dd4705afea275fa/maintainability)](https://codeclimate.com/github/manyfold3d/federails-moderation/maintainability)
6
- [![Test Coverage](https://api.codeclimate.com/v1/badges/19eb4dd4705afea275fa/test_coverage)](https://codeclimate.com/github/manyfold3d/federails-moderation/test_coverage)
7
- ![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/rubygems/federails-moderation)
8
-
9
- ![GitHub Release](https://img.shields.io/github/v/release/manyfold3d/federails-moderation)
10
- ![Gem Downloads (for latest version)](https://img.shields.io/gem/dtv/federails-moderation)
11
- ![Dependent repos (via libraries.io)](https://img.shields.io/librariesio/dependent-repos/rubygems/federails-moderation)
12
-
13
- A gem that provides moderation capabilities for [Federails](https://gitlab.com/experimentslabs/federails). It adds the following features:
14
-
15
- * Handle incoming `Flag` activities, normally used for reporting content to moderators
16
- * Block federation with particular servers
17
-
18
- ## Requirements
19
-
20
- * [Federails](https://gitlab.com/experimentslabs/federails) >= 0.4
21
- * Ruby >= 3.0
22
-
23
- ## Installation
24
- Add the gem to your Rails application:
25
-
26
- ```bash
27
- > bundle add "federails-moderation"
28
- ```
29
-
30
- Then install the database migrations:
31
-
32
- ```bash
33
- > bin/rails federails_moderation:install:migrations
34
- > bin/rails db:migrate
35
- ```
36
-
37
- ## Usage
38
-
39
- ### Reports
40
-
41
- When your application receives a `Flag` activitypub message, it will create a `Federails::Moderation::Report` record with the details.
42
-
43
- ```ruby
44
- # Find all unresolved reports
45
- reports = Federails::Moderation::Report.where(resolution: nil)
46
- r = reports.first
47
-
48
- # Reports can have a comment that was sent with them:
49
- puts r.content
50
- # "This message is spam"
51
-
52
- # It will be associated with the actor that sent it:
53
- puts r.actor.at_address
54
- # "@floppy@mastodon.me.uk"
55
-
56
- # Deal with the report in your app, then either:
57
- r.resolve!
58
- # or, you can ignore it
59
- r.ignore!
60
-
61
- ```
62
-
63
- You can receive a callback in your application when a new report is received, by providing a proc which will be called:
64
-
65
- ```
66
- Federails::Moderation.configure do |conf|
67
- conf.after_report_created = ->(report) { MyApp::MyReportHandler.call(report) }
68
- end
69
- ```
70
-
71
- ### Domain Blocks
72
-
73
- You can block domains that are abusive like so:
74
-
75
- ```
76
- Federails::Moderation::DomainBlock.create(domain: "spammer.com")
77
- ```
78
-
79
- Once the block is created, incoming messages from that domain, or from any actor on that domain, will be ignored. Also, outgoing messages to that domain will be dropped before being delivered.
80
-
81
- Actors from the blocked domain aren't currently auto-removed; this may be added in the future, but for now that's left up to your application.
82
-
83
- ## Contributing
84
-
85
- Bug reports and pull requests are welcome on GitHub at https://github.com/manyfold3d/federails-moderation. This project is intended to be a safe, welcoming space for collaboration; everyone interacting in the project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/manyfold3d/federails-moderation/blob/master/CODE_OF_CONDUCT.md).
86
-
87
- ## Support & Community
88
-
89
- For help, join the main [Federails matrix chat room](https://matrix.to/#/#federails:matrix.org).
90
-
91
- ## Acknowledgements
92
-
93
- This gem builds on top of [Federails](https://gitlab.com/experimentslabs/federails), by [Manuel Tancoigne](https://gitlab.com/mtancoigne).
94
-
95
- This gem was created as part of [Manyfold](https://manyfold.app), with funding from [NGI0 Entrust](https://nlnet.nl/entrust), a fund established by [NLnet](https://nlnet.nl) with financial support from the European Commission's [Next Generation Internet](https://ngi.eu) program.
96
-
97
- [<img src="https://nlnet.nl/logo/banner.png" alt="NLnet foundation logo" width="20%" />](https://nlnet.nl)
98
- [<img src="https://nlnet.nl/image/logos/NGI0_tag.svg" alt="NGI Zero Logo" width="20%" />](https://nlnet.nl/entrust)
3
+ This gem has changed name and is deprecated, please switch over to [fedipub-moderation](https://gitlab.com/fedipub/fedipub-moderation) instead.
@@ -4,6 +4,9 @@ module Federails::Moderation
4
4
 
5
5
  def self.blocked?(query)
6
6
  self.exists?(domain: [ query, PublicSuffix.parse(query).domain ])
7
+ rescue PublicSuffix::Error
8
+ # Allow things that we don't understand
9
+ false
7
10
  end
8
11
  end
9
12
  end
@@ -4,8 +4,8 @@ module Federails::Moderation
4
4
 
5
5
  included do
6
6
  class <<self
7
- def filter_post_to_inbox(to:, message:, from: nil)
8
- filtered_post_to_inbox(to: to, message: message, from: from) unless DomainBlock.blocked?(to.server)
7
+ def filter_post_to_inbox(inbox_url:, message:, from: nil)
8
+ filtered_post_to_inbox(inbox_url: inbox_url, message: message, from: from) unless DomainBlock.blocked?(URI.parse(inbox_url).hostname)
9
9
  end
10
10
 
11
11
  alias_method :filtered_post_to_inbox, :post_to_inbox
@@ -1,5 +1,5 @@
1
1
  module Federails
2
2
  module Moderation
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: federails-moderation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 2025-03-26 00:00:00.000000000 Z
11
+ date: 2026-07-22 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: rails
@@ -29,44 +30,49 @@ dependencies:
29
30
  requirements:
30
31
  - - "~>"
31
32
  - !ruby/object:Gem::Version
32
- version: '0.4'
33
+ version: '0.8'
33
34
  type: :runtime
34
35
  prerelease: false
35
36
  version_requirements: !ruby/object:Gem::Requirement
36
37
  requirements:
37
38
  - - "~>"
38
39
  - !ruby/object:Gem::Version
39
- version: '0.4'
40
+ version: '0.8'
40
41
  - !ruby/object:Gem::Dependency
41
42
  name: public_suffix
42
43
  requirement: !ruby/object:Gem::Requirement
43
44
  requirements:
44
- - - "~>"
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '6'
48
+ - - "<"
45
49
  - !ruby/object:Gem::Version
46
- version: '6.0'
50
+ version: '8'
47
51
  type: :runtime
48
52
  prerelease: false
49
53
  version_requirements: !ruby/object:Gem::Requirement
50
54
  requirements:
51
- - - "~>"
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '6'
58
+ - - "<"
52
59
  - !ruby/object:Gem::Version
53
- version: '6.0'
60
+ version: '8'
54
61
  - !ruby/object:Gem::Dependency
55
62
  name: simplecov
56
63
  requirement: !ruby/object:Gem::Requirement
57
64
  requirements:
58
65
  - - "~>"
59
66
  - !ruby/object:Gem::Version
60
- version: '0.22'
67
+ version: '1.0'
61
68
  type: :development
62
69
  prerelease: false
63
70
  version_requirements: !ruby/object:Gem::Requirement
64
71
  requirements:
65
72
  - - "~>"
66
73
  - !ruby/object:Gem::Version
67
- version: '0.22'
68
- description: Moderation additions for Federails; reporting, limit/suspend, server
69
- blocking, etc
74
+ version: '1.0'
75
+ description: "[DEPRECATED] renamed, use fedipub-moderation instead"
70
76
  email:
71
77
  - james@floppy.org.uk
72
78
  executables: []
@@ -100,6 +106,8 @@ metadata:
100
106
  homepage_uri: https://github.com/manyfold3d/federails-moderation
101
107
  source_code_uri: https://github.com/manyfold3d/federails-moderation
102
108
  changelog_uri: https://github.com/manyfold3d/federails-moderation/releases
109
+ post_install_message: federails and federails-moderation have been renamed; switch
110
+ to fedipub and fedipub-moderation instead for future updates
103
111
  rdoc_options: []
104
112
  require_paths:
105
113
  - lib
@@ -114,7 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
122
  - !ruby/object:Gem::Version
115
123
  version: '0'
116
124
  requirements: []
117
- rubygems_version: 3.6.2
125
+ rubygems_version: 3.5.22
126
+ signing_key:
118
127
  specification_version: 4
119
- summary: Moderation additions for Federails.
128
+ summary: "[DEPRECATED] Moderation additions for Federails."
120
129
  test_files: []