From e1511acde00654fa7455761c348d57dff4ef63f8 Mon Sep 17 00:00:00 2001 From: Justin Warren Date: Sun, 12 Feb 2023 16:30:48 +1100 Subject: [PATCH 1/6] Prepare for release of v0.4.3 --- CHANGELOG.md | 18 ++++++++++++++++++ pyproject.toml | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ac7b51..211b866 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,24 @@ This project uses [Semantic Versioning] and generally follows the conventions of ## [Unreleased] +## [v0.4.3] - 2023-02-12 + +### Added + +- Blockdata var already converted to _asdict() (8d3b9da) +- Added Mastodon public API parser type because #33 (9fe9342) +- Added ability to set scheme when talking to instances (9fe9342) +- Added tests of comment merging. (fb3a7ec) + +### Changed + +- Don't merge comments if new comment is empty. (b8aa11e) +- Tweaked comment merging to pass tests. (fb3a7ec) + +## [v0.4.1] - 2023-01-15 + +Allowlist support. + - Planning to add allowlist thresholds as noted in #28 ## [v0.4.2] - 2023-01-19 diff --git a/pyproject.toml b/pyproject.toml index 4fddc2b..ec1669d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "fediblockhole" -version = "0.4.2" +version = "0.4.3" description = "Federated blocklist management for Mastodon" readme = "README.md" license = {file = "LICENSE"} From df3c16f24d61529ab3e14f5d5c58f6fbed28a4aa Mon Sep 17 00:00:00 2001 From: Justin Warren Date: Sun, 12 Feb 2023 16:32:56 +1100 Subject: [PATCH 2/6] Dropped minimum Python version to 3.6 --- pyproject.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ec1669d..2736623 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "0.4.3" description = "Federated blocklist management for Mastodon" readme = "README.md" license = {file = "LICENSE"} -requires-python = ">=3.10" +requires-python = ">=3.6" keywords = ["mastodon", "fediblock"] authors = [ {name = "Justin Warren"}, {email = "justin@eigenmagic.com"} @@ -17,6 +17,10 @@ classifiers = [ "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.6", ] dependencies = [ "requests", From b63f03669e067a61ef5185c89157f448a1295f9a Mon Sep 17 00:00:00 2001 From: Justin Warren Date: Sun, 12 Feb 2023 16:38:13 +1100 Subject: [PATCH 3/6] Update changelog with Python version change. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 211b866..4b7b88d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This project uses [Semantic Versioning] and generally follows the conventions of ### Changed +- Dropped minimum Python version to 3.6 (df3c16f) - Don't merge comments if new comment is empty. (b8aa11e) - Tweaked comment merging to pass tests. (fb3a7ec) From 2a5873261f08e458ef459157213e2cfa9a61f6a7 Mon Sep 17 00:00:00 2001 From: Justin Warren Date: Mon, 13 Feb 2023 08:51:19 +1100 Subject: [PATCH 4/6] Updated changelog in prep for release. --- CHANGELOG.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b7b88d..16984f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,14 +6,15 @@ This project uses [Semantic Versioning] and generally follows the conventions of ## [Unreleased] -## [v0.4.3] - 2023-02-12 +## [v0.4.3] - 2023-02-13 ### Added -- Blockdata var already converted to _asdict() (8d3b9da) - Added Mastodon public API parser type because #33 (9fe9342) - Added ability to set scheme when talking to instances (9fe9342) - Added tests of comment merging. (fb3a7ec) +- Added blocklist thresholds. (bb1d89e) +- Added logging to help debug threshold-based merging. (b67ff0c) ### Changed @@ -21,12 +22,6 @@ This project uses [Semantic Versioning] and generally follows the conventions of - Don't merge comments if new comment is empty. (b8aa11e) - Tweaked comment merging to pass tests. (fb3a7ec) -## [v0.4.1] - 2023-01-15 - -Allowlist support. - -- Planning to add allowlist thresholds as noted in #28 - ## [v0.4.2] - 2023-01-19 ### Fixed From b92dd21377168d8b8b690194b8e819fe5fd9a87b Mon Sep 17 00:00:00 2001 From: Justin Warren Date: Mon, 13 Feb 2023 08:59:08 +1100 Subject: [PATCH 5/6] Updated documentation to reflect Mastodon v4.1.0 changes to the application scopes screen. --- README.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 882fca8..5db678f 100644 --- a/README.md +++ b/README.md @@ -81,17 +81,16 @@ admin to add a new Application at `https:///settings/applications/` and then tell you the access token. -The application needs the `admin:read:domain_blocks` OAuth scope, but -unfortunately this scope isn't available in the current application screen -(v4.0.2 of Mastodon at time of writing, but this has been fixed in the main -branch). +The application needs the `admin:read:domain_blocks` OAuth scope. You can allow +full `admin:read` access, but be aware that this authorizes someone to read all +the data in the instance. That's asking a lot of a remote instance admin who +just wants to share domain_blocks with you. -You can allow full `admin:read` access, but be aware that this authorizes -someone to read all the data in the instance. That's asking a lot of a remote -instance admin who just wants to share domain_blocks with you. +The `admin:read:domain_blocks` scope is available as of Mastodon v4.1.0, but for +earlier versions admins will need to use the manual method described below. -For now, you can ask the instance admin to update the scope in the database -directly like this: +You can update the scope for your application in the database directly like +this: ``` UPDATE oauth_applications as app @@ -136,8 +135,12 @@ chmod o-r ``` You can also grant full `admin:write` scope to the application, but if you'd -prefer to keep things more tightly secured you'll need to use SQL to set the -scopes in the database and then regenerate the token: +prefer to keep things more tightly secured, limit the scope to +`admin:read:domain_blocks`. + +Again, this scope is only available in the application config screen as of +Mastodon v4.1.0. If your instance is on an earlier version, you'll need to use +SQL to set the scopes in the database and then regenerate the token: ``` UPDATE oauth_applications as app From 6c72af86666991cfc5a9f1d971fe3cdead570d7f Mon Sep 17 00:00:00 2001 From: Justin Warren Date: Mon, 13 Feb 2023 09:06:27 +1100 Subject: [PATCH 6/6] Added extra documentation on configuring thresholds. --- etc/sample.fediblockhole.conf.toml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/etc/sample.fediblockhole.conf.toml b/etc/sample.fediblockhole.conf.toml index e377e97..bd93663 100644 --- a/etc/sample.fediblockhole.conf.toml +++ b/etc/sample.fediblockhole.conf.toml @@ -56,6 +56,24 @@ blocklist_instance_destinations = [ # The 'min' mergeplan will use the lightest severity block found for a domain. # mergeplan = 'max' +## Optional threshold-based merging. +# Only merge in domain blocks if the domain is mentioned in +# at least `threshold` blocklists. +# `merge_thresold` is an integer, with a default value of 0. +# The `merge_threshold_type` can be `count` or `pct`. +# If `count` type is selected, the threshold is reached when the domain +# is mentioned in at least `merge_threshold` blocklists. The default value +# of 0 means that every block in every list will be merged in. +# If `pct` type is selected, `merge_threshold` is interpreted as a percentage, +# i.e. if `merge_threshold` = 20, blocks will only be merged in if the domain +# is present in at least 20% of blocklists. +# Percentage calculated as number_of_mentions / total_number_of_blocklists. +# The percentage method is more flexibile, but also more complicated, so take care +# when using it. +# +# merge_threshold_type = 'count' +# merge_threshold = 0 + ## Set which fields we import ## 'domain' and 'severity' are always imported, these are additional ##